this[int index]


Summary

Gets the value in the dataseries at the specified position.

Syntax

public double this[int index]{ get; }

Parameters

NameDescription

Example 1

//...
[Parameter("Data Source")]
public DataSeries Source { get; set; }
//...
[Output("Main")]
public IndicatorDataSeries Result{ get; set; }
//...
public override void Calculate(int index)
{
    // This is the simple moving average calculation.
    double sum = 0.0;
    for (int i = 0; i <= Periods-1; i++)
    {
        // Source[i] is the item contained in Source at position i
        sum += Source[i];
    }
    Result[index] = sum / Periods;
}
//...