Hi,
This iMAonArray isn't working well. There is indication in some of it but not all.
Base on the picture attach, the MA is in the OB or OS area, but no indication. The arrow that can be seen indicate MA in OB or OS.
here is the code
This iMAonArray isn't working well. There is indication in some of it but not all.
Base on the picture attach, the MA is in the OB or OS area, but no indication. The arrow that can be seen indicate MA in OB or OS.
here is the code
Inserted Code
//+------------------------------------------------------------------+ //| 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)); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+