Skip to content
Wildflower
Join free
Not fooling yourself

Free Trading School · Level 4 · Course 4.3

Optimizing settings without fooling yourself

Lesson 8 of 18 in Not fooling yourselfModule 2: Overfitting

Testing and making it your own · Not fooling yourself

Optimizing settings without fooling yourself

Wildflower Trading School · Lesson 4.3.2.3

Wildflower

Every strategy has settings: the length of an average, the size of a stop, the time window. Trying several values and comparing them is called optimizing. By the end of this lesson, you'll know why picking the single best result is a trap, and how to look for a stable zone of settings instead. You'll also learn a simple sum that shows the difference, and what a stable zone can and can't tell you.

1 of 8

What you'll learn

  • Spot the chance winner. The single top setting often tops the list partly by luck.
  • Look for a steady zone. Nearby settings that all do fairly well are easier to trust.
  • Average the neighbours. The top setting can sit in a weak neighbourhood.
  • Change one thing at a time. Choose spaced values first and write down every result.
  • Test the zone on fresh data. A zone shares the same prices and the same chance effects.

Exercise

  1. Pick one setting of a strategy you've tested, such as the size or an average length.
  2. Choose three values spaced well apart, write them down, and replay the same dates with each.
  3. Draw the three results as bars and note whether they look like a peak or a zone.

Next: Data mining and the many-tests problem.

Quick check

  1. 1. Length 20 is the top result, but 15 and 25 are poor. What does that suggest?

  2. 2. Results for 40, 45 and 50 are +0.12R, +0.15R and +0.12R. What is the neighbour average for 45?

  3. 3. Why can't a steady zone prove a strategy works?

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 “Data mining and the many-tests problem” is waiting next time.

Read the full notes

When you try several settings, the single top result is often partly chance. A steady zone of settings that all do reasonably well is easier to trust, though it still needs testing on fresh data.

  • Optimizing means trying several values of a setting on the same past prices and comparing results. Picking the single top result is where creeps in, because one of many values will top the list partly by chance.
  • Made-up example: lengths 10 to 60. Length 20 tops the list at per trade, but 15 and 25 give −0.04R and +0.02R. Lengths 35 to 50 all give +0.11R to +0.16R: a steady zone.
  • Neighbour average: length 20 = (−0.04 + 0.30 + 0.02) ÷ 3 ≈ +0.09R; length 45 = (0.15 + 0.16 + 0.14) ÷ 3 = +0.15R. The top setting has the weaker neighbourhood.
  • By hand: choose a few well-spaced values first, keep everything else the same (Comparing two versions fairly), write down every result, look for zones.
  • A steady zone shows the result doesn't hang on one number. It can't show the zone is real, because every setting in it shares the same prices and the same chance effects. It still needs out-of-sample testing.

Worked example

Made-up numbers

Average the neighbours

Made-up numbers · average result per trade by length

  1. Length 20: (−0.04 + 0.30 + 0.02) ÷ 3 = 0.28 ÷ 3 ≈ +0.09R
  2. Length 45: (0.15 + 0.16 + 0.14) ÷ 3 = 0.45 ÷ 3 = +0.15R

The setting with the best single result sits in the weaker neighbourhood.

Your turn

Drill

Made-up numbers · length 35: +0.11R · length 40: +0.15R · length 45: +0.16R

Trading is risky. You can lose money. Test results are hypothetical, and a good test doesn't mean future profits. This lesson explains how testing works. It isn't advice.