Syntax for "if price is above Moving Average"

Created at 14 May 2019, 15:45
AL

alex_mihail

Joined 09.08.2018

Syntax for "if price is above Moving Average"
14 May 2019, 15:45


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?


@alex_mihail
Replies

PanagiotisCharalampous
14 May 2019, 16:05

Hi alex_mihal,

See below

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

Best Regards,

Panagiotis


@PanagiotisCharalampous