How to check if bar is below or above EMA/SMA

Created at 24 Oct 2020, 20:47
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
JO

joanne_llamado

Joined 24.10.2020

How to check if bar is below or above EMA/SMA
24 Oct 2020, 20:47


Hi, 

Can someone help me how to check if the bar is below EMA/SMA indicator.

Thanks in advance.


@joanne_llamado
Replies

PanagiotisCharalampous
26 Oct 2020, 08:26

Hi joanne_llamado,

Here is an example

           var sma = Indicators.SimpleMovingAverage(Bars.ClosePrices,14);
           if(Bars.HighPrices.Last(1) < sma.Result.LastValue)
           {
                // do something
           }

Best Regards,

Panagiotis 

Join us on Telegram 

 


@PanagiotisCharalampous