Download MetaTrader 5

Getting the Moving Average value from other timeframe

To add comments, please log in or register
Joao
5
Joao  

Hello, 

 I'm running a EA on a 4 hours chart, for example, but want to get the value of a moving average on daily timeframe but in the time that the daily candle closed.

 

The same applies for a 5 minutes chart, for example. If I'm running the EA on a 5 Minutes chart and want to get the moving average value from the 15 minute chart but at the time that the last 15 minute closed...

 

Maybe I just can play with the shift parameter?

 

double  iMA(
   string       symbol,           // symbol
   int          timeframe,        // timeframe
   int          ma_period,        // MA averaging period
   int          ma_shift,         // MA shift
   int          ma_method,        // averaging method
   int          applied_price,    // applied price
   int          shift             // shift

   );

If I specify in the shift 1, and the time frame 15 minutes, then it will retrieve the value of the MA when the last candle closed at the 15 minutes?

Keith Watford
Moderator
10001
Keith Watford  
jonhfxtrade:

If I specify in the shift 1, and the time frame 15 minutes, then it will retrieve the value of the MA when the last candle closed at the 15 minutes?

 

 

 

 

Yes
To add comments, please log in or register