A trailing stop is built from a 28-period average with bands 2 standard deviations wide. When price closes through that stop, the system bets against the break instead of following it. Trades aim for a small 9-unit target with a much wider 70-unit stop, and an opposite signal flips the position.
Best run of 2. EUR/USD, 30 min, spread 1, from run sweeps:2026-09-25-EURUSD-30m-opt.tsv:2.
| Period | Up to 2026-09-25 |
| Instrument | EUR/USD, 30 minutes |
| Spread | 1 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-25 |
| positionSize Contracts per trade | 1 |
| bandPeriod Band average and deviation length | 28 |
| bandWidth Band width in standard deviations | 2 |
| takeProfitDistance Target distance in price units | 9 |
| stopLossDistance Stop distance in price units | 70 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| EUR/USDBest run | 30 min | n/a | 4,817 | 63.32 | 49,894 USD | -34,199 |
| GBP/USD | 4 hours | n/a | 1,012 | 63.64 | 7,405 USD | -7,144 |
Charts
The code
// ============================================================ // Bollinger Trailing Stop Fade // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: 30 minutes // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false // --- Parameters --- positionSize = 1 // contracts per trade bandPeriod = 28 // band average and deviation length bandWidth = 2 // band width in standard deviations takeProfitDistance = 9 // target distance in price units stopLossDistance = 70 // stop distance in price units // --- Indicators --- upperBand = Average[bandPeriod](close) + STD[bandPeriod](close) * bandWidth lowerBand = Average[bandPeriod](close) - STD[bandPeriod](close) * bandWidth // Band trailing stop: starts on the first band break, then only tightens ONCE trailLevel = 0 ONCE trendState = 0 IF trailLevel = 0 THEN IF close CROSSES OVER upperBand THEN trailLevel = lowerBand trendState = 1 ELSIF close CROSSES UNDER lowerBand THEN trailLevel = upperBand trendState = -1 ENDIF ENDIF IF trendState = 1 THEN trailLevel = max(trailLevel, lowerBand) ELSIF trendState = -1 THEN trailLevel = min(trailLevel, upperBand) ENDIF
30 more lines: the entry and exit rules.
Setup
Questions
Yes, it places market orders with a fixed target and stop, which ProOrder handles. The rewritten code has not been compile-checked, and the numbers come from the earlier version.
EUR/USD 30 minutes made USD 49,894 over 4,817 trades. GBP/USD 4 hours made USD 7,404.80 over 1,012 trades, with a drawdown nearly as large.
At 1 contract the EUR/USD run had a max drawdown of USD 34,199. With a 70-unit stop and a 9-unit target, a few losses can wipe out many wins, so plan for that drawdown.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.