NinjaScript > Language Reference > Data >

OnStartUp()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
You can override the OnStartUp() method to initialize any variables or resources you wish to use in the custom indicator or strategy. This method is called only once immediately prior to the start of your script processing its logic in OnBarUpdate(), but after the Initialize() method.

 

Note: It is possible to have the Plot() method called without OnStartUp() being called if your chart has no bars.

 
Method Return Value

This method does not return a value.

 

Syntax
You must override the method in your strategy or indicator with the following syntax.

 

protected override void OnStartUp()
{

 
}

 

 

Examples

protected override void OnStartUp()
{
    // Set any variables or logic you wish to do only once at start of your indicator/strategy
}