Download MetaTrader 5

Identifying Moving Average Candle crossover.

To add comments, please log in or register
salirazataqvi
24
salirazataqvi  

Hi All,

 

I want to know that how to identify that Moving Average line has crossed candle. please tell me what method or logic I can use to identify Moving Average Candle crossover. 

Thanks. 

Stuart Browne
6600
Stuart Browne  
salirazataqvi:

Hi All,

 

I want to know that how to identify that Moving Average line has crossed candle. please tell me what method or logic I can use to identify Moving Average Candle crossover. 

Thanks. 

Depending on if you want the current live candle or the previous closed candle, pseudo code would be something like:

if ( (close[1] < MA[1] ) && (close[0] > MA[0])  )
 // candle broke above MA

if ( (close[1] > MA[1] ) && (close[0] < MA[0])  )
 // candle fell below MA
salirazataqvi
24
salirazataqvi  
Stuart Browne:

Depending on if you want the current live candle or the previous closed candle, pseudo code would be something like:

To add comments, please log in or register