int dailyrange() { int R5 = 0.0; for(int i=1;i<=5;i++) R5+=(iHigh(Symbol(),PERIOD_D1,i)-iLow(Symbol(),PERIOD_D1,i)/Point); int averagedailyrange = R5/5; return(averagedailyrange); }
Something like that
Digitals113:
Struggling trying to hardcode the formula for 5 day ADR into my expert advisor. Not sure what I'm missing but it keeps returning 0.
R5=(iHigh(Symbol(),PERIOD_D1,i)-(iLow(Symbol(),PERIOD_D1,i))/Point); averagedailyrange = R5/5;
averagedailyrange is the range of a single day divided by 5
Sorry, changed

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
Struggling trying to hardcode the formula for 5 day ADR into my expert advisor. Not sure what I'm missing but it keeps returning 0.