Strategy Backtest Stats
Every change in the Strategy Editor raises the same question: what did it do to the result? The Strategy Backtest Stats page answers it twice — with the account's story in the balance chart, and with the numbers behind it in the backtest statistics.
The page is a read-only report of the current strategy over the current market data. It has no strategy controls and no market controls: the strategy, its features, the market, the account and the Data Horizon are the ones the rest of the app already has. The trades list and the indicator chart are on the Strategy Backtest History page.
Layout
The toolbar holds the page title (Backtest stats) and the Export button.
The page below the toolbar is divided into two stacked sections by a horizontal splitter:
- Upper section: the balance chart
- Lower section: the backtest statistics tables
Drag the splitter up or down to resize the upper section. The chart grows with it and the tables take the rest of the page; the chart keeps at least 10 rem and the tables at least 5 rem, so a short window caps the chart instead of squeezing the tables out of view.
The chosen height is remembered between visits (30 rem until then).
Balance chart
The chart plots the backtest over the tested bars.
| Line | Meaning |
|---|---|
| Balance | The account balance after every closed trade, in the account currency |
| Equity | The balance with the floating result of the open positions; the area is filled green where it is above the initial deposit and red where it is below |
| Drawdown | The peak equity minus the current equity, so it returns to zero whenever the equity reaches a new high |
| Deposit load | The margin the open positions require as a share of equity; it rises while positions grow and drops to zero when the account is flat |
The chart has no controls of its own. Point at it to read the Drawdown, Balance, Equity and Deposit load at the bar under the pointer. Moving off the chart clears the readout.
Backtest statistics
The statistics are eleven tables in named groups, each table answering one question. On narrow windows the tables stack; from a medium width they flow into two columns and on a wide window into three.
| Group | Reported values |
|---|---|
| Overview | The strategy magic number (the Strategy row), server, market (symbol and period), tested bars, data start and data end (the first bar's time and the last bar's close) |
| Profit | Initial deposit, net profit, gross profit, gross loss, expected payoff, profit per day |
| Trades | Total trades, total deals, profit and loss trades, long and short trades won %, plus the leg rows of an adding strategy |
| Drawdowns | Balance and equity drawdowns — absolute, maximal and relative, with percents |
| Ratios | Profit factor, recovery factor, Sharpe ratio, system quality number, R-squared, win/loss ratio |
| Risk | Ambiguous bars, backtest quality, margin level, the largest position volume and the two broker-refused counters, max daily loss %, max loss %, max stagnation |
| Trade results | Largest and average profit and loss trades, months on profit % |
| Consecutive deals | Maximum and maximal consecutive wins and losses, average consecutive wins and losses, with the profit and loss each streak added |
| Holding | Bars in trade (%), minimum, maximum and average holding time |
| Costs | Total commission, total spread, total long swap, total short swap |
| Measures | Z-score, AHPR, GHPR, LR correlation, LR standard error |
Every row is a label and a value. Hover a label to read a short description of what the value measures, and of how it is calculated. Only the three signed figures — net profit, expected payoff and profit per day — read green when positive and red when negative; the other rows are neutral, because a large or small figure is not a good or bad one by itself.
The Margin level row is a dash when the run never held a position. Margin level, Z-score, GHPR, LR correlation and LR standard error follow the MetaTrader 5 tester definitions, so those five read the same way in both testers.
The leg rows of an adding strategy
A strategy that adds to a position — Grid / averaging down, Martingale, Add on same signal — opens one position as several legs, and MetaTrader reports results on the leg basis. For such a strategy the Trades table adds three rows under Total deals:
| Row | Meaning |
|---|---|
| Position legs | The legs of every closed position; the count MetaTrader calls trades |
| Winning legs | The legs that closed in profit, with their share of all legs |
| Leg profit factor | The gross leg profit divided by the gross leg loss |
A plain one-order strategy has one leg per position, so the rows would repeat the position figures and the table hides them.
Account-limit diagnostics
The Risk table reports the largest volume the run opened, and adds two further rows only when the broker refused an entry:
| Row | Meaning |
|---|---|
| Max position volume | The largest position volume the run opened: the exposure of a scaled-up ladder at a glance. It is a report of what the run did, not a limit it hit, so it is there on every run that opened a position and absent on one that never did |
| Margin-blocked entries | Entries the free margin at the fill price could not carry, the orders MetaTrader refuses with "Not enough money" |
| Volume-refused entries | Entries whose volume was outside the symbol's minimum or maximum volume |
A refusal counter above zero says the broker would have refused entries the backtest could not take, so a short trade count is then an account limit rather than the strategy's own decision. A run that stayed inside the account's limits shows the volume row and no counters.
Export
The Export button downloads every statistic of every table as one CSV file with the columns Group, Statistic and Value, one row per displayed value, so the group stays a column in a spreadsheet. Values are written exactly as the page shows them, money with its currency and thousands separators.
The file is named <symbol><period>-<magic number>-backtest-stats.csv, for example EURUSDH1-1234567-backtest-stats.csv, so a folder of exports keeps its markets and strategies apart.
The button is disabled until the first result is rendered; while the page has nothing to export, clicking it does nothing.
What changes the numbers
The report is read-only, but the numbers are not fixed — they follow the app-wide settings the backtest runs with:
| Source | Effect on the report |
|---|---|
| Account settings | The currency, the initial deposit, the leverage and the stop out level; the initial deposit is the Profit table's starting point and the leverage decides the margin behind the deposit load |
| Symbol settings | The spread, the commission and the swap the run pays, hence the Costs table and every net figure |
| Data Horizon | Which bars the market loads and when trading may start, hence the tested bars, the data span and every count |
| Strategy features | The money management, the position limits and the protective exits the run applies |
| Ambiguous bars | How a bar whose range could hit both the stop and the target is resolved, hence the backtest quality |
The five rows picked in Settings → Backtest stats rows 1 to 5 are not used here: they shape the compact tables of the Strategy Editor and the Collection page. This page always reports every group.
Open a record in the Coll side panel and the page reloads for the strategy and market that record carries, like every other Strategy page.
Reading the report
- Read the profit together with the risk: Net profit next to Equity maximal and Recovery factor, and Total trades for the size of the sample. The same profit out of a 5% and a 40% drawdown describes two very different strategies, and a dozen trades are an anecdote rather than a statistic.
- Ambiguous bars counts the bars where the entry direction was undecidable (the entry is skipped) and the bars where two reachable orders had to be resolved by the intrabar method, so a count above zero does not yet mean an executed trade was resolved by chance — Backtest quality answers that, because it counts only the deals whose entry and exit bars were unambiguous.
- A trade count that stops early is usually the account: look for Margin-blocked entries and Volume-refused entries in the Risk table before blaming the strategy.
Common problems
| Symptom | Cause |
|---|---|
| The chart is a flat line and the tables are empty | No data for the market. A toast reports the reason; usually the market is not cached for the signed-in account. The market is the Editor's, so fix it there and open the page again |
| Every statistic is zero | The strategy never traded over the tested bars: the entry rules never matched, the indicator periods are longer than the loaded data, or the Data Horizon trade start cut the tradeable range |
| The trade count is lower than expected | The account ran out of money or the volume left the symbol's range; look for the account-limit rows in the Risk table |
| A figure differs from MetaTrader 5 | The spread, the commission and the swap come from the symbol settings, and intrabar ambiguity follows the SBP bar close rules rather than MT5's tick model |
| Export does nothing | The button is disabled until the first result is rendered. Wait for the table to fill, or fix the missing data first |
| The chart snaps back after a drag | The window is too short for a taller chart; the splitter keeps a minimum height for the tables |
Saved user preferences
The page stores user state in local storage under strategy-backtest-stats-state.
Saved values:
- Upper section height
State is restored when opening the page and saved when the splitter drag ends and when the page closes.