Stats functions are mostly used for calculating performance statistics similar to those available in the performance tab. Call the StatsRequest function to specify the positions on which the Stats functions are calculated on.


Sections


Functions

Function Details


Functions


Name

Description

double StatsAverageBars()

Gets the average number of bars for the current statistics request (see the StatsRequest function).

double StatsAverageCommission()

Gets the average commissions for the current statistics request (see the StatsRequest function).

double StatsAverageDays()

Gets the average number of days for the current statistics request (see the StatsRequest function).

double StatsAveragePricePercentChange()

Gets the average percent change in the price for the current statistics request (see the StatsRequest function).

double StatsAverageProfitLoss()

Gets the average PnL for the current statistics request (see the StatsRequest function).

double StatsAverageProfitLossPerBar()

Gets the average PnL per bar for the current statistics request (see the StatsRequest function).

double StatsAverageProfitLossPercent()

Gets the average PnL percent for the current statistics request (see the StatsRequest function).

double StatsAverageProfitLossPerDay()

Gets the average PnL per day for the current statistics request (see the StatsRequest function).

double StatsAverageValue()

Gets the average value for the current statistics request (see the StatsRequest function).

double StatsCAGR()

Gets the CAGR for the current statistics request (see the StatsRequest function).

double StatsCommissionTotal()

Gets the total commissions paid in the current statistics request (see the StatsRequest function).

double StatsCount()

Counts the number of positions in the current statistics request (see the StatsRequest function).

double StatsCumulativeProfit()

Gets the cumulative profit in the current statistics request (see the StatsRequest function).

double StatsEfficiencyEntry()

Gets the entry efficiency for the current statistics request (see the StatsRequest function).

double StatsEfficiencyExit()

Gets the exit efficiency for the current statistics request (see the StatsRequest function).

double StatsEfficiencyTotal()

Gets the total efficiency for the current statistics request (see the StatsRequest function).

double StatsEquityAtEnd()

Gets the amount of equity at the end date/time specified in the current statistics request (see the StatsRequest function).

double StatsEquityAtStart()

Gets the amount of equity at the start date/time specified in the current statistics request (see the StatsRequest function).

double StatsExpectancy()

Gets the expectancy for the current statistics request (see the StatsRequest function). Expectancy = (Probability of Win * Average Win) - (Probability of Loss * Average Loss)

double StatsExposure()

Gets the market exposure for the current statistics request (see the StatsRequest function).

double StatsLuckCoefficient()

Gets the luck coefficient for the current statistics request (see the StatsRequest function).

double StatsMaxConsecutiveLosing()

Gets the maximum number of consecutive losing positions for the current statistics request (see the StatsRequest function).

double StatsMaxConsecutiveWinning()

Gets the maximum number of consecutive winning positions for the current statistics request (see the StatsRequest function).

double StatsMaxDrawdown()

Gets the maximum drawdown for the current statistics request (see the StatsRequest function).

double StatsMaxDrawdownPercent()

Gets the maximum drawdown percent for the current statistics request (see the StatsRequest function).

double StatsNetProfit()

Gets the net profit for the current statistics request (see the StatsRequest function).

double StatsNetProfitPercent()

Gets the net profit % for the current statistics request (see the StatsRequest function).

double StatsPayoffRatio()

Gets the payoff ratio for the current statistics request (see the StatsRequest function).

double StatsPercent()

Gets the percent of positions matching the specified statistics request.

double StatsProfitFactor()

Gets the profit factor for the current statistics request (see the StatsRequest function).

double StatsProfitLoss()

Gets the PnL for the current statistics request (see the StatsRequest function).

double StatsRecoveryFactor()

Gets the recovery factor for the current statistics request (see the StatsRequest function).

StatsRequest(long, long, bool, bool, bool, bool)

Sets the current statistics request using the specified arguments. In order to define the data on which the stats functions are calculated, the statistics request should be called at least once, prior to any other stats function.

StatsRequest(int[], long, long, bool, bool, bool, bool, string)

Sets the current statistics request using the specified arguments. In order to define the data on which the stats functions are calculated, the statistics request should be called at least once, prior to any other stats function.

double StatsRiskAdjustedReturn()

Gets the risk-adjusted return for the current statistics request (see the StatsRequest function).

double StatsSharpeRatio()

Gets the sharpe ratio for the current statistics request (see the StatsRequest function).

double StatsSortinoRatio()

Gets the sortino ratio for the current statistics request (see the StatsRequest function).

double StatsSQN()

Gets the SQN for the current statistics request (see the StatsRequest function).

double StatsUlcerIndex()

Gets the ulcer index for the current statistics request (see the StatsRequest function).

double StatsWinLossRatio()

Gets the win/loss ratio for the current statistics request (see the StatsRequest function).


Function Details


double StatsAverageBars()

Gets the average number of bars for the current statistics request (see the StatsRequest function).


Returns


The average number of bars for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsAverageCommission()

Gets the average commissions for the current statistics request (see the StatsRequest function).


Returns


The average commissions for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsAverageDays()

Gets the average number of days for the current statistics request (see the StatsRequest function).


Returns


The average number of days for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsAveragePricePercentChange()

Gets the average percent change in the price for the current statistics request (see the StatsRequest function).


Returns


The average percent change in the price for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsAverageProfitLoss()

Gets the average PnL for the current statistics request (see the StatsRequest function).


Returns


The average PnL for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsAverageProfitLossPerBar()

Gets the average PnL per bar for the current statistics request (see the StatsRequest function).


Returns


The average PnL per bar for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsAverageProfitLossPercent()

Gets the average PnL percent for the current statistics request (see the StatsRequest function).


Returns


The average PnL percent for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsAverageProfitLossPerDay()

Gets the average PnL per day for the current statistics request (see the StatsRequest function).


Returns


The average PnL per day for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsAverageValue()

Gets the average value for the current statistics request (see the StatsRequest function).


Returns


The average value for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsCAGR()

Gets the CAGR for the current statistics request (see the StatsRequest function).


Returns


The CAGR for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsCommissionTotal()

Gets the total commissions paid in the current statistics request (see the StatsRequest function).


Returns


The total commissions paid in the current statistics request (see the StatsRequest function).


Scripts


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


double StatsCount()

Counts the number of positions in the current statistics request (see the StatsRequest function).


Returns


The number of positions in the current statistics request (see the StatsRequest function).


Scripts


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


double StatsCumulativeProfit()

Gets the cumulative profit in the current statistics request (see the StatsRequest function).


Returns


The cumulative profit in the current statistics request (see the StatsRequest function).


Scripts


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


double StatsEfficiencyEntry()

Gets the entry efficiency for the current statistics request (see the StatsRequest function).


Returns


The entry efficiency for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsEfficiencyExit()

Gets the exit efficiency for the current statistics request (see the StatsRequest function).


Returns


The exit efficiency for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsEfficiencyTotal()

Gets the total efficiency for the current statistics request (see the StatsRequest function).


Returns


The total efficiency for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsEquityAtEnd()

Gets the amount of equity at the end date/time specified in the current statistics request (see the StatsRequest function).


Returns


The amount of equity at the end date/time specified in the current statistics request (see the StatsRequest function).


Scripts


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


double StatsEquityAtStart()

Gets the amount of equity at the start date/time specified in the current statistics request (see the StatsRequest function).


Returns


The amount of equity at the start date/time specified in the current statistics request (see the StatsRequest function).


Scripts


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


double StatsExpectancy()

Gets the expectancy for the current statistics request (see the StatsRequest function). Expectancy = (Probability of Win * Average Win) - (Probability of Loss * Average Loss)


Returns


The expectancy for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsExposure()

Gets the market exposure for the current statistics request (see the StatsRequest function).


Returns


The market exposure for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsLuckCoefficient()

Gets the luck coefficient for the current statistics request (see the StatsRequest function).


Returns


The luck coefficient for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsMaxConsecutiveLosing()

Gets the maximum number of consecutive losing positions for the current statistics request (see the StatsRequest function).


Returns


The maximum number of consecutive losing positions for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsMaxConsecutiveWinning()

Gets the maximum number of consecutive winning positions for the current statistics request (see the StatsRequest function).


Returns


The maximum number of consecutive winning positions for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsMaxDrawdown()

Gets the maximum drawdown for the current statistics request (see the StatsRequest function).


Returns


The maximum drawdown for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsMaxDrawdownPercent()

Gets the maximum drawdown percent for the current statistics request (see the StatsRequest function).


Returns


The maximum drawdown percent for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsNetProfit()

Gets the net profit for the current statistics request (see the StatsRequest function).


Returns


The net profit for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsNetProfitPercent()

Gets the net profit % for the current statistics request (see the StatsRequest function).


Returns


The net profit % for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsPayoffRatio()

Gets the payoff ratio for the current statistics request (see the StatsRequest function).


Returns


The payoff ratio for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsPercent()

Gets the percent of positions matching the specified statistics request.


Returns


The percent of positions matching the specified statistics request.


Scripts


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


double StatsProfitFactor()

Gets the profit factor for the current statistics request (see the StatsRequest function).


Returns


The profit factor for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsProfitLoss()

Gets the PnL for the current statistics request (see the StatsRequest function).


Returns


The PnL for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsRecoveryFactor()

Gets the recovery factor for the current statistics request (see the StatsRequest function).


Returns


The recovery factor for the current statistics request (see the StatsRequest function).


Scripts


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


StatsRequest(long startDateTime, long endDateTime, bool winningPositions, bool losingPositions, bool longPositions, bool shortPositions)

Sets the current statistics request using the specified arguments. In order to define the data on which the stats functions are calculated, the statistics request should be called at least once, prior to any other stats function.


Parameters


Type

Identifier

Description

long

startDateTime

The start date/time of the request

long

endDateTime

The end date/time of the request

bool

winningPositions

Indicates whether to include winning positions

bool

losingPositions

Indicates whether to include losing positions

bool

longPositions

Indicates whether to include long positions

bool

shortPositions

Indicates whether to include short positions


Scripts


Alert, TradeManagementStrategy, MultiSymbolTradingStrategy, Screener, PositionSizing, TradingStrategy


StatsRequest(int[] strategyNumber, long startDateTime, long endDateTime, bool winningPositions, bool losingPositions, bool longPositions, bool shortPositions, string currencyCode)

Sets the current statistics request using the specified arguments. In order to define the data on which the stats functions are calculated, the statistics request should be called at least once, prior to any other stats function.


Parameters


Type

Identifier

Description

int[]

strategyNumber

The strategy numbers to process in the request

long

startDateTime

The start date/time of the request

long

endDateTime

The end date/time of the request

bool

winningPositions

Indicates whether to include winning positions

bool

losingPositions

Indicates whether to include losing positions

bool

longPositions

Indicates whether to include long positions

bool

shortPositions

Indicates whether to include short positions

string

currencyCode

The currency code to use for the calculation (optional - leave unassigned to use the Desktop base currency)


Scripts


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


double StatsRiskAdjustedReturn()

Gets the risk-adjusted return for the current statistics request (see the StatsRequest function).


Returns


The risk adjusted-return for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsSharpeRatio()

Gets the sharpe ratio for the current statistics request (see the StatsRequest function).


Returns


The sharpe ratio for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsSortinoRatio()

Gets the sortino ratio for the current statistics request (see the StatsRequest function).


Returns


The sortino ratio for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsSQN()

Gets the SQN for the current statistics request (see the StatsRequest function).


Returns


The SQN for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsUlcerIndex()

Gets the ulcer index for the current statistics request (see the StatsRequest function).


Returns


The ulcer index for the current statistics request (see the StatsRequest function).


Scripts


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


double StatsWinLossRatio()

Gets the win/loss ratio for the current statistics request (see the StatsRequest function).


Returns


The win/loss ratio for the current statistics request (see the StatsRequest function).


Scripts


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