Represents a mutable array of values. An extension of DataSeries used to represent indicator values.
Signature
1
publicabstractinterfaceIndicatorDataSeries
Namespace
cAlgo.API
Examples
123
// This will be the output result of your indicator[Output("Result", Color = Colors.Orange)]publicIndicatorDataSeriesResult{get;set;}
1 2 3 4 5 6 7 8 910111213141516
// The following example is the calculation of the simple moving average// of the median price[Output("Result")]publicIndicatorDataSeriesResult{get;set;}privateIndicatorDataSeries_dataSeries;privateSimpleMovingAverage_simpleMovingAverage;protectedoverridevoidInitialize(){_dataSeries=CreateDataSeries();_simpleMovingAverage=Indicators.SimpleMovingAverage(_dataSeries,14);}publicoverridevoidCalculate(intindex){_dataSeries[index]=(Bars.HighPrices[index]+Bars.LowPrices[index])/2;Result[index]=_simpleMovingAverage.Result[index];}
1 2 3 4 5 6 7 8 910111213141516171819202122
usingcAlgo.API;namespacecAlgo{// This sample shows how to use an indicator data series[Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]publicclassIndicatorDataSeriesSample:Indicator{privateIndicatorDataSeries_internalSeries;[Output("Main", LineColor = "Yellow", PlotType = PlotType.Line, Thickness = 1)]publicIndicatorDataSeriesMain{get;set;}protectedoverridevoidInitialize(){// If an indicator data series doesn't has the Output attribute then you must create it manually_internalSeries=CreateDataSeries();}publicoverridevoidCalculate(intindex){_internalSeries[index]=Bars.HighPrices[index];Main[index]=_internalSeries[index]-Bars.LowPrices[index];}}}
1 2 3 4 5 6 7 8 91011
importclrclr.AddReference("cAlgo.API")fromcAlgo.APIimport*classTest():definitialize(self):self.dataSeries=api.CreateDataSeries()self.simpleMovingAverage=api.Indicators.SimpleMovingAverage(self.dataSeries,14)defcalculate(self,index):self.dataSeries[index]=(api.Bars.HighPrices[index]+api.Bars.LowPrices[index])/2# Result is an output defined in C# file of indicatorapi.Result[index]=self.simpleMovingAverage.Result[index]
1 2 3 4 5 6 7 8 910
importclrclr.AddReference("cAlgo.API")fromcAlgo.APIimport*classIndicatorDataSeriesSample():definitialize(self):self.internalSeries=api.CreateDataSeries()defcalculate(self,index):self.internalSeries[index]=api.Bars.HighPrices[index]# Main is an output defined in C# file of indicatorapi.Main[index]=self.internalSeries[index]-api.Bars.LowPrices[index]