Backtesting › Statistics

Statistics & Metrics

Complete reference for all 30+ metrics computed by the backtesting engine

How Statistics Are Computed

After each backtest run, the engine reads the strategy's inPosition array — a bar-by-bar record of whether the strategy was in a trade. State transitions (0→1 = entry, 1→0 = exit) identify individual trades.

For each trade, the engine reads the entryPrice, values (prices), position type (long/short), quantity, commission, and slippage. Profit is computed as:

// Long trade:
pnl = (exitPrice − entryPrice) × quantity − commission − slippage
// Short trade:
pnl = (entryPrice − exitPrice) × quantity − commission − slippage

All 30+ metrics are derived from this trade list. The Statistics panel on the right side of the Backtesting component displays results in 8 colour-coded sections.

Colour Coding

P&L-related fields in the Statistics panel are colour-coded for quick scanning:

Positive values (netPnL, grossProfit, etc.)
Negative values and grossLoss
Neutral metrics (trade counts, durations)

Capital

Initial Capital

initialCapital
format: $X.XX

The starting account balance used for all P&L calculations. Set in your strategy's risk management node.

Final Equity

finalEquity
format: $X.XX

Account balance at the end of the backtest period after all trades. finalEquity = initialCapital + netPnL.

Total Return

totalReturn
format: $X.XX

Raw dollar profit or loss over the entire backtest. Positive = profit, negative = loss.

Return %

totalReturnPct
format: X.XX%

Total return as a percentage of the initial capital. (totalReturn / initialCapital) × 100.

Trades

Total Trades

totalTrades

Total number of completed trades (entry + exit pairs). More trades generally means more statistically reliable results.

Wins

wins

Number of trades that closed with a profit (exitPrice > entryPrice for long, reversed for short).

Losses

losses

Number of trades that closed with a loss.

Win Rate

winRate
format: X.XX%

Percentage of trades that were winners. winRate = (wins / totalTrades) × 100. Note: a high win rate alone doesn't guarantee profitability.

Profit & Loss

Gross Profit

grossProfit
format: $X.XX

Sum of all winning trades' profits before subtracting losses. Always positive.

Gross Loss

grossLoss
format: $X.XX

Sum of all losing trades' losses. Always shown as a positive dollar amount representing the total loss. Displayed in red.

Net P&L

netPnL
format: $X.XX

grossProfit − grossLoss. The true bottom line after all trades. Commission and slippage are factored in.

Profit Factor

profitFactor
format: X.XX× (or ∞)

grossProfit ÷ grossLoss. A Profit Factor > 1 means profitable. Values: <1 = losing, 1–1.5 = marginal, 1.5–2 = good, 2+ = excellent. Displays ∞ when grossLoss = 0.

Averages

Avg Win

avgWin
format: $X.XX

Average profit per winning trade. grossProfit ÷ wins.

Avg Loss

avgLoss
format: $X.XX

Average loss per losing trade. grossLoss ÷ losses. Shows as negative.

Avg P&L

avgPnL
format: $X.XX

Average profit/loss across all trades. netPnL ÷ totalTrades. If positive, the strategy has positive expectancy on average.

Expectancy

expectancy
format: $X.XX

Expected profit per trade on average: (winRate × avgWin) + ((1 − winRate) × avgLoss). The most important single metric — tells you how much you expect to make per trade.

Extremes

Largest Win

largestWin
format: $X.XX

The single most profitable trade in dollar terms. Helps identify if results are dominated by one outlier trade.

Largest Loss

largestLoss
format: $X.XX

The single largest losing trade in dollar terms. Helps identify catastrophic loss events.

Best Trade %

bestTrade
format: X.XX%

The best trade expressed as a percentage return on the position.

Worst Trade %

worstTrade
format: X.XX%

The worst trade expressed as a percentage loss on the position.

Duration

Average (bars)

avgHoldingBars

Mean number of bars a position is held. Computed across all completed trades.

Maximum (bars)

maxHoldingBars

Longest trade duration measured in bars. A very long hold time may indicate a stuck position.

Minimum (bars)

minHoldingBars

Shortest trade duration. Very short trades (1 bar) may indicate signal noise.

Streaks

Max Consecutive Wins

maxConsecutiveWins

Longest winning streak — maximum number of consecutive winning trades. High values can indicate trend-following behaviour.

Max Consecutive Losses

maxConsecutiveLosses

Longest losing streak. Critical for assessing psychological and capital risk. If this is high, consider adding a stop-loss.

Drawdown

Max Drawdown ($)

maxDrawdown
format: $X.XX

The largest peak-to-trough drop in account equity in dollar terms. Measures the worst-case loss from any high point to the following low point.

Max Drawdown %

maxDrawdownPct
format: X.XX%

Max drawdown as a percentage of the equity at the peak. Lower is better. Anything above 30% is considered high risk for most traders.

Reading the Numbers: A Quick Guide

MetricPoorAcceptableGood
Win Rate< 35%35–50%> 50%
Profit Factor< 1.01.0–1.5> 1.5
Expectancy< $0$0–$10> $10
Max Drawdown %> 40%20–40%< 20%
Return %< 10%10–30%> 30%
Total Trades< 3030–100> 100

These are general guidelines. Requirements vary by strategy type, timeframe, and risk tolerance.