PositionAccount

View as Markdown

Definition

Represents position related information that pertains to real-world account (live or simulation).

Tips:

  • For multi-instrument scripts, please see PositionsAccount object which holds an array of all instrument positions managed by the strategy’s account.
  • For a Strategy Position, please see Position.

Methods and Properties

PropertyDescription
AccountAn Account object which corresponds to the position
AveragePriceGets the average entry price of the account position
GetUnrealizedProfitLoss()Gets the unrealized PnL for the account
InstrumentAn Instrument value representing the instrument of an order
MarketPositionGets the current market position of the account
• Possible values:
MarketPosition.Flat
MarketPosition.Long
MarketPosition.Short
QuantityGets the current account position size
ToString()A string representation of an account position

Examples

1protected override void OnBarUpdate()
2{
3 // Print out the average entry price
4 Print("The average entry price is " + PositionAccount.AveragePrice);
5}