AveragePrice

View as Markdown

Definition

Gets the average price of a strategy position.

Property Value

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

Syntax

Position.AveragePrice

Examples

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