GetAtmStrategyPositionAveragePrice()

<< Click to Display Table of Contents >>

Navigation:  NinjaScript > Language Reference > Strategy > ATM Strategy Methods >

GetAtmStrategyPositionAveragePrice()

Previous page Return to chapter overview Next page

Definition

Gets the current position's average price of the specified ATM Strategy.

 

Note:  Changes to positions will not be reflected till at least the next OnBarUpdate() event after an order fill.

 

Method Return Value

A double value representing the average price.

 

Syntax

GetAtmStrategyPositionAveragePrice(string atmStrategyId)

 

 

Parameters

atmStrategyId

The unique identifier for the ATM strategy

 

 

Examples

ns

protected override void OnBarUpdate()
{
    // Check if flat
    if (GetAtmStrategyMarketPosition("id") != MarketPosition.Flat)
        Print("Average price is " + GetAtmStrategyPositionAveragePrice("id").ToString());
}