A) consider using iATR for Average Range (it takes gaps into account)
B)
double highestLast14 = High[iHighest(NULL, 0, MODE_HIGH, 14, index)]; double lowestLast14 = Low [iLowest (NULL, 0, MODE_LOW , 14, index)];
NB Just typed, not compiled or checked
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I want to tell MT4 market is ranging by comparing the Average Range for the last N period/days against the High and Low for the last N period/days.
Getting the Average Range I can do using
for (NPeriod=shift ; Nperiod<=shift+11; Nperiodr++) {
AvgRange=AvgRange+(High[Nperiod]-Low[Nperiod]);
But how do i tell MT4 what the High and Lows are for the last N period/days?
Hope someone out there can help me out.