Skip to content
Wildflower
Join free
Market regimes

Free Trading School · Level 7 · Course 7.7

Regime filters and standing aside

Lesson 8 of 8 in Market regimesModule 2: Working with regimes

Advanced · Market regimes

Regime filters and standing aside

Wildflower Trading School · Lesson 7.7.2.4

Wildflower

You've measured regimes, split tests by them, and written warning signs. The natural next thought is: why not add a rule that switches the strategy off in the regimes where it struggled? That's a regime filter. By the end of this lesson, you'll know how to write one so it only uses information known at the time. You'll see why it's one of the easiest rules to fit to the past. And you'll know the checks traders put it through, and other ways people handle regimes. One thing up front: nothing here says a regime filter will improve results. Whether one helps can't be known in advance.

1 of 7

What you'll learn

  • Build a switch. A regime filter stops new trades in conditions you choose.
  • Use only earlier data. Each filter reading must be known before the trade.
  • Guard against fitting the past. You've seen the losses, and the filter rests on few spells.
  • Count the cost of lag. A late switch can cost as much as it saves.
  • Test it on kept-back data. Nudge the line and length, and count the spells.

Exercise

  1. Write a regime filter on paper for a strategy you've tested, using only data known before each trade.
  2. Before testing it, write the reason, the dates you'll keep back and the nudges you'll try.
  3. Then count how many spells it would switch for.

Next: the course quiz.

Quick check

  1. 1. A filter uses the label "this month was ranging", decided at the month's end, to skip trades during that month. What's wrong?

  2. 2. A test has 300 trades but only three ranging spells. What does a ranging filter really rest on?

  3. 3. A regime filter improved a backtest. What does that show on its own?

0 of 3 answered.

Finished this lesson?

Tick it off and keep your place

Make a free account and we'll remember where you are, so “What an option is” is waiting next time.

Read the full notes

A switches a off in conditions you choose, using only data known before each trade. It's easy to , its lag can cost as much as it saves, and a better after adding one isn't evidence on its own.

  • A is a switch on top of the rules: on, trade as written; off, no new trades. It may use only data known before the trade, such as a 60-day at yesterday's close. Hindsight labels would be look-ahead bias.
  • Standing aside is the same idea by hand (When to stand aside). A skipped trade scores zero, on losing days and winning days alike.
  • Easy to : you've seen where the losses were; it rests on a few spells, not many trades; the line and length are free choices (Data mining and the many-tests problem); and a filter that only removes trades can always be fitted to look better on the past.
  • Made-up lag cost: +11.4R unfiltered; two months late off saves 3.2R, two months late on misses 7R: 11.4 + 3.2 − 7 = +7.6R. Other numbers could go the other way.
  • Checks: a reason first; unchanged on kept-back data with its own regime changes (In-sample and out-of-sample data); nudge the line and length (Nudging the settings); count the spells. Passing doesn't prove it will help. See When a filter helps and when it overfits.
  • Other ways: accept the bad spells, trade smaller instead of stopping, or run strategies suited to different conditions. More: Market regimes and Overfitting.

Worked example

Made-up numbers

What the lag costs

Made-up numbers · +3.5R a trending month, −1.6R a ranging month · the filter switches two months late

  1. No filter: +11.4R for the year.
  2. Off in June and July (ranging): saves 2 × 1.6 = 3.2R.
  3. Still off in August and September (trending): misses 2 × 3.5 = 7R.
  4. Filtered: 11.4 + 3.2 − 7 = +7.6R.

Here the lag cost more than the filter saved. Other numbers could go the other way.

Trading is risky. You can lose money. Test results are hypothetical, and past market conditions don't tell you what comes next. This lesson explains how markets and testing work. It isn't advice.