Bots & Automation

Adaptive Trading Bots: Filters, Volatility Scaling and Market Regimes

How a trading bot can adapt to changing markets without becoming a curve-fitted black box: volatility-scaled stops and sizing, trend and range regime filters, session awareness and their pitfalls.

By AlgoXP3 min readUpdated

Adaptive trading bot loop: read the market, detect the regime, adjust rules and trade

Markets do not behave the same way all the time. Volatility doubles and halves, trends give way to ranges, sessions differ in character. A bot with fixed distances and no awareness of conditions will trade calm and wild markets identically. Adaptive bots adjust to conditions - but every adjustment is a new parameter, and the line between adaptation and curve fitting is thin.

The adapt-decide-act loop

An adaptive bot repeats a simple loop:

  1. Read the market - volatility, trend strength, session, spread.
  2. Classify the regime - for example “trending and normal volatility”.
  3. Adjust behaviour - distances, size, which setups are allowed.
  4. Trade with the adjusted rules, and record the regime with each trade.

The adjustments should follow logic you can explain without looking at the backtest.

1. Volatility scaling

The most robust form of adaptation. Instead of fixed distances in points:

  • Stops and targets in multiples of ATR: a 1.5 × ATR stop is wide on volatile days and tight on quiet ones, keeping the stop proportional to normal noise.
  • Position size from risk: if the stop is wider, the position is smaller, so the money at risk per trade stays constant.
  • Grid spacing or entry offsets in ATR units, so a grid does not become dangerously tight when volatility jumps.

Volatility scaling adds little freedom (usually one multiple per distance) and has a clear rationale. It also makes parameters transferable between instruments.

2. Trend vs range filters

Many strategies are built for one kind of market: breakouts and trend following prefer trends, mean reversion prefers ranges. Common filters:

  • ADX above a threshold for trend strategies, below it for range strategies.
  • Price relative to a long moving average, and the slope of that average.
  • Range width relative to ATR - narrow ranges can precede breakouts.

Use filters to reduce trading in unfavourable conditions rather than to switch between completely different strategies. Switching logic doubles the number of things that can be overfitted.

3. Session awareness

FX, metals and indices behave differently in Asian, London and New York hours. Adaptive behaviour can include:

  • trading only in sessions where the setup made sense historically;
  • wider spread tolerance at the open, or no trading around rollover;
  • closing intraday positions before the end of the day or the weekend.

Sessions must be defined in the broker’s server time - one of the most common sources of bugs.

4. Spread and liquidity guards

A simple, high-value adaptation: skip entries when the current spread is several times its normal level. This avoids the worst fills at news and rollover without changing the strategy’s logic.

The overfitting trap

Every adaptive rule has thresholds: ADX above 25 or 20? ATR period 14 or 20? Volatility percentile 70 or 80? Optimise them all and the bot will “adapt” perfectly to the past.

Defences:

  • Keep the number of adaptive rules small and each one logically motivated.
  • Prefer continuous scaling (multiply by ATR) over hard switches (if ADX > 23.5).
  • Check stability - does the filter work across a range of thresholds? See parameter stability analysis.
  • Validate out of sample and with walk-forward analysis.
  • Record the regime with each trade, so you can verify live whether the filter behaves as it did in testing.

Example

A breakout bot on gold uses fixed 300-point stops. In quiet months it is stopped out by noise; in volatile months the stop is too tight to survive normal swings. Changing the stop to 1.5 × ATR(14) and sizing positions from 0.5% risk produces fewer stop-outs in volatile periods and smaller losses in quiet ones. Adding a filter that skips breakouts when the Asian range is wider than 2 × ATR removes the weakest trades. Both changes are tested across thresholds and hold on the most recent two years that were not used for development.

Key takeaways

  • Adaptation means reading conditions and adjusting distances, size or allowed setups.
  • Volatility scaling is the most robust adaptation; regime switches are the riskiest.
  • Define sessions in server time and guard against abnormal spreads.
  • Treat every adaptive threshold as a parameter that can be overfitted - and test it like one.

Related: AI in algorithmic trading.

FAQ

What is a market regime?

A period in which a market behaves in a consistent way - for example trending, ranging, quiet or highly volatile. Strategies usually work in some regimes and struggle in others.

Does adaptation always improve a bot?

No. Each adaptive rule adds parameters and therefore new ways to overfit. Adaptation is worth it when it follows a clear logic (stops scale with volatility) and survives out-of-sample testing.

Should a bot stop trading in the 'wrong' regime?

Often a filter that reduces or skips trades in unfavourable regimes improves risk-adjusted results. Test it carefully: regime filters are easy to fit to past periods.

Sources and further reading

  1. StockCharts ChartSchool: Average True Range (ATR) - chartschool.stockcharts.com
  2. StockCharts ChartSchool: Average Directional Index (ADX) - chartschool.stockcharts.com
  3. Bailey et al.: The Probability of Backtest Overfitting - papers.ssrn.com