I try a recursive way to smooth the value, then set it to the same data series.
But it can't work.
Is there something wrong with the value setting of data series?
public class AATest : Indicator { #region Variables private DataSeries myDataSeries; #endregion protected override void Initialize() { Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0")); Overlay = false; myDataSeries = new DataSeries(this); } protected override void OnBarUpdate() { double strValue = (Close[0]-Low[LowestBar(Low,30)])/(High[HighestBar(High,30)]-Low[LowestBar(Low,30)])*100; myDataSeries.Set((strValue+15*myDataSeries[1])/16); Plot0.Set(myDataSeries[0]); } #region Properties [Browsable(false)] // this line prevents the data series from being displayed in the indicator properties dialog, do not remove [XmlIgnore()] // this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove public DataSeries Plot0 { get { return Values[0]; } } #endregion }
Comment