Skip to content

IndicatorDataSeries

Summary

Represents a mutable array of values. An extension of DataSeries used to represent indicator values.

Signature

1
public abstract interface IndicatorDataSeries

Namespace

cAlgo.API

Examples

1
2
3
 // This will be the output result of your indicator
 [Output("Result", Color = Colors.Orange)]
 public IndicatorDataSeries Result { get; set; }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
 //  The following example is the calculation of the simple moving average
 //  of the median price
 [Output("Result")]
 public IndicatorDataSeries Result { get; set; }
 private IndicatorDataSeries _dataSeries;
 private SimpleMovingAverage _simpleMovingAverage;
 protected override void Initialize()
 {
     _dataSeries = CreateDataSeries();
     _simpleMovingAverage = Indicators.SimpleMovingAverage(_dataSeries, 14);
 }
 public override void Calculate(int index)
 {
     _dataSeries[index] = (Bars.HighPrices[index] + Bars.LowPrices[index])/2;
     Result[index] = _simpleMovingAverage.Result[index];
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 using cAlgo.API;
 namespace cAlgo
 {
     // This sample shows how to use an indicator data series
     [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
     public class IndicatorDataSeriesSample : Indicator
     {
         private IndicatorDataSeries _internalSeries;
         [Output("Main", LineColor = "Yellow", PlotType = PlotType.Line, Thickness = 1)]
         public IndicatorDataSeries Main { get; set; }
         protected override void Initialize()
         {
             // If an indicator data series doesn't has the Output attribute then you must create it manually
             _internalSeries = CreateDataSeries();
         }
         public override void Calculate(int index)
         {
             _internalSeries[index] = Bars.HighPrices[index];
             Main[index] = _internalSeries[index] - Bars.LowPrices[index];
         }
     }
 }
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
 import clr
 clr.AddReference("cAlgo.API")
 from cAlgo.API import *
 class Test():
     def initialize(self):
         self.dataSeries = api.CreateDataSeries()
         self.simpleMovingAverage = api.Indicators.SimpleMovingAverage(self.dataSeries, 14)
     def calculate(self, index):
         self.dataSeries[index] = (api.Bars.HighPrices[index] + api.Bars.LowPrices[index]) / 2
         # Result is an output defined in C# file of indicator
         api.Result[index] = self.simpleMovingAverage.Result[index]
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
 import clr
 clr.AddReference("cAlgo.API")
 from cAlgo.API import *
 class IndicatorDataSeriesSample():
     def initialize(self):
         self.internalSeries = api.CreateDataSeries()
     def calculate(self, index):
         self.internalSeries[index] = api.Bars.HighPrices[index]
         # Main is an output defined in C# file of indicator
         api.Main[index] = self.internalSeries[index] - api.Bars.LowPrices[index]

Properties

Item

Signature

1
public abstract double Item {get; set;}

Return Value

double

LineOutput

Summary

Gets the indicator line output.

Signature

1
public abstract IndicatorLineOutput LineOutput {get;}

Return Value

IndicatorLineOutput