Skip to content
All library documents

Validating and Optimizing a Donchian Breakout Strategy

Code Quant course library

Summary

The document implements a Turtle-style breakout strategy using Donchian channel levels for entries and exits, with ATR-based stop placement and position sizing. It tracks the trade’s high and low, moves stops as prices advance, and adds to positions at intervals based on the initial ATR. The example is set up for a Bitcoin instrument and includes assumptions for fees, slippage, contract size, and a historical test period.

It recommends checking generated orders and trades against a chart to catch logic errors, then optimizing parameters on one period and evaluating them on a later holdout period. It also suggests rolling the optimization and validation windows forward, or optimizing on one exchange and checking on another. A genetic algorithm targets the Sharpe ratio. These are validation ideas rather than reported findings: no optimization results or out-of-sample performance are shown. The sample code also does not demonstrate a specific future-data audit, so avoiding look-ahead bias still requires careful review of indicator timing and execution assumptions.

Key ideas

  • Use Donchian channel breakouts to define entry and exit levels.
  • Set initial risk and trailing stops using ATR, and add to positions at ATR-based price intervals.
  • Compare simulated trades and orders with a chart to inspect whether the implementation follows its intended logic.
  • Optimize parameters on one data period and evaluate them on a later holdout period.
  • Test whether results persist across rolling periods or a different exchange’s data.

Tags

Cited by

From a private course collection; the original is not published.