This is what I want to do:
(a) use a Series<double> to store values calculated in OnBarUpdate()
(b) apply an indicator - for example the EMA or SMA - to that data series
(c) pass the result to an IDataSeries object
Please find attached a simple indicator which seems to work. But is it correctly coded? Would you be so kind and look at lines 52 - 58, where SMA and EMA are applied to the private Series<double> "trueRange", the result then being passed to an ISeries<double>?
trueRange = new Series<double>(this, period < 125 ? MaximumBarsLookBack.TwoHundredFiftySix : MaximumBarsLookBack.Infinite); if(calcMode == thisATRCalcMode.Arithmetic) averageTrueRange = SMA(trueRange, period); else if(calcMode == thisATRCalcMode.Exponential) averageTrueRange = EMA(trueRange, period); else averageTrueRange = EMA(trueRange, 2*period - 1);
Comment