Indicator


Summary

Base class for Indicators.

Remarks

Contains all necessary market information, provides access to built-in indicators and provides framework for convenient indicators' creation.

Syntax

public class Indicator : Algo, IIndicator

Members

NameTypeSummary
Account PropertyContains information of the current account.
Calculate MethodCalculate the value(s) of indicator for the given index.
Indicator MethodIndicator class constructor
IndicatorArea PropertyDefines the area where the indicator is placed.
Initialize MethodCustom initialization for the Indicator. This method is invoked when an indicator is launched.
IsLastBar PropertyReturns true, if Calculate is invoked for the last bar
ToString MethodThe name of the indicator derived class.

Example 1

//...
public override void Calculate(int index)
{
    //This is where we place our indicator's calculation logic.
}
//...

Example 2

//...
protected override void Initialize()
{
//Place your Initialization logic here
}
//...

Example 3

private IndicatorDataSeries input;
protected override void Initialize()
{
    input = CreateDataSeries();
}
public override void Calculate(int index)
{
    input[index] = (MarketSeries.Close[index] + MarketSeries.Open[index]) / 2;
}

Example 4

//...
public override void Calculate(int index)
{
    if (IsRealTime)
    {
        //Place the code-logic that you want to be calculated on incoming live data
    }
}
//...