Strategy functions are mostly used for accessing the simulated brokerage account figures of a strategy. Each strategy in a Desktop has its own separate simulated brokerage account which it uses for its own trading activities. The simulated accounts are required for both backtesting and live trading as they allow each strategy to better control its positions and funds, regardless of other trading activities taking place with the same live brokerage account.


Sections


Functions

Function Details


Functions


Name

Description

double StrategyBuyingPower()

Gets the strategy buying power (Cash + Short Market Value), denominated in the strategy's currency.

double StrategyBuyingPower(int)

Gets the buying power of a specified strategy (Cash + Short Market Value), denominated in the strategy's currency.

double StrategyCash()

Gets the amount of cash in the strategy, denominated in the strategy's currency.

double StrategyCash(int)

Gets the amount of cash in a specified strategy, denominated in the strategy's currency.

int StrategyCount()

Gets the number of strategies in the Desktop.

string StrategyCurrencyCode()

Gets the strategy 3-letter currency code. (USD, EUR, GBP, JPY, etc.)

string StrategyCurrencyCode(int)

Gets the 3-letter currency code of a specified strategy. (USD, EUR, GBP, JPY, etc.)

double StrategyEquity()

Gets the strategy equity (Cash + Market Value), denominated in the strategy's currency.

double StrategyEquity(int)

Gets the equity of a specified strategy (Cash + Market Value), denominated in the strategy's currency.

double StrategyExcessEquity()

Gets the strategy excess equity (Equity - Loan), denominated in the strategy's currency.

double StrategyExcessEquity(int)

Gets the excess equity of a specified strategy (Equity - Loan), denominated in the strategy's currency.

double StrategyGetExchangeRate(string, string)

Gets the exchange rate between two specified currencies. The rate is taken from an historical currency conversion table that is updated daily.

bool StrategyIsActive()

Determines whether the strategy is active or suspended. (See the strategy settings)

bool StrategyIsActive(int)

Determines whether a specified strategy is active or suspended. (See the strategy settings)

double StrategyLoan()

Gets the loan amount owed by the strategy, denominated in the strategy's currency. A strategy automatically takes a loan when it lacks the funds to pay for an order.

double StrategyLoan(int)

Gets the loan amount owed by a specified strategy, denominated in the strategy's currency. A strategy automatically takes a loan when it lacks the funds to pay for an order.

double StrategyMarketValue()

Gets the total market value of all open positions in the strategy, denominated in the strategy's currency.

double StrategyMarketValue(int)

Gets the total market value of all open positions in a specified strategy, denominated in the strategy's currency.

C_StrategyMode StrategyMode()

Gets the runtime strategy mode, i.e. backtesting, optimization, live, etc.

C_StrategyMode StrategyMode(int)

Gets the runtime strategy mode of a specified strategy, i.e. backtesting, optimization, live, etc.

string StrategyName()

Gets the strategy name.

string StrategyName(int)

Gets the name of a specified strategy.

int StrategyNumber()

Gets the strategy number in the Desktop.

StrategyTransferCash(int, int, double, string)

Transfers cash between two specified strategies by creating a transfer transaction that withdrawals cash from a source strategy and deposits it in a destination strategy. The withdrawal is processed at the Desktop's EOD time (23:59:59 UTC). If the strategies are denominated in different currencies, an historical exchange rates table is used.


Function Details


double StrategyBuyingPower()

Gets the strategy buying power (Cash + Short Market Value), denominated in the strategy's currency.


Returns


The strategy buying power.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double StrategyBuyingPower(int strategyNumber)

Gets the buying power of a specified strategy (Cash + Short Market Value), denominated in the strategy's currency.


Returns


The buying power of the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


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


double StrategyCash()

Gets the amount of cash in the strategy, denominated in the strategy's currency.


Returns


The amount of cash in the strategy.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double StrategyCash(int strategyNumber)

Gets the amount of cash in a specified strategy, denominated in the strategy's currency.


Returns


The amount of cash in the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


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


int StrategyCount()

Gets the number of strategies in the Desktop.


Returns


The number of strategies in the Desktop.


Scripts


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


string StrategyCurrencyCode()

Gets the strategy 3-letter currency code. (USD, EUR, GBP, JPY, etc.)


Returns


The strategy 3-letter currency code.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


string StrategyCurrencyCode(int strategyNumber)

Gets the 3-letter currency code of a specified strategy. (USD, EUR, GBP, JPY, etc.)


Returns


The 3-letter currency code of the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number





Scripts


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


double StrategyEquity()

Gets the strategy equity (Cash + Market Value), denominated in the strategy's currency.


Returns


The strategy equity.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double StrategyEquity(int strategyNumber)

Gets the equity of a specified strategy (Cash + Market Value), denominated in the strategy's currency.


Returns


The equity of the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


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


double StrategyExcessEquity()

Gets the strategy excess equity (Equity - Loan), denominated in the strategy's currency.


Returns


The strategy excess equity.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double StrategyExcessEquity(int strategyNumber)

Gets the excess equity of a specified strategy (Equity - Loan), denominated in the strategy's currency.


Returns


The excess equity of the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


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


double StrategyGetExchangeRate(string fromCurrencyCode, string toCurrencyCode)

Gets the exchange rate between two specified currencies. The rate is taken from an historical currency conversion table that is updated daily.


Returns


The exchange rate between two specified currencies.


Parameters


Type

Identifier

Description

string

fromCurrencyCode

The currency code to convert from (e.g. USD, EUR, GBP...)

string

toCurrencyCode

The currency code to convert to (e.g. USD, EUR, GBP...)


Scripts


AddOn, Commission, TradeManagementStrategy, DynamicAllocation, MultiSymbolTradingStrategy, Screener, PerformanceMetric, PositionSizing, RiskManagement, Slippage, TaxSystem, TradingStrategy


bool StrategyIsActive()

Determines whether the strategy is active or suspended. (See the strategy settings)


Returns


True if the strategy is active, false otherwise.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


bool StrategyIsActive(int strategyNumber)

Determines whether a specified strategy is active or suspended. (See the strategy settings)


Returns


True if the specified strategy is active, false otherwise.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


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


double StrategyLoan()

Gets the loan amount owed by the strategy, denominated in the strategy's currency. A strategy automatically takes a loan when it lacks the funds to pay for an order.


Returns


The strategy loan amount.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double StrategyLoan(int strategyNumber)

Gets the loan amount owed by a specified strategy, denominated in the strategy's currency. A strategy automatically takes a loan when it lacks the funds to pay for an order.


Returns


The loan amount of the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


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


double StrategyMarketValue()

Gets the total market value of all open positions in the strategy, denominated in the strategy's currency.


Returns


The total value of all open positions in the strategy.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


double StrategyMarketValue(int strategyNumber)

Gets the total market value of all open positions in a specified strategy, denominated in the strategy's currency.


Returns


The total value of all open positions in the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


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


C_StrategyMode StrategyMode()

Gets the runtime strategy mode, i.e. backtesting, optimization, live, etc.


Returns


The strategy mode.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


C_StrategyMode StrategyMode(int strategyNumber)

Gets the runtime strategy mode of a specified strategy, i.e. backtesting, optimization, live, etc.


Returns


The strategy mode of the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


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


string StrategyName()

Gets the strategy name.


Returns


The strategy name.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


string StrategyName(int strategyNumber)

Gets the name of a specified strategy.


Returns


The name of the specified strategy.


Parameters


Type

Identifier

Description

int

strategyNumber

The strategy number


Scripts


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


int StrategyNumber()

Gets the strategy number in the Desktop.


Returns


The strategy number in the Desktop.


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


StrategyTransferCash(int srcStrategyNumber, int desStrategyNumber, double amount, string comment)

Transfers cash between two specified strategies by creating a transfer transaction that withdrawals cash from a source strategy and deposits it in a destination strategy. The withdrawal is processed at the Desktop's EOD time (23:59:59 UTC). If the strategies are denominated in different currencies, an historical exchange rates table is used.


Parameters


Type

Identifier

Description

int

srcStrategyNumber

The source strategy number

int

desStrategyNumber

The destination strategy number

double

amount

The amount to transfer

string

comment

The comment describing the transfer


Scripts


AddOn, DynamicAllocation