middle[x] = iMA(NULL, 0, period, 0, MODE_SMA, PRICE_TYPICAL, x);
middle[x] = iMA(NULL, PERIODSET, period, 0, MODE_SMA, PRICE_TYPICAL, x);
where PERIODSET is defined to be extern int PERIODSET = "some period". And when I call iCustom I pass this period like:
iCustom(Symbol(), PERIOD_H1, KeltnerPeriod, PERIOD_H1, 0, 1);
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?
WHRoeder said that we can do it if we do the following:
datetime when = Time[i]; // Chart
int iM5 = iBarShift(NULL, 0, when); // M5
double m5value = iHigh(Symbol(), PERIOD_M5, iM5); // M5
ExtCurrM5H[i] = m5value;
Don't mix apples and oranges. X indexes the current timeframe bars. You can't use it on other timeframes. Would you want middle to be yesterdays MA of D1 chart and middle to be last weeks?
int iPS = iBarShift(NULL, PERIODSET, Time[x])
middle[x] = iMA(NULL, PERIODSET, period, 0, MODE_SMA, PRICE_TYPICAL, iPS);
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
To add comments, please log in or register