I have following question. In MT4 there is following function:
double iMACD( string symbol, // symbol int timeframe, // timeframe int fast_ema_period, // Fast EMA period int slow_ema_period, // Slow EMA period int signal_period, // Signal line period int applied_price, // applied price int mode, // line index int shift // shift );
so, in my code, if I need to get macd value from current timeframe I can use following code:
double val = iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0);
If indicator or strategy work at 1 minute time frame, but I want to see macd at 5 minute time frame I can use the following comand:
double val = iMACD(NULL, PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,0);
If I want to get value of previous 5 minutes time frame, I can use following code: double val = iMACD(NULL, PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,1); If I want to get value of 10 minutes before, I can use this line: double val = iMACD(NULL, PERIOD_M5,12,26,9,PRICE_CLOSE,MODE_MAIN,2);
Regarding to this I have two questions: 1. How to get value of macd from time-frame different from which custom indicator is executed? 2. How to get value of macd from time-frame different from which custom indicator is executed and if time frame is not standard ( for example timeframe of 28 minutes ). 3. How to get those values while implementing IStrategy and IIndicator?
|