Strategy Monte Carlo

Monte Carlo asks a different question from a single backtest. A backtest answers "did this strategy make money in this history?"; Monte Carlo answers "how much of that result survives when the market, the parameters and the execution are not exactly what I tested?".

The page first calculates the strategy exactly as it is. That run is the original backtest, and every chart and table refers back to it. The page then repeats the backtest many times, applying one random change per copy, in four groups:

  • Market variations change the data: the bars, the spread and the slippage.
  • Strategy variations change the strategy's numeric parameters.
  • Backtest start starts the same strategy later in the history.
  • Execution problems skip entries and exits, or close positions early.

Each group has its own test count, its own chart and its own row in the Validation results table. A fifth batch, the combined test, applies the enabled variations of every group at once. It is the most realistic stress test, because a live account meets all of these problems together, not one at a time.

The page also compares the intrabar interpolation methods (see Backtest quality). That comparison is not a variation group: it has no option and no test count, and the run calculates it whenever the original backtest is ambiguous.

The page is two columns. The wider left column holds one tab set — Simulations, Settings, Validation, Confidence — and the right column keeps the output visible while you work, in two cards: Monte Carlo results (the combined test chart and the Validation results table) and Backtest quality (the interpolation comparison chart and its two-row readout).

Before you start

  • The market and the strategy are the ones configured in the Strategy Editor. The page has no market selector of its own.
  • Start is disabled until the strategy's market data is loaded. If the data cannot be loaded, the page shows a warning above the tabs instead of results.
  • Use a strategy that already has an acceptable plain backtest. Monte Carlo measures how much of a result survives; it cannot turn a losing strategy into a robust one.
  • Decide the criteria on the Validation tab first. Every simulation is judged against them, so they define what "passes" means for the whole page.

Toolbar

The toolbar holds the run controls and the page's three figures.

Start and Stop

Start runs every enabled group with its configured test count. While a run is in progress the same button reads Stop; clicking it requests cancellation after the current backtest finishes.

Start is enabled only when the market data is loaded. While a run is active, every option, Clear and Reset are disabled, so a run cannot be changed halfway through.

Progress, Calculated and Validated

  • Progress is the share of the whole run that has been calculated, counting the simulations and the interpolation comparison together.
  • Calculated is the number of backtests already done.
  • Validated is how many of them passed the page's criteria, as "passed of planned" over the whole run.

The planned total comes from the settings before the first run of a strategy and from the run itself afterwards. A canceled run therefore keeps its own totals.

Clear and Reset

  • Clear discards the simulations and returns the page to the initial strategy. The original backtest is recalculated rather than removed, so the charts and the confidence row are never left blank. The settings and the validation criteria are kept.
  • Reset does what Clear does, and also restores the default settings and the default validation criteria.

Both buttons return the page to the Simulations tab.

Background runs

A run continues when you leave the page. While it is running, a red play marker is shown on the Monte Carlo tab, so you can follow it from any page; open the page again to see its progress and results. A run keeps the strategy, market, Data Horizon, account and validation criteria it was started with, so changing them does not alter a run already in progress. Completed results stay available after a cancellation and while you navigate between pages.

Simulations tab

The Simulations tab shows one card split into the four variation groups by titled dividers. Each section opens with its group name, then the group's checkboxes on the left and the group's chart on the right.

  • Checking a variation turns it on for that group only. The change repaints the chart immediately, from the results already on screen; the numbers take effect on the next Start.
  • Nothing else in the card is a control, so a click anywhere but a checkbox never changes a selection.
  • There are no include switches. The combined chart in the right column always applies the enabled variations of every group, so it is exactly the checked simulations.

A group whose variations are all cleared does not run, whatever its test count, and its chart draws the original balance line alone. A group can also be turned off by setting its test count to zero.

Market variations

  • Randomize historical data changes the configured percentage of bars. Each changed bar keeps its open price, while its high, low and close move by a random amount up to half of the Data change ATR % of ATR(10), so 20% moves a bar by at most 10% of ATR(10). The high and low are then widened to contain the moved close, and every price is rounded to the symbol's digits.
  • Randomize spread picks a spread in whole points between the configured minimum and maximum, but never below the market spread of the data. The real spread of a market can be far higher than the Monte Carlo defaults, and a simulation that trades on a lower spread than the live market would overstate every strategy it tests. So when the market spread is above the configured maximum, the effective maximum is raised to five times the market spread. The simulation never uses a spread below the real one: when the market is expensive it is stressed harder than the configured range, not less. The same floor applies to the minimum.
  • Randomize slippage picks slippage in whole points between the configured minimum and maximum.

Strategy variations

  • Randomize indicator parameters changes numeric parameters of the entry point, the exit point, the entry rules and the exit rules within their declared bounds and the configured range. A Level field is only changed for rules that use a level.
  • Each numeric field has the Parameter change probability % chance of changing, moves by at most the Maximum parameter change % of its value, and moves by at least the Minimum deviation steps so that low-value parameters still change visibly.

Backtest start

  • Randomize backtest starting bar prefers bars where an entry signal of the strategy opposes the position the original backtest holds at that bar, and gives the runs one such bar each. When there are fewer of those bars than runs, it falls back to a random bar in the first half of the usable history.
  • The group has no other parameter: only Tests.

Execution problems

  • Randomly skip position entry drops an entry order with the configured probability.
  • Randomly skip position exit is checked on every bar a position is held, and skips an exit with the configured probability.
  • Randomly close position is a per-bar hazard too: on every bar an open position is held it is closed with the configured probability. Read the number as an intensity, not as a share of trades — a 5% setting cuts almost every long-lived trade short.

Settings tab

The Settings tab holds the combined test count first and then every group's settings, in group order.

Combined test

  • Tests is the number of combined backtests; the default is 20.

Market variations

SettingDefaultWhat it does
Tests10Backtests in this group, 0 - 1000.
Changed bars %20Share of bars that change, 1 - 100.
Data change ATR %20How far a changed bar may move, as a share of ATR(10); the bar moves up to half of it, 0 - 100.
Minimum spread (points)10Lower end of the random spread, floored by the market spread of the data.
Maximum spread (points)30Upper end of the random spread; raised to five times the market spread when that is higher.
Minimum slippage (points)0Lower end of the random slippage.
Maximum slippage (points)20Upper end of the random slippage.

Strategy variations

SettingDefaultWhat it does
Tests10Backtests in this group, 0 - 1000.
Parameter change probability %50Chance that one numeric parameter changes, 0 - 100.
Maximum parameter change %10How far a parameter may move from its original value, in percent of that value.
Minimum deviation steps10Smallest move, in the parameter's own steps (5 - 40 in steps of 5), so low-value parameters still change.

Backtest start

SettingDefaultWhat it does
Tests10Backtests in this group, 0 - 1000.

The group has no other setting.

Execution problems

SettingDefaultWhat it does
Tests10Backtests in this group, 0 - 1000.
Skip entry probability %5Chance that one entry order is dropped.
Skip exit probability %5Chance per bar that an exit order is skipped.
Close position probability %5Chance per bar that an open position is closed early.

The group's three variations are not checked by default, so the default plan runs 50 simulations: Market 10, Strategy 10, Backtest start 10 and Combined 20.

Every setting and every variation is remembered, so the page opens on the configuration you left behind. Reset restores the defaults.

Validation tab

The Validation tab holds the page's single criteria set. Enable a metric and set the threshold that every run must satisfy, for example Min net profit or Max equity drawdown %.

The same criteria are applied to the original backtest, to every group's simulations, to the combined runs and to every interpolation method. The page always validates the full data window; there is no in-sample and out-of-sample split on this page.

Use Add criteria to add a metric and its limit, and the remove button on a criterion to delete it. Criteria are most useful when they express requirements the strategy must not break, such as a maximum drawdown or a minimum trade count.

An edit re-scores the results already on screen: a criterion is a function of a run's statistics, so the Confidence and Validation results tables update immediately, without a new run. The original backtest is judged by the criteria in full, so it is re-scored the same way. While a run is queued or running, its own criteria were captured when it started and apply to it; the edits apply to the next Start.

Right column

The right column is always visible next to the tabs, so the output never hides behind the tab you are editing. It holds two cards, each with its title above the card and its chart at the top of the card:

  • Monte Carlo results — the combined test chart on top and the Validation results table under it.
  • Backtest quality — the interpolation comparison chart with its legend on top and the two-row Backtest quality readout under it.

Monte Carlo results

The card opens with the combined test chart. It overlays the original account balance with the combined runs, each applying every enabled variation at once and using that group's own settings. The combined runs use the market-spread floor and the five-times rule exactly like the Market variations group.

When every variation is cleared, the combined chart is replaced by the Original backtest chart alone.

The Validation results table closes the card. It lists every simulation group — Combined test, the four variation groups and Backtest quality — with the number of its runs that passed the page's criteria, out of the tests the run planned for it.

  • A group with no enabled variation reads "0 of 0".
  • Before the first run the planned counts are the current settings; after a run they are the plan that run was started with.
  • The toolbar's Validated figure is the sum of the table.

Backtest quality card

The card opens with the chart: a legend above the canvas names each interpolation method and uses the colour of its line, and one balance line per method is drawn on it. The two-row readout of the original backtest sits under the chart.

  • Backtest quality is the share of the original's deals whose entry and exit were both unambiguous, and 100% when it made no deal.
  • Ambiguous bars is the original's count of bars where the order of the fills cannot be read from the bar itself. See Ambiguous bars.

The chart opens with the original balance line alone — on entry, after a reload, after Clear and after Reset — and that line gives way to the method lines as soon as the comparison's first result arrives. The initial original line has no legend entry.

Backtest quality

The intrabar interpolation method decides which order fills first when a bar reaches more than one of them. The run backtests the strategy with every method:

  • Pessimistic — the original backtest's own method, so it is the line the original backtest would draw.
  • Shortest
  • Nearest
  • Optimistic
  • Random — picks the order at random from the run's seed, so a line stays the same while the run draws it and differs between runs.

There is nothing to enable. Whenever the original backtest reports at least one ambiguous bar, the comparison runs and every method is checked against the same criteria as the other runs. An original with no ambiguous bars has too little ambiguity for the methods to resolve a bar differently, so the comparison is skipped and its table row reads "0 of 0".

The comparison only changes how an ambiguous bar fills its orders, so it reuses the compiled strategy, recalculates no indicator, and needs no test count. It never reaches the simulations: every group's runs and every combined run resolve their ambiguous bars with Pessimistic, so the methods are compared side by side in this chart rather than mixed into the stress test.

Read the chart as a measure of how much of the result depends on the ambiguity. A wide spread between the Pessimistic and the Optimistic line means the backtest numbers are a range, not a value.

Charts

  • Every chart overlays the original account balance with its own runs.
  • Each group's chart sits on the Simulations tab next to its options; the combined and Backtest quality charts sit in the right column.
  • Balance lines are reduced to a fixed number of chart points, so large data sets and high test counts remain practical.

Confidence tab

The Confidence tab pools the runs of the combined test only. That batch is the page's one realistic stress scenario; pooling the isolated groups as well would bias the bands toward whichever group ran the most tests, and each of those groups varies a single dimension. With the combined test off, the table shows the original's reference row alone.

The table starts with the original backtest and then shows representative simulations in five-percent confidence bands, ranked by net balance. Each occupied band contributes its best simulation, and every row carries its own validation result.

The columns are the Multi Market statistics parameters — Confidence, balance, profit, profit factor, profit per day, maximum drawdown, return to drawdown, trades and win/loss ratio — plus the validation result. Floating-point values are shown with two decimals.

Click a column header to sort by it and click it again to reverse the direction. Numeric columns start with the largest value first. The chosen sort is remembered with the page settings.

The interpolation comparison does not join the table: its method lines re-check the original strategy rather than forming an independent distribution.

  1. Backtest the strategy in the Strategy Editor and confirm it is worth stressing.
  2. Open the Validation tab and set the criteria the strategy must not break, for example a minimum net profit and a maximum drawdown.
  3. On the Simulations tab, uncheck the variations you are not testing and give every tested group at least 25 tests; ten runs are a first look, not a pass rate.
  4. Start the run and watch the charts. Stop it when the picture is clear.
  5. Read the Validation results table and the combined chart: the pass rate and the shape of the combined lines say more than the best single line.
  6. Check the Backtest quality readout. If the quality is low, the backtest numbers are ambiguous before any variation is applied, and that is worth fixing first.
  7. Open the Confidence tab to see how far the middle of the distribution sits from the original.

Common problems

Start is disabled

The strategy's market data is still loading, or it could not be loaded; the warning above the tabs carries the reason. Sign in and pick a market whose data has been cached for your account in the Strategy Editor, then reload the page.

A group shows 0 of 0

The group has no checked variation, or its test count is zero. Check its variation on the Simulations tab and its Tests on the Settings tab. For Backtest quality, the original backtest has no ambiguous bar, so there is nothing to compare.

The results did not change after I edited the settings

A run keeps the settings it was started with. The edits apply to the next Start; stop the current run or wait for it to finish to use them.

Every market simulation is much worse than the original

The market spread of the data is probably far above the configured range, so the spread floor and the five-times rule are stressing the strategy harder than the defaults describe. Tighten the spread range around the real spread to see the effect of the other variations.

A level-based strategy that fails the Market group is a finding about the market, not a lab verdict: the group is a stress test, and on an expensive market its spread is raised to five times the real one. The page says so in its warning line and publishes the numbers as mc-market-spread, mc-spread-effective-min and mc-spread-effective-max.

Execution problems barely change the result

The probabilities are per event and per bar, so a low value on a strategy with few trades does little: at 5% per bar an exit is only occasionally skipped on a short-lived trade. Raise the probabilities, or test the variations one at a time to see which one hurts.

Most simulations fail validation

That is a finding, not necessarily a configuration problem: a strategy whose profit depends on one exact market history or one exact parameter set is not robust. Check which criterion fails in the Confidence table, and whether the failures come from the market group or from the strategy group.

The Collection row and this page disagree

They are two different runs, and neither is wrong. A Collection row is the stored run: its net balance, trades and profit factor were written when the strategy was last calculated, with the account (initial balance, currency, leverage, stop-out), the data coverage and the out-of-sample split that existed then. The row's OOS line describes that stored record too, not the run this page starts. This page always calculates a fresh run with the account and data it has now, so a changed initial balance, a different currency, a leveraged account or a longer data history moves every figure.

Check the account before comparing: this page publishes the account it used as mc-initial-account, mc-account-currency, mc-leverage and mc-stop-out, and its data coverage as mc-data-bars, mc-data-start and mc-data-end. The Collection page reports how many of its shown strategies were calculated with a different account as collection-account-drift, and its Recalculate button is what re-runs them. Recalculate the collection (or compare the two accounts deliberately) instead of expecting the two numbers to match.