Menu
Brokers
MT4 Forex Brokers
MT5 Forex brokers
PayPal Brokers
Skrill Brokers
Oil Trading Brokers
Gold Trading Brokers
Web Browser Platform
Brokers with CFD Trading
ECN Brokers
Bitcoin FX Brokers
PAMM Forex Brokers
With Cent Accounts
With High Leverage
Cryptocurrency Brokers
Forums
All threads
New threads
New posts
Trending
Search forums
What's new
New threads
New posts
Latest activity
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Reply to thread
Forums
Trading Platforms
MetaTrader Expert Advisors
DAily range to my Expert advisor
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
[QUOTE="shashi6666, post: 131080, member: 42672"] 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 [code=mql4]bool dailyrange() { double adr= iCustom(NULL,0,"Daily Range PeterE",10,1,1); if (adr >=100) { return(True); } Else { return(false); } }[/code] this is my daily range mql4 [code=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); }[/code] [/QUOTE]
Insert quotes…
Verification
Post reply
Top
Bottom
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…