It displays accurately.
Aren't you mistaking anything of displaying MA? In your program it is MODE_EMA.
This is the most right side part.
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
hi,

I need help on this indicator. I tried the iMAonArray, it is working but some how it doesn't indicate on all the point.
MA is inside the Stochastic. EMA12 and EMA5. When both EMA at OB, it will indicate in the chart and same goes for OS
//+------------------------------------------------------------------+ //| TEST.mq4 | //| Copyright 2015, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2015, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property strict #property indicator_chart_window #property indicator_buffers 3 #property indicator_plots 3 #property indicator_label1 "STOCH" //--- Arrow #property indicator_label2 "ArrUp" #property indicator_label3 "ArrDn" //--- input parameters enum eprice { s0 = 0,//LOW/HIGH s1 = 1 //CLOSE/CLOSE }; input string __________01__________="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; input string __________02__________="=ALERT=";//SHOW ARROW input string __________03__________="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; input bool ARROW = true;//SHOW ARROW eprice sto_price=0;//PRICE FIELD //--- indicator buffers double STOCHBuffer[]; double ArrUpBuffer[]; double ArrDnBuffer[]; //--------------- //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping IndicatorBuffers(3); SetIndexBuffer(0,ArrUpBuffer);SetIndexStyle(0,DRAW_ARROW,STYLE_SOLID,2,clrWhite);SetIndexArrow(0,241); SetIndexBuffer(1,ArrDnBuffer);SetIndexStyle(1,DRAW_ARROW,STYLE_SOLID,2,clrWhite);SetIndexArrow(1,242); SetIndexBuffer(2,STOCHBuffer); //--------------- return(INIT_SUCCEEDED); } //--------------- //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { //--------------- int i,limit; limit=rates_total-prev_calculated; if(prev_calculated>0)limit=limit+2; for(i=limit-2;i>=0;i--) { STOCHBuffer[i]=iStochastic(_Symbol,_Period,50,3,5,MODE_EMA,(int)sto_price,MODE_MAIN,i); if(ARROW && iMAOnArray(STOCHBuffer,0,12,0,MODE_EMA,i)<=10.0 && iMAOnArray(STOCHBuffer,0,5,0,MODE_EMA,i)<=10.0 ) {ArrUpBuffer[i]=iLow(_Symbol,_Period,i)-20*pix_y();} if(ARROW && iMAOnArray(STOCHBuffer,0,12,0,MODE_EMA,i)>=90.0 && iMAOnArray(STOCHBuffer,0,5,0,MODE_EMA,i)>=90.0 ) {ArrDnBuffer[i]=iHigh(_Symbol,_Period,i)+20*pix_y();} } //--------------- return(rates_total); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double pix_y() { return((ChartGetDouble(0,CHART_PRICE_MAX,0)-ChartGetDouble(0,CHART_PRICE_MIN,0))/ChartGetInteger(0,CHART_HEIGHT_IN_PIXELS,0)); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+