Problem with iHighest/lowest, counts bars on current timeframe, not PERIOD argument
sanders4069:
I am trying to get the highest high/ lowest low of last 4 weekly bars. The code works when I have it on the weekly timeframe, but when I switch timeframes it changes the value to the highest/lowest of whatever bars are there. So for example I am backtesting an EA on 5min data, and it is using the high/low of last 5min bars, instead of weekly bars. Any ideas why? Thanks in advance.
double fourWeekHigh = iHigh(NULL, PERIOD_W1, iHighest(NULL, PERIOD_W1, MODE_HIGH, 4,1)); double fourWeekLow = iLow(NULL, PERIOD_W1, iLowest(NULL, PERIOD_W1, MODE_LOW, 4, 1));Maybe change it like....
deVries:
Maybe change it like....
Maybe change it like....
We have a winner, thanks for the help!
I am trying to get the highest high/ lowest low of last 4 weekly bars. The code works when I have it on the weekly timeframe, but when I switch timeframes it changes the value to the highest/lowest of whatever bars are there. So for example I am backtesting an EA on 5min data, and it is using the high/low of last 5min bars, instead of weekly bars. Any ideas why? Thanks in advance.