NinjaScript > Language Reference > Strategy >

IPosition

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Represents a read only interface that exposes information regarding a position and is passed as a parameter in the OnPositionUpdate() method.

 

Methods and Properties

AvgPrice

A double value representing the average price of a position

Instrument

An Instrument value representing the instrument of an order

MarketPosition

Possible values are:

 

MarketPosition.Flat

MarketPosition.Long

MarketPosition.Short

Quantity

An int value representing quantity of an execution

ToString()

A string representation of an execution

 

 

Examples

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