Most strategy parameters fail not because they are wrong everywhere, but because they were tuned on one market condition and then deployed into another. This article describes a repeatable procedure for splitting historical Deriv synthetic index and forex data into distinct volatility regimes, fitting or selecting parameters within each regime, and cross-validating across them. The output is a diagnostic: parameters that only work in a single regime are flagged before they reach a live account. The method does not improve a strategy, it audits one.
Trading involves significant risk and you can lose your entire stake. Test every strategy on a demo account first.
Defining regimes before you look at results
A regime is a label assigned to a time window using only information available at the start of that window. If the label uses future data, every downstream test is contaminated. This is the first place regime analysis goes wrong.
For Deriv synthetic indices, the natural volatility measure is the realised range or standard deviation of tick-to-tick or bar-to-bar log returns over a rolling window. Volatility Index instruments (such as Volatility 75 or Volatility 100) have a designed volatility, but realised volatility still clusters and drifts intraday and across sessions, and the same applies to the Crash/Boom and Step indices. For forex pairs, the same rolling-return measure works, but session boundaries (Asia, London, New York) matter more, and weekend gaps must be excluded rather than treated as returns.
A simple, defensible scheme uses two dimensions:
- Volatility level: rolling standard deviation of log returns over the last N bars, split at the median (or at fixed quantiles) of a long reference sample. Two or three buckets are enough; more buckets shrink each sample and weaken every conclusion.
- Directional persistence or trend: for example, the sign agreement of the last M bar returns, or the ratio of net move to summed absolute moves over the window. This separates choppy conditions from directional ones, which matters for Rise/Fall and Multipliers far more than for Digit contracts.
Keep the regime definition fixed across the entire study. If you change the window length after seeing results, you are fitting the regime definition itself, and the cross-validation loses meaning. Record the definition in the strategy’s rule set before running anything, consistent with the ORSTAC premise that rules are written before trading.
A short pseudo-code sketch:
for each bar i:
vol[i] = stdev(log_return[i-N+1 .. i])
trend[i] = net_move[i-M+1 .. i] / sum(abs_return[i-M+1 .. i])
regime[i] = bucket(vol[i], vol_thresholds) + "|" + bucket(trend[i], trend_thresholds)
Every bar now carries a label computed from its own past. A trade opened at bar i is attributed to `regime[i]`.
Splitting the data and fitting per regime
Once labels exist, partition the tradeable history into regime segments and treat each as a separate dataset. Two disciplines matter.
First, purge and embargo. Overlapping contracts (a 5-tick Rise/Fall and a 5-bar Accumulator) blur the boundary between train and test. Leave a gap of at least the maximum contract duration between segments so that no trade’s outcome straddles the split. This is standard practice in financial machine learning and it is easy to implement in a data preparation script outside DBot.
Second, fit inside a regime, validate outside it. For each regime, select parameters on that regime’s training segment only. Then evaluate those parameters on (a) the held-out portion of the same regime and (b) every other regime. The second evaluation is the one that detects overfitting to condition.
For Deriv Bot specifically, parameter sweeps are usually run offline against exported tick or candle data obtained through the Deriv API documentation and the official Deriv API libraries, then the surviving configuration is rebuilt in Deriv Bot. DBot itself is not a batch backtesting engine; treat it as the execution layer, not the research layer. Confirm current limits on historical tick availability and contract specifications on the synthetic indices page, since these depend on platform settings and can change.
Judge every candidate by expectancy per contract, break-even win rate given the payout, and maximum drawdown, not by win rate alone. A Digit contract with a 9.09 payout multiple has a break-even hit rate of 1 / (1 + 9.09) ≈ 9.99%, so a 12% hit rate is a thin edge that a regime shift can erase.
Worked example. Suppose a Rise/Fall configuration is tested on a synthetic index with a fixed stake of 1.00 per contract and a payout of 0.95 per win (a 95% payout). Over 400 contracts in a high-volatility regime, it wins 210 and loses 190.
- Gross profit: 210 × 0.95 = 199.50
- Gross loss: 190 × 1.00 = 190.00
- Net: 199.50 − 190.00 = +9.50 over 400 contracts, or +0.024 per contract.
Break-even win rate at this payout is 1 / 1.95 ≈ 51.28%, or about 205 wins in 400. The observed 210 is only 5 wins above break-even; with a standard error on the win count of roughly √(400 × 0.5128 × 0.4872) ≈ 10.0, that edge is well inside noise. Now evaluate the same parameters in the low-volatility regime: 180 wins in 400 gives 180 × 0.95 = 171.00 against 220.00 lost, a net of −49.00. The parameter set is regime-dependent and statistically fragile in its best regime. Both facts belong in the report.
Cross-validation across regimes and the overfitting flag
The cross-regime matrix is the core artefact. Rows are parameter sets; columns are regimes; cells hold out-of-sample expectancy per contract and drawdown. A parameter set is robust if its expectancy is positive, or at least not materially negative, in every regime it will actually face, and if its worst-regime drawdown is survivable under the account’s limits. It is flagged if it is positive in one regime and negative in another, or if its performance collapses when the regime label is shuffled.
Two additional checks strengthen the flag:
- Regime-shuffle control. Randomly permute the regime labels, rerun the pipeline, and record how often a shuffled run produces a “robust” result. If shuffled data passes as often as real data, the regime split is not carrying information.
- Trial counting. Report how many parameter combinations were evaluated. Selecting the best of 500 configurations on 400 contracts will produce an impressive-looking winner by chance alone; the flag should carry that count so a reader can discount accordingly.
For contract families, the matrix should be built per family. Multipliers have price-based stop loss and take profit, so regime affects when those levels are touched. Fixed-stake Rise/Fall and Digit contracts have no price stop; risk is controlled by stake, duration and session limits, so regime mainly changes hit rate and payout structure. Accumulators are sensitive to volatility because a growth rate that is sustainable in calm conditions can breach the barrier quickly in a spike. Do not pool these families into one matrix.
A practical DBot implementation of the surviving rules, expressed as block steps:
- On start, read the session loss limit and maximum consecutive losses from variables.
- On each tick, compute the rolling volatility and trend measures from stored ticks.
- If the current regime is not in the approved list for this parameter set, do not trade.
- Otherwise place the contract with the fixed stake defined in the rule set.
- On each closed contract, update cumulative loss and the consecutive-loss counter; stop the bot when either limit is hit.
The bot stops by itself; the regime filter is an additional gate, not a substitute for the hard limits. ORSTAC recommends against martingale, and no regime result justifies removing the cap on steps and stake or skipping a ruin test.
Limitations
This procedure does not tell you which regime will occur next; it only tells you how a parameter set behaved in past labelled conditions. Regime definitions are choices, and different reasonable definitions can produce different flags. Synthetic index tick histories available through the API may be shorter than desired, and forex data carries session and gap artefacts that require cleaning. Cross-validation reduces, but does not eliminate, selection bias, especially when many configurations are tried. The method says nothing about execution slippage, latency, or platform-side changes to contract specifications. A backtest remains a filter, not proof, and demo results remove financial risk but not behavioural or execution differences from live trading.
Frequently Asked Questions
How many regimes should I use?
Two to four is usually enough; more buckets shrink each sample until the cross-validation cannot distinguish signal from noise.
Can I run this entirely inside Deriv Bot?
No; DBot executes strategies but is not a batch research environment, so regime labelling and parameter sweeps belong in an offline script using the Deriv API, with DBot rebuilt from the surviving rules.
What do I do with a flagged parameter set?
Either restrict it to the regime where it holds and accept the reduced trading frequency, or discard it; do not deploy it across all conditions on the strength of its best regime.
Key Takeaways
- Label regimes using only past data, and freeze the definition before testing.
- Fit parameters inside a regime and validate outside it, with a purge gap for overlapping contracts.
- Judge by expectancy, break-even rate and drawdown, never win rate alone.
- Report the number of configurations tried; a large sweep inflates apparent robustness.
- A parameter set that is positive in one regime and negative in another is flagged, not optimised.
The full procedure, including data preparation scripts and example bot configurations, is available in the ORSTAC repository. The bots run on Deriv, where a free demo account is available to test them before any real-money use. Questions and results from your own regime splits are welcome in the ORSTAC Telegram group.
Trading involves significant risk and you can lose your entire stake. Test every strategy on a demo account first.
