Buys when price closes back above a lower envelope set at 0.65 times the 140-period SMA, and sells when price closes back below an upper envelope at 1.45 times that SMA. The system only holds long positions.
Best run of 6. Nikkei 225, Daily, spread 10, from run sweeps:2026-10-12-NIKKEI-D-opt.tsv:36.
| Period | Up to 2026-10-12 |
| Instrument | Nikkei 225, Daily |
| Spread | 10 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-12 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| Nikkei 225Best run | Daily | n/a | 1 | 100.00 | 59,388 USD | -11,540 |
| Nasdaq 100 | Daily | n/a | 1 | 100.00 | 28,457 EUR | -5,914 |
| DAX 40 | Daily | n/a | 1 | 100.00 | 22,319 EUR | -5,511 |
| Silver | Daily | n/a | 1 | 100.00 | 17,785 USD | -2,276 |
| US Crude Oil | 15 min | n/a | 1 | 100.00 | 7,615 EUR | -7,128 |
| US Crude Oil | 1 hour | n/a | 1 | 100.00 | 7,133 EUR | -7,083 |
Charts
The code
// ============================================================== // SMA 140 Envelope Reversion // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long only // Timeframe tested: Daily // ============================================================== DEFPARAM CumulateOrders = false mdl = Average[140](close) upr = mdl * 1.45 lwr = mdl * 0.65
10 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 6 market and timeframe combinations. The best run by trade count was Nikkei 225, Daily, with 1 trades.
The best run had a maximum drawdown of 11,540 USD at the tested position size, against a net result of 59,388 USD.
It only takes long trades.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.