NinjaScript > Language Reference > Strategy >

OnPositionUpdate()

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
The OnPositionUpdate() method is called everytime a position managed by a strategy changes state.

 

Programming to this method is considered advanced programming and exposed for experienced programmers

 

Method Return Value

This method does not return a value.

 

Method Parameters

IPosition position

 

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

 

protected override void OnPositionUpdate(IPosition position)
{
 
}

 

 

Examples

protected override void OnPositionUpdate(IPosition position)
{
    if (position.MarketPosition == MarketPosition.Flat)
    {
         // Do something like reset some variables here
    }
}

 
Additional Reference Samples
Additional reference code samples are available the NinjaScript Educational Resources section of our support forum.