Position functions are mostly used for accessing the strategy positions in the positions table. Each strategy in the Desktop has its own separate positions table which it uses to hold all of its positions. The indexes of those positions in the table are used to identify the positions when using the Position functions (see the PositionByStatus functions to access those position indexes).


Sections


Functions

Function Details


Functions


Name

Description

int PositionBars(int)

Gets the number of bars a specified position has been held open.

int PositionBars(int, int)

Gets the number of bars a specified position has been held open.

int[] PositionByStatus(C_PositionStatus)

Gets the indexes of the positions in a specified status that belong to the underlying symbol(s).

int[] PositionByStatus(int, C_PositionStatus, int?)

Gets the indexes of the positions in a specified status that belong to a specified strategy.

int[] PositionByStatusAll(C_PositionStatus)

Gets the indexes of the positions in a specified status that belong to any of the strategy symbols.

int PositionCount()

Gets the number of positions of the underlying symbol(s).

int PositionCount(int)

Gets the number of positions of a specified strategy.

int PositionCountAll()

Gets the total number of positions for all of the symbols.

int PositionCountByStatus(C_PositionStatus)

Gets the number of positions of the underlying symbol(s) in a specified status.

int PositionCountByStatus(int, C_PositionStatus, int?)

Gets the number of positions of a specified strategy in a specified status.

int PositionCountByStatusAll(C_PositionStatus)

Gets the total number of positions, for all of the symbols, in a specified status.

string PositionCurrencyCode(int)

Gets the currency code of a specified position. (USD, EUR, GPB, etc.)

string PositionCurrencyCode(int, int)

Gets the currency code of a specified position. (USD, EUR, GPB, etc.)

long PositionCurrentBarDateTime(int)

Gets the starting date/time of the current bar in a specified open position.

long PositionCurrentBarDateTime(int, int)

Gets the starting date/time of the current bar in a specified open position.

double PositionCurrentPrice(int)

Gets the current price of a specified position.

double PositionCurrentPrice(int, int)

Gets the current price of a specified position.

double PositionCurrentQuantity(int)

Gets the quantity of shares, contracts or units of a specified position.

double PositionCurrentQuantity(int, int)

Gets the quantity of shares, contracts or units of a specified position.

double PositionCurrentValue(int)

Gets the current value (quantity * current price) of a specified position. 

double PositionCurrentValue(int, int)

Gets the current value (quantity * current price) of a specified position.

double PositionDays(int)

Gets the number of days a specified position has been held open.

double PositionDays(int, int)

Gets the number of days a specified position has been held open.

C_Direction PositionDirection(int)

Gets the direction of a specified position.

C_Direction PositionDirection(int, int)

Gets the direction of a specified position.

long PositionEntryDateTime(int)

Gets the date/time in which a specified position was entered.

long PositionEntryDateTime(int, int)

Gets the date/time in which a specified position was entered.

double PositionEntryPrice(int)

Gets the average entry price of a specified position, which is the weighted average execution price of all of its entry orders.

double PositionEntryPrice(int, int)

Gets the average entry price of a specified position, which is the weighted average execution price of all of its entry orders.

bool PositionExists(C_PositionStatus)

Determines whether a position with a specified status exists for the underlying symbol.

bool PositionExists(int, C_PositionStatus, int?)

Determines whether a position with a specified status and symbol index exists.

bool PositionExistsInDirection(C_PositionStatus, C_Direction)

Determines whether a position with a specified status and direction exists for the underlying symbol.

bool PositionExistsInDirection(int, C_PositionStatus, C_Direction, int?)

Determines whether a position with a specified status, symbol index and direction exists.

long PositionExitDateTime(int)

Gets the execution date/time of the latest exit order of a specified position.

long PositionExitDateTime(int, int)

Gets the execution date/time of the latest exit order of a specified position.

double PositionExitPrice(int)

Gets the average exit price of a specified position, which is the weighted average execution price of all of its exit orders.

double PositionExitPrice(int, int)

Gets the average exit price of a specified position, which is the weighted average execution price of all of its exit orders.

double PositionHighestPrice(int)

Gets the highest price of a specified position's symbol during the time the position has been held open.

double PositionHighestPrice(int, int)

Gets the highest price of a specified position's symbol during the time the position has been held open.

C_Instrument PositionInstrumentType(int)

Gets the instrument type of a specified position.

C_Instrument PositionInstrumentType(int, int)

Gets the instrument type of a specified position.

bool PositionIsClosed(int)

Determines whether a specified position is closed.

bool PositionIsClosed(int, int)

Determines whether a specified position is closed.

double PositionLowestPrice(int)

Gets the lowest price of a specified position's symbol during the time the position has been held open.

double PositionLowestPrice(int, int)

Gets the lowest price of a specified position's symbol during the time the position has been held open.

double PositionMAE(int)

Gets the MAE of a specified position.

double PositionMAE(int, int)

Gets the MAE of a specified position.

double PositionMAEPrice(int)

Gets the MAE in price of a specified position.

double PositionMAEPrice(int, int)

Gets the MAE in price of a specified position.

double PositionMargin(int)

Gets the initial margin used by a specified futures/forex position.

double PositionMargin(int, int)

Gets the initial margin used by a specified futures/forex position.

double PositionMFE(int)

Gets the MFE of a specified position.

double PositionMFE(int, int)

Gets the MFE of a specified position.

double PositionMFEPrice(int)

Gets the MFE in price of a specified position.

double PositionMFEPrice(int, int)

Gets the MFE in price of a specified position.

int[] PositionOrders(int)

Gets the indexes of a specified position's orders.

int[] PositionOrders(int, int)

Gets the indexes of a specified position's orders.

double PositionPointChange(int)

Gets the point change of a specified futures position, from its opening price to its closing price or to its current price if it's still open.

double PositionPointChange(int, int)

Gets the point change of a specified futures position, from its opening price to its closing price or to its current price if it's still open.

double PositionPriceChange(int)

Gets the price change of a specified position, from its opening price to its closing price or to its current price if it's still open.

double PositionPriceChange(int, int)

Gets the price change of a specified position, from its opening price to its closing price or to its current price if it's still open.

double PositionPricePercentChange(int)

Gets the % change in a specified position price, from its opening price to its closing price or to its current price if it's still open.

double PositionPricePercentChange(int, int)

Gets the % change in a specified position price, from its opening price to its closing price or to its current price if it's still open.

double PositionProfitLoss(int)

Gets the PnL of a specified position. (Including both realized and unrealized PnL.)

double PositionProfitLoss(int, int)

Gets the PnL of a specified position. (Including both realized and unrealized PnL.)

double PositionProfitLossPercent(int)

Gets the PnL % of a specified position. (Including both realized and unrealized PnL.)

double PositionProfitLossPercent(int, int)

Gets the PnL % of a specified position. (Including both realized and unrealized PnL.)

double PositionRealizedProfitLoss(int)

Gets the realized PnL of a specified closed or partially closed position. (The actual PnL based on the exit price of each closed trade in the position.)

double PositionRealizedProfitLoss(int, int)

Gets the realized PnL of a specified closed or partially closed position. (The actual PnL based on the exit price of each closed trade in the position.)

double PositionSettledCash(int)

Gets the settled cash of a specified futures position. Futures settlements are processed at the Desktop EOD time using the last available price of the symbol.

double PositionSettledCash(int, int)

Gets the settled cash of a specified futures position. Futures settlements are processed at the Desktop EOD time using the last available price of the symbol.

long PositionSimAccountId(int)

Gets the sim-account Id of a specified position.

int PositionSymbolIndex(int)

Gets the symbol index of the underlying symbol of a specified position (the symbol index in the strategy's symbols table).

int PositionSymbolIndex(int, int)

Gets the symbol index of the underlying symbol of a specified position (the symbol index in the strategy's symbols table).

double PositionTickChange(int)

Gets the tick/pip change of a specified position, from its opening price to its closing price or to its current price if it's still open.

double PositionTickChange(int, int)

Gets the tick/pip change of a specified position, from its opening price to its closing price or to its current price if it's still open.

double PositionTotalEntryQuantity(int)

Gets the total quantity of all executed entry orders of a specified position.

double PositionTotalEntryQuantity(int, int)

Gets the total quantity of all executed entry orders of a specified position.

double PositionTotalEntryValue(int)

Gets the total entry value of a specified position, which is the sum of its executed entry orders values (price * quantity).

double PositionTotalEntryValue(int, int)

Gets the total entry value of a specified position, which is the sum of its executed entry orders values (price * quantity).

double PositionTotalExitQuantity(int)

Gets the total quantity of all executed exit orders of a specified position.

double PositionTotalExitQuantity(int, int)

Gets the total quantity of all executed exit orders of a specified position.

double PositionTotalExitValue(int)

Gets the total exit value of a specified position, which is the sum of its executed exit orders values (price * quantity). 

double PositionTotalExitValue(int, int)

Gets the total exit value of a specified position, which is the sum of its executed exit orders values (price * quantity). 

double PositionUnrealizedProfitLoss(int)

Gets the unrealized PnL of a specified open position. (The theoretical PnL based on the current market price of the still open position.)

double PositionUnrealizedProfitLoss(int, int)

Gets the unrealized PnL of a specified open position. (The theoretical PnL based on the current market price of the still open position.)


Function Details


int PositionBars(int positionIndex)

Gets the number of bars a specified position has been held open.


Returns


The number of bars the specified position has been held open (including the bar the entry order executed on).


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


int PositionBars(int strategyNumber, int positionIndex)

Gets the number of bars a specified position has been held open.


Returns


The number of bars the specified position has been held open (including the bar the entry order executed on).


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


int[] PositionByStatus(C_PositionStatus positionStatus)

Gets the indexes of the positions in a specified status that belong to the underlying symbol(s).


Returns


The indexes of the positions in the specified status that belong to the underlying symbol(s).


Parameters


Type

Identifier

Description

C_PositionStatus

positionStatus

The position status (View Options)


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


int[] PositionByStatus(int strategyNumber, C_PositionStatus positionStatus, int? symbolIndex)

Gets the indexes of the positions in a specified status that belong to a specified strategy.


Returns


The indexes of the positions in the specified status that belong to the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

C_PositionStatus

positionStatus

The position status (View Options)

int?

symbolIndex

The symbol index in the symbols table (Optional - null for all symbols)


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


int[] PositionByStatusAll(C_PositionStatus positionStatus)

Gets the indexes of the positions in a specified status that belong to any of the strategy symbols.


Returns


The indexes of the positions in a specified status that belong to any of the strategy symbols.


Parameters


Type

Identifier

Description

C_PositionStatus

positionStatus

The position status (View Options)


Scripts


MultiSymbolTradingStrategy


int PositionCount()

Gets the number of positions of the underlying symbol(s).


Returns


The number of positions of the underlying symbol(s).


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


int PositionCount(int strategyNumber)

Gets the number of positions of a specified strategy.


Returns


The number of positions of the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


int PositionCountAll()

Gets the total number of positions for all of the symbols.


Returns


The total number of positions for all of the symbols.


Scripts


MultiSymbolTradingStrategy


int PositionCountByStatus(C_PositionStatus positionStatus)

Gets the number of positions of the underlying symbol(s) in a specified status.


Returns


The number of positions of the underlying symbol(s) in the specified status.


Parameters


Type

Identifier

Description

C_PositionStatus

positionStatus

The position status (View Options)


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


int PositionCountByStatus(int strategyNumber, C_PositionStatus positionStatus, int? symbolIndex)

Gets the number of positions of a specified strategy in a specified status.


Returns


The number of positions of the specified strategy in the specified status.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

C_PositionStatus

positionStatus

The position status (View Options)

int?

symbolIndex

The symbol index in the symbols table (Optional - null for all symbols).


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


int PositionCountByStatusAll(C_PositionStatus positionStatus)

Gets the total number of positions, for all of the symbols, in a specified status.


Returns


The total number of positions, for all of the symbols, in a specified status.


Parameters


Type

Identifier

Description

C_PositionStatus

positionStatus

The position status (View Options)


Scripts


MultiSymbolTradingStrategy


string PositionCurrencyCode(int positionIndex)

Gets the currency code of a specified position. (USD, EUR, GPB, etc.)


Returns


The currency code of the specified position. (USD, EUR, GPB, etc.)


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


string PositionCurrencyCode(int strategyNumber, int positionIndex)

Gets the currency code of a specified position. (USD, EUR, GPB, etc.)


Returns


The currency code of the specified position. (USD, EUR, GPB, etc.)


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


long PositionCurrentBarDateTime(int positionIndex)

Gets the starting date/time of the current bar in a specified open position.


Returns


The starting date/time of the current bar in the specified open position. If the position is closed the date/time will equal that from DateTimeMax().


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


long PositionCurrentBarDateTime(int strategyNumber, int positionIndex)

Gets the starting date/time of the current bar in a specified open position.


Returns


The starting date/time of the current bar in the specified open position. If the position is closed the date/time will equal that from DateTimeMax().


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionCurrentPrice(int positionIndex)

Gets the current price of a specified position.


Returns


The current price of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionCurrentPrice(int strategyNumber, int positionIndex)

Gets the current price of a specified position.


Returns


The current price of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionCurrentQuantity(int positionIndex)

Gets the quantity of shares, contracts or units of a specified position.


Returns


The quantity of shares, contracts or units of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionCurrentQuantity(int strategyNumber, int positionIndex)

Gets the quantity of shares, contracts or units of a specified position.


Returns


The quantity of shares, contracts or units of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionCurrentValue(int positionIndex)

Gets the current value (quantity * current price) of a specified position.


Returns


The current value of the specified position. 


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionCurrentValue(int strategyNumber, int positionIndex)

Gets the current value (quantity * current price) of a specified position.


Returns


The current value of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionDays(int positionIndex)

Gets the number of days a specified position has been held open.


Returns


The number of days the specified position has been held open.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionDays(int strategyNumber, int positionIndex)

Gets the number of days a specified position has been held open.


Returns


The number of days the specified position has been held open.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


C_Direction PositionDirection(int positionIndex)

Gets the direction of a specified position.


Returns


The direction of the specified position. (View Options)


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


C_Direction PositionDirection(int strategyNumber, int positionIndex)

Gets the direction of a specified position.


Returns


The direction of the specified position. (View Options)


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


long PositionEntryDateTime(int positionIndex)

Gets the date/time in which a specified position was entered.


Returns


The date/time in which the specified position was entered. 


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


long PositionEntryDateTime(int strategyNumber, int positionIndex)

Gets the date/time in which a specified position was entered.


Returns


The date/time in which the specified position was entered.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionEntryPrice(int positionIndex)

Gets the average entry price of a specified position, which is the weighted average execution price of all of its entry orders.


Returns


The average entry price of a specified position, which is the weighted average execution price of all of its entry orders.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionEntryPrice(int strategyNumber, int positionIndex)

Gets the average entry price of a specified position, which is the weighted average execution price of all of its entry orders.


Returns


The average entry price of a specified position, which is the weighted average execution price of all of its entry orders.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


bool PositionExists(C_PositionStatus positionStatus)

Determines whether a position with a specified status exists for the underlying symbol.


Returns


True if the specified position exists, false otherwise.


Parameters


Type

Identifier

Description

C_PositionStatus

positionStatus

The position status (View Options)


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


bool PositionExists(int strategyNumber, C_PositionStatus positionStatus, int? symbolIndex)

Determines whether a position with a specified status and symbol index exists.


Returns


True if the specified position exists, false otherwise.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

C_PositionStatus

positionStatus

The position status (View Options)

int?

symbolIndex

The symbol index in the symbols table (Optional - null for all symbols)


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


bool PositionExistsInDirection(C_PositionStatus positionStatus, C_Direction direction)

Determines whether a position with a specified status and direction exists for the underlying symbol.


Returns


True if the specified position exists, false otherwise.


Parameters


Type

Identifier

Description

C_PositionStatus

positionStatus

The position status (View Options)

C_Direction

direction

The position direction (View Options)


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


bool PositionExistsInDirection(int strategyNumber, C_PositionStatus positionStatus, C_Direction direction, int? symbolIndex)

Determines whether a position with a specified status, symbol index and direction exists.


Returns


True if the specified position exists, false otherwise.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

C_PositionStatus

positionStatus

The position status (View Options)

C_Direction

direction

The position direction (View Options)

int?

symbolIndex

The symbol index in the symbols table (Optional - null for all symbols)


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


long PositionExitDateTime(int positionIndex)

Gets the execution date/time of the latest exit order of a specified position.


Returns


The execution date/time of the latest exit order of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


long PositionExitDateTime(int strategyNumber, int positionIndex)

Gets the execution date/time of the latest exit order of a specified position.


Returns


The execution date/time of the latest exit order of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionExitPrice(int positionIndex)

Gets the average exit price of a specified position, which is the weighted average execution price of all of its exit orders.


Returns


The average exit price of a specified position, which is the weighted average execution price of all of its exit orders.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionExitPrice(int strategyNumber, int positionIndex)

Gets the average exit price of a specified position, which is the weighted average execution price of all of its exit orders.


Returns


The average exit price of a specified position, which is the weighted average execution price of all of its exit orders.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionHighestPrice(int positionIndex)

Gets the highest price of a specified position's symbol during the time the position has been held open.


Returns


The highest price of a specified position's symbol during the time the position has been held open.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionHighestPrice(int strategyNumber, int positionIndex)

Gets the highest price of a specified position's symbol during the time the position has been held open.


Returns


The highest price of a specified position's symbol during the time the position has been held open.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the position table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


C_Instrument PositionInstrumentType(int positionIndex)

Gets the instrument type of a specified position.


Returns


The instrument type of the specified position. (View Options)


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


C_Instrument PositionInstrumentType(int strategyNumber, int positionIndex)

Gets the instrument type of a specified position.


Returns


The instrument type of the specified position. (View Options)


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


bool PositionIsClosed(int positionIndex)

Determines whether a specified position is closed.


Returns


True if the specified position is closed, false otherwise.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


bool PositionIsClosed(int strategyNumber, int positionIndex)

Determines whether a specified position is closed.


Returns


True if the specified position is closed, false otherwise.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionLowestPrice(int positionIndex)

Gets the lowest price of a specified position's symbol during the time the position has been held open.


Returns


The lowest price of the specified position's symbol during the time the position has been held open.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionLowestPrice(int strategyNumber, int positionIndex)

Gets the lowest price of a specified position's symbol during the time the position has been held open.


Returns


The lowest price of the specified position's symbol during the time the position has been held open.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the position table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionMAE(int positionIndex)

Gets the MAE of a specified position.


Returns


The MAE of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionMAE(int strategyNumber, int positionIndex)

Gets the MAE of a specified position.


Returns


The MAE of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionMAEPrice(int positionIndex)

Gets the MAE in price of a specified position.


Returns


The MAE in price of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionMAEPrice(int strategyNumber, int positionIndex)

Gets the MAE in price of a specified position.


Returns


The MAE in price of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionMargin(int positionIndex)

Gets the initial margin used by a specified futures/forex position.


Returns


The initial margin used by the specified futures/forex position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionMargin(int strategyNumber, int positionIndex)

Gets the initial margin used by a specified futures/forex position.


Returns


The initial margin used by the specified futures/forex position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionMFE(int positionIndex)

Gets the MFE of a specified position.


Returns


The MFE of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionMFE(int strategyNumber, int positionIndex)

Gets the MFE of a specified position.


Returns


The MFE of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionMFEPrice(int positionIndex)

Gets the MFE in price of a specified position.


Returns


The MFE in price of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionMFEPrice(int strategyNumber, int positionIndex)

Gets the MFE in price of a specified position.


Returns


The MFE in price of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


int[] PositionOrders(int positionIndex)

Gets the indexes of a specified position's orders.


Returns


The indexes of the specified position's orders.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


int[] PositionOrders(int strategyNumber, int positionIndex)

Gets the indexes of a specified position's orders.


Returns


The indexes of the specified position's orders.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionPointChange(int positionIndex)

Gets the point change of a specified futures position, from its opening price to its closing price or to its current price if it's still open.


Returns


The point change of the specified futures position, from its opening price to its closing price or to its current price if it's still open.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionPointChange(int strategyNumber, int positionIndex)

Gets the point change of a specified futures position, from its opening price to its closing price or to its current price if it's still open.


Returns


The point change of the specified futures position, from its opening price to its closing price or to its current price if it's still open.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionPriceChange(int positionIndex)

Gets the price change of a specified position, from its opening price to its closing price or to its current price if it's still open.


Returns


The price change of the specified position, from its opening price to its closing price or to its current price if it's still open.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionPriceChange(int strategyNumber, int positionIndex)

Gets the price change of a specified position, from its opening price to its closing price or to its current price if it's still open.


Returns


The price change of the specified position, from its opening price to its closing price or to its current price if it's still open.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionPricePercentChange(int positionIndex)

Gets the % change in a specified position price, from its opening price to its closing price or to its current price if it's still open.


Returns


The % change in the specified position price, from its opening price to its closing price or to its current price if it's still open.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionPricePercentChange(int strategyNumber, int positionIndex)

Gets the % change in a specified position price, from its opening price to its closing price or to its current price if it's still open.


Returns


The % change in the specified position price, from its opening price to its closing price or to its current price if it's still open.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionProfitLoss(int positionIndex)

Gets the PnL of a specified position. (Including both realized and unrealized PnL.)


Returns


The PnL of the specified position. (Including both realized and unrealized PnL.)


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionProfitLoss(int strategyNumber, int positionIndex)

Gets the PnL of a specified position. (Including both realized and unrealized PnL.)


Returns


The PnL of the specified position. (Including both realized and unrealized PnL.)


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionProfitLossPercent(int positionIndex)

Gets the PnL % of a specified position. (Including both realized and unrealized PnL.)


Returns


The PnL % of the specified position. (Including both realized and unrealized PnL.)


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionProfitLossPercent(int strategyNumber, int positionIndex)

Gets the PnL % of a specified position. (Including both realized and unrealized PnL.)


Returns


The PnL % of the specified position. (Including both realized and unrealized PnL.)


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionRealizedProfitLoss(int positionIndex)

Gets the realized PnL of a specified closed or partially closed position. (The actual PnL based on the exit price of each closed trade in the position.)


Returns


The realized PnL of the specified closed or partially closed position. (The actual PnL based on the exit price of each closed trade in the position.)


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionRealizedProfitLoss(int strategyNumber, int positionIndex)

Gets the realized PnL of a specified closed or partially closed position. (The actual PnL based on the exit price of each closed trade in the position.)


Returns


The realized PnL of the specified closed or partially closed position. (The actual PnL based on the exit price of each closed trade in the position.)


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionSettledCash(int positionIndex)

Gets the settled cash of a specified futures position. Futures settlements are processed at the Desktop EOD time using the last available price of the symbol.


Returns


The settled cash of the specified futures position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionSettledCash(int strategyNumber, int positionIndex)

Gets the settled cash of a specified futures position. Futures settlements are processed at the Desktop EOD time using the last available price of the symbol.


Returns


The settled cash of the specified futures position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


long PositionSimAccountId(int positionIndex)

Gets the sim-account Id of a specified position.

Returns


The sim-account Id of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


TradeManagementStrategy


int PositionSymbolIndex(int positionIndex)

Gets the symbol index of the underlying symbol of a specified position (the symbol index in the strategy's symbols table).


Returns


The symbol index of the underlying symbol of the specified position (the symbol index in the strategy's symbols table).


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


int PositionSymbolIndex(int strategyNumber, int positionIndex)

Gets the symbol index of the underlying symbol of a specified position (the symbol index in the strategy's symbols table).


Returns


The symbol index of the underlying symbol of the specified position (the symbol index in the strategy's symbols table).


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionTickChange(int positionIndex)

Gets the tick/pip change of a specified position, from its opening price to its closing price or to its current price if it's still open.


Returns


The tick/pip change of the specified position, from its opening price to its closing price or to its current price if it's still open.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionTickChange(int strategyNumber, int positionIndex)

Gets the tick/pip change of a specified position, from its opening price to its closing price or to its current price if it's still open.


Returns


The tick/pip change of the specified position, from its opening price to its closing price or to its current price if it's still open.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionTotalEntryQuantity(int positionIndex)

Gets the total quantity of all executed entry orders of a specified position.


Returns


The total quantity of all executed entry orders of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionTotalEntryQuantity(int strategyNumber, int positionIndex)

Gets the total quantity of all executed entry orders of a specified position.


Returns


The total quantity of all executed entry orders of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionTotalEntryValue(int positionIndex)

Gets the total entry value of a specified position, which is the sum of its executed entry orders values (price * quantity).


Returns


The total entry value of the specified position, which is the sum of its executed entry orders values (price * quantity).


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionTotalEntryValue(int strategyNumber, int positionIndex)

Gets the total entry value of a specified position, which is the sum of its executed entry orders values (price * quantity). 


Returns


The total entry value of the specified position, which is the sum of its executed entry orders values (price * quantity).


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionTotalExitQuantity(int positionIndex)

Gets the total quantity of all executed exit orders of a specified position.


Returns


The total quantity of all executed exit orders of the specified position.


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionTotalExitQuantity(int strategyNumber, int positionIndex)

Gets the total quantity of all executed exit orders of a specified position.


Returns


The total quantity of all executed exit orders of the specified position.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionTotalExitValue(int positionIndex)

Gets the total exit value of a specified position, which is the sum of its executed exit orders values (price * quantity). 


Returns


The total exit value of the specified position, which is the sum of its executed exit orders values (price * quantity).


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionTotalExitValue(int strategyNumber, int positionIndex)

Gets the total exit value of a specified position, which is the sum of its executed exit orders values (price * quantity).


Returns


The total exit value of the specified position, which is the sum of its executed exit orders values (price * quantity).


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem


double PositionUnrealizedProfitLoss(int positionIndex)

Gets the unrealized PnL of a specified open position. (The theoretical PnL based on the current market price of the still open position.)


Returns


The unrealized PnL of the specified open position. (The theoretical PnL based on the current market price of the still open position.)


Parameters


Type

Identifier

Description

int

positionIndex

The position index in the positions table


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double PositionUnrealizedProfitLoss(int strategyNumber, int positionIndex)

Gets the unrealized PnL of a specified open position. (The theoretical PnL based on the current market price of the still open position.)


Returns


The unrealized PnL of the specified open position. (The theoretical PnL based on the current market price of the still open position.)


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number

int

positionIndex

The position index in the positions table


Scripts


AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem