Initialize()
Previous Topic  Next Topic 

Definition
The Initialize() method is called once when starting a strategy. This method can be used to configure indicator and strategy properties.

For example:




Method Return Value

This method does not return a value.


Syntax
See example below. The NinjaScript indicator and strategy wizards automatically generate the method syntax for you.


Method Of

Custom Indicator, Custom Strategy


Examples

protected override void Initialize()
{
    // Adds a 5-minute Bars object to the strategy and is automatically assigned
    // a Bars object index of 1 since the primary data the strategy is run against
    // set by the UI takes the index of 0.
    Add(Instrument, PeriodType.Minute, 5);                                      
}