middle[x] = iMA(NULL, 0, period, 0, MODE_SMA, PRICE_TYPICAL, x);
middle[x] = iMA(NULL, PERIODSET, period, 0, MODE_SMA, PRICE_TYPICAL, x);
Don't mix apples and oranges. X indexes the current timeframe bars. You can't use it on other timeframes. Would you want middle[1] to be yesterdays MA of D1 chart and middle[7] to be last weeks?
int iPS = iBarShift(NULL, PERIODSET, Time[x]) middle[x] = iMA(NULL, PERIODSET, period, 0, MODE_SMA, PRICE_TYPICAL, iPS);
Don't mix apples and oranges. X indexes the current timeframe bars. You can't use it on other timeframes. Would you want middle[1] to be yesterdays MA of D1 chart and middle[7] to be last weeks?
Thanks but I am not sure after testing the following:
1/ I have verified:
Print(iClose(Symbol(), PERIOD_D1, 1));
on a 1hr chart i.e. put the above in an ea and then run strategy tester with Period: 1hr.
The time given in the journal tab is indeed correct (time of close of the previous day). But according to what you said the shift of "1" in the above print statement should refer to the current chart which is of Period 1hr. This did not happen.
2/The second thing is that when I run my multiple timeframe ea on a live trading it works (not sure if it always work) even though the chart I opened is a 1hr one

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
where PERIODSET is defined to be extern int PERIODSET = "some period". And when I call iCustom I pass this period like:
where the parameter after KeltnerPeriod is is for PERIODSET
It did not work; same error as above. Does anyone know if this testing is possible?
Thx!
WHRoeder said that we can do it if we do the following: