NinjaScript > Language Reference > Strategy > ATM Strategy Methods >

GetAtmStrategyPositionAveragePrice()

Print this Topic Previous pageReturn to chapter overviewNext 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

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