hi,
i imported daily range to my EA USING icustom. i want to generate signal if daily range is above 100 and today is above 10 and less than 50.
i wrote code like , but i am not able to get required output. can anyone help this.
and also can anyone help while importing technical indicator ...can you tell me how should i do it.
code is as follows
this is my daily range mql4
i imported daily range to my EA USING icustom. i want to generate signal if daily range is above 100 and today is above 10 and less than 50.
i wrote code like , but i am not able to get required output. can anyone help this.
and also can anyone help while importing technical indicator ...can you tell me how should i do it.
code is as follows
MQL4:
bool dailyrange() { double adr= iCustom(NULL,0,"Daily Range PeterE",10,1,1); if (adr >=100) { return(True); } Else { return(false); } }
this is my daily range mql4
MQL4:
#property indicator_chart_window extern int NumOfDays = 10; extern string FontName = "Courier New"; extern int FontSize = 10; extern color FontColor = White; extern int Window = 0; extern int Corner = 0; extern int HorizPos = 5; extern int VertPos = 20; double pnt; int dig; string objname = "*DRPE"; //+------------------------------------------------------------------+ int init() { //+------------------------------------------------------------------+ pnt = MarketInfo(Symbol(),MODE_POINT); dig = MarketInfo(Symbol(),MODE_DIGITS); if (dig == 3 || dig == 5) { pnt *= 10; } ObjectCreate(objname,OBJ_LABEL,Window,0,0); return(0); } //+------------------------------------------------------------------+ int deinit() { //+------------------------------------------------------------------+ ObjectDelete(objname); return(0); } //+------------------------------------------------------------------+ int start() { //+------------------------------------------------------------------+ int c=0; double sum=0; for (int i=1; i<Bars-1; i++) { double hi = iHigh(NULL,PERIOD_D1,i); double lo = iLow(NULL,PERIOD_D1,i); datetime dt = iTime(NULL,PERIOD_D1,i); if (TimeDayOfWeek(dt) > 0 && TimeDayOfWeek(dt) < 6) { sum += hi - lo; c++; if (c>=NumOfDays) break; } } hi = iHigh(NULL,PERIOD_D1,0); lo = iLow(NULL,PERIOD_D1,0); if (i>0 && pnt>0) { string objtext = "ADR = " + DoubleToStr(sum/c/pnt,1) + " (" + c + " days) Today = " + DoubleToStr((hi-lo)/pnt,1); ObjectSet(objname,OBJPROP_CORNER,Corner); ObjectSet(objname,OBJPROP_XDISTANCE,HorizPos); ObjectSet(objname,OBJPROP_YDISTANCE,VertPos); ObjectSetText(objname,objtext,FontSize,FontName,FontColor); } return(0); }
Last edited by a moderator: