Stats
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
Name 
Description 
Gets the average number of bars for the current statistics request (see the StatsRequest function). 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Gets the percent of positions matching the specified statistics request. 

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

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

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

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. 
Gets the riskadjusted return for the current statistics request (see the StatsRequest function). 

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

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

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

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

Gets the win/loss ratio for the current statistics request (see the StatsRequest function). 
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
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
Scripts AddOn, Commission, DynamicAllocation, PerformanceMetric, RiskManagement, Slippage, TaxSystem 
double StatsRiskAdjustedReturn() 
Gets the riskadjusted return for the current statistics request (see the StatsRequest function). Returns The risk adjustedreturn 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 