CH
Last close less SMA
20 Jul 2013, 17:44
Dear all,
I'm trying to create a Indicator that show the difference between the last close and the moving average.
CLOSE-SMA
Can someone help me thru this ?
Thank you in avance.
Chris

Kate
21 Jul 2013, 10:45
using System; using cAlgo.API; using cAlgo.API.Indicators; namespace cAlgo.Indicators { [Indicator(IsOverlay = false)] public class CloseLessSma : Indicator { [Parameter(DefaultValue = 14)] public int Period { get; set; } [Output("Main")] public IndicatorDataSeries Result { get; set; } private MovingAverage sma; protected override void Initialize() { sma = Indicators.SimpleMovingAverage(MarketSeries.Close, Period); } public override void Calculate(int index) { Result[index] = MarketSeries.Close[index] - sma.Result[index]; } } }@Kate