Buys when price closes above a volatility stop set 1 ATR(3) from the closing extremes, and closes the long when price falls below it. The stop trails the trend and resets when the trend flips.
Best run of 7. DAX 40, 4 hours, spread 3, from run pf:2026-10-13-DAX40-4h.tsv:4.
| Period | Up to 2026-10-13 |
| Instrument | DAX 40, 4 hours |
| Spread | 3 points |
| 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-10-13 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| DAX 40Best run | 4 hours | 1.23 | 2,204 | 41.70 | 22,598 EUR | -2,664 |
| Dow Jones | Daily | n/a | 1,016 | 39.96 | 12,101 EUR | -10,536 |
| Nikkei 225 | 4 hours | n/a | 1,861 | 38.90 | 11,190 USD | -10,878 |
| Nasdaq 100 | 4 hours | n/a | 2,321 | 39.55 | 9,767 EUR | -5,912 |
| Nasdaq 100 | Daily | n/a | 915 | 38.80 | 6,423 EUR | -6,098 |
| Gold | Daily | n/a | 1,009 | 37.36 | 2,611 EUR | -1,074 |
| Gold | 4 hours | n/a | 2,222 | 37.89 | 1,754 EUR | -1,070 |
Charts
The code
// ============================================================== // ATR Volatility Stop Long // ProRealAlgos Strategy Library | prorealalgos.com // Type: Volatility // Direction: Long only // Timeframe tested: 4 hours // ============================================================== DEFPARAM CumulateOrders = false ONCE maxv = 0 ONCE minv = 0 ONCE up = 1 ONCE vstop = 0 myAtr = AverageTrueRange[3](close)
41 more lines: the entry and exit rules.
Setup
Questions
Yes. The code is ProBuilder and runs as an automated ProOrder system. Backtest it on your own account with your own spread and position size before trading it live.
It was tested on 7 market and timeframe combinations. The best run was DAX 40, 4 hours, with a profit factor of 1.23 over 2,204 trades.
The best run had a maximum drawdown of 2,664 EUR at the tested position size, against a net result of 22,598 EUR.
It only takes long trades.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.