OnPositionUpdate()
Previous Topic  Next Topic 

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



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.