AveragePrice

View as Markdown

Definition

Gets the average price of an account position.

Property Value

A double value representing the account position’s average price per unit.

Syntax

PositionAccount.AveragePrice

Examples

1protected override void OnBarUpdate()
2// Raise stop loss to breakeven when there is at least 10 ticks in profit
3if (Close[0] >= PositionAccount.AveragePrice + 10 * TickSize)
4 ExitLongStopMarket(PositionAccount.Quantity, PositionAccount.AveragePrice);