Strategies / S23
Donchian Long & Short
Goes with whichever side breaks a 20-bar range.
Results
| Market class | Return | Holding | Sharpe | Max DD | Win rate | Trades |
|---|---|---|---|---|---|---|
| Crypto, 4h | +0.7% | +518% | 0.27 | -68.7% | 36.1% | 6,149 |
| Stocks, 1d | +282% | +28K% | 0.40 | -25.1% | 37.0% | 1,426 |
| Forex, 1d | -0.8% | +3.1% | 0.03 | -21.6% | 36.2% | 660 |
| Commodities, 1d | +39.4% | +1,833% | 0.16 | -47.0% | 36.2% | 826 |
| Indices, 1d | +38.6% | +878% | 0.16 | -39.7% | 35.1% | 840 |
The exact rule
- Go long when close is above the 20-bar high.
- Go short when close is below the 20-bar low.
- An opposite signal reverses the position.
- Declared timeframe: 4h.
Explain it with Ask AI (Premium, on a desktop)
Watch it trade
This runs the same engine in your browser on the latest candles, with your own costs. Press Replay to watch every entry and exit arrive bar by bar.
Download
Pine ScriptFor TradingView
Paper botRuns on the Bot API, no real money
Python backtestOne file, no dependencies
READMEThe rule in plain words
Want it to run by itself? Read the automate guide, and use paper money first.
Related strategies
Volume BreakoutA 20-bar high on twice the normal volume.Breakout With 3R TargetA 20-bar high with a 2 ATR stop and a target three times the risk.Breakout With ATR TrailA 20-bar high, then a 3 ATR trailing stop rides the move.
Research, not advice. Past results do not predict future ones. Results run to 2026-10-31.