MarketPosition

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Strategy > Position >

MarketPosition

Previous page Return to chapter overview Next page

Definition

Gets the strategy's current market position

 

Property Value

MarketPosition.Flat

MarketPosition.Long

MarketPosition.Short

 

Syntax

Position.MarketPosition
 

 

Examples

ns

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