MarketPosition

NinjaScript > Language Reference > Strategy > Position >

MarketPosition

Print this Topic Previous pageReturn to chapter overviewNext page

Definition
Gets the current market position.

 

Property Value

MarketPosition.Flat

MarketPosition.Long

MarketPosition.Short

 

Syntax

Position.MarketPosition
 

Examples

protected override void OnBarUpdate()
{
    // If not flat print our open PnL
    if (Position.MarketPosition != MarketPosition.Flat)
         Print("Open PnL: " + Position.GetProfitLoss(Close[0], PerformanceUnit.Points));
}