Module 5 — Algorithmic trading · Lesson 20 of 23 · 9 min

From idea to rules: writing a testable strategy

How to turn a discretionary concept into numeric rules, without ambiguity and with few parameters.

Hypothesis before code

Start from a one-sentence hypothesis: 'after a sweep of the Asian low during London, with a bullish MSS, price tends to reach the previous day's high'. The code exists to verify it, not to find it by chance in the data.

The four pieces of every strategy

  • Entry: exact conditions and entry price (for example the open of the candle after the signal)
  • Exit: stop and target or a closing rule, in pips or in ATR multiples
  • Size: a fixed percentage risk per trade
  • Filters: hours, days, minimum volatility, announcements to avoid

Making concepts measurable

  • Swing: a high with n lower candles to the left and right (n chosen in advance)
  • MSS: a close beyond the last opposite swing after the sweep
  • Strong candle: body larger than k times the ATR
  • FVG: high of candle 1 lower than the low of candle 3 (and vice versa), with a minimum size in ATR
  • Premium or discount zone: above or below 50% of the major swing's range

Few parameters

Every extra parameter is a degree of freedom with which to fit the model to the past. Prefer strategies with 3-5 parameters, and choose 'round', sensible values (n=3, ATR=14) instead of searching for those that maximise the backtest.

Exercise

  • Rewrite the sweep-MSS-FVG model as a list of numeric conditions, with no vague words
  • Have someone else read the list: they must be able to arrive at the same signal on the chart. If not, it is still ambiguous

Have a question or want to share your exercise?

Post in the community, or join the free signals room on Telegram.

Educational content, not financial advice. Trading involves risk. ICT is a term referring to the materials of Michael Huddleston: this course is independent and not affiliated.