A close above the 20-bar high opens a long, and a close below the 20-bar low opens a short. Positions close when price crosses the opposite 10-bar channel or hits a 1% stop. It was tested on index and Gold charts from 5 minutes to 1 hour.
Best run of 16. DAX 40, 1 hour, spread 3, from run pf:2026-09-15-DAX40-1h.tsv:1.
| Period | Up to 2026-09-15 |
| Instrument | DAX 40, 1 hour |
| Spread | 3 points |
| Contracts | 1 |
| Starting capital | 1,000,000 |
| Costs | Spread only. Commissions and overnight financing are not included. |
| Bars | Up to 200,000 bars, fewer where the instrument has less history |
| Last tested | 2026-09-15 |
| positionSize Contracts per trade | 1 |
| channelPeriod Entry channel length | 20 |
| exitPeriod Exit channel length | 10 |
| stopLossPct Protective stop, percent of entry price | 1 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| DAX 40Best run | 1 hour | 1.04 | 3,444 | 35.51 | 5,872 EUR | -4,299 |
| Gold | 1 hour | n/a | 3,401 | 35.67 | 240 EUR | -816 |
| Gold | 30 min | n/a | 5,566 | 34.44 | -211 EUR | -3,134 |
| Gold | 15 min | n/a | 5,447 | 31.28 | -1,708 EUR | -3,514 |
| Gold | 5 min | n/a | 5,490 | 31.86 | -3,707 EUR | -3,867 |
| S&P 500 | 5 min | n/a | 5,596 | 31.61 | -4,442 EUR | -4,496 |
| DAX 40 | 30 min | n/a | 5,850 | 34.92 | -5,311 EUR | -9,461 |
| S&P 500 | 30 min | n/a | 5,939 | 33.68 | -5,417 EUR | -6,873 |
| S&P 500 | 1 hour | n/a | 3,923 | 33.98 | -5,799 EUR | -6,267 |
| S&P 500 | 15 min | n/a | 5,841 | 32.12 | -7,472 EUR | -7,561 |
| Nasdaq 100 | 5 min | n/a | 5,680 | 33.87 | -8,625 EUR | -8,712 |
| Nasdaq 100 | 30 min | n/a | 6,105 | 34.22 | -9,101 EUR | -14,235 |
| Nasdaq 100 | 1 hour | n/a | 4,012 | 33.57 | -10,985 EUR | -13,661 |
| Nasdaq 100 | 15 min | n/a | 5,817 | 33.02 | -12,669 EUR | -16,373 |
| DAX 40 | 15 min | n/a | 5,724 | 33.61 | -18,816 EUR | -18,832 |
| DAX 40 | 5 min | n/a | 5,759 | 31.62 | -20,430 EUR | -20,671 |
Charts
The code
Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.
// ============================================================ // Donchian Channel Breakout // ProRealAlgos Strategy Library | prorealalgos.com // Type: Breakout // Direction: Long & short // Timeframe tested: 1 hour // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade channelPeriod = 20 // entry channel length exitPeriod = 10 // exit channel length stopLossPct = 1 // protective stop, percent of entry price // --- Indicators --- // Channels end on the previous bar, so the breakout bar cannot set its own level. channelHigh = Highest[channelPeriod](high)[1] channelLow = Lowest[channelPeriod](low)[1] exitHigh = Highest[exitPeriod](high)[1] exitLow = Lowest[exitPeriod](low)[1]
26 more lines: the entry and exit rules.
Read this first
Questions
Yes, all rules are automatable. The code was rewritten after testing and is not compile-checked, and the test results are weak, so treat live use with caution.
DAX 40, Nasdaq 100, S&P 500 and Gold on 5, 15, 30 minute and 1 hour charts. Apart from the DAX 40 1 hour best run and Gold 1 hour, every sweep lost money.
The DAX 40 1 hour run saw a max drawdown of EUR 4,298.5 against EUR 5,871.8 net profit. The worst sweep drew down EUR 20,670.9.
The 3 point spread is a bigger share of each trade on 5 and 15 minute bars, and the channel breaks more often, so losses stack up.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.