Syntax for "if price is above Moving Average"

14 May 2019, 15:45Syntax for "if price is above Moving Average"#1
alex_mihailposts: 30since: 09 Aug 2018

I can't quite seem to get it to work using sma HasCrossedAbove/Below ... what is the syntax for "if current price has moved above 10 SMA" for example?

14 May 2019, 16:05#2
Panagiotis Charalampousposts: 2715since: 13 Jan 2017

Hi alex_mihal,

See below

            var sma = Indicators.SimpleMovingAverage(MarketSeries.Close, 10);
            if (Symbol.Bid > sma.Result.LastValue)
            {
                //Do something
            }

Best Regards,

Panagiotis


Head of Community Management at cTrader