A smoothed Bollinger %b, built from a zero-lag Heikin-Ashi close and a TEMA, spots dips below 30 above the 220-day SMA and spikes above 90 below it. Trades use a 5% stop, 10% target, an ATR trailing stop, and a time exit for losing trades.
Best run of 21. Nasdaq 100, Daily, spread 3, from run pf:2026-09-15-NAS100-D.tsv:1.
| Period | Up to 2026-09-15 |
| Instrument | Nasdaq 100, Daily |
| 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-16 |
| positionSize Contracts per trade | 1 |
| trendFilterOn 1 = only trade with the long-term average, 0 = off | 1 |
| trailingOn 1 = use the ATR-scaled trailing stop, 0 = off | 1 |
| stopLossPct Protective stop, percent of entry price | 5 |
| takeProfitPct Profit target, percent of entry price | 10 |
| longTrailFactor Trailing distance for longs, in scaled ATR units | 9 |
| shortTrailFactor Trailing distance for shorts, in scaled ATR units | 4 |
| atrTrailPeriod ATR length for the trailing distance | 200 |
| minTrailPoints Minimum trailing distance | 5 |
| maxLosingBarsLong Close a losing long after this many bars | 16 |
| maxLosingBarsShort Close a losing short after this many bars | 2 |
| trendPeriod Trend filter SMA length | 220 |
| bandPeriod %b standard deviation and average length | 17 |
| temaPeriod TEMA smoothing length | 8 |
| oversoldLevel Buy when %b is below this | 30 |
| overboughtLevel Sell short when %b is above this | 90 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| Nasdaq 100Best run | Daily | 1.66 | 492 | 71.95 | 13,584 EUR | -3,078 |
| S&P 500 | Daily | 1.48 | 515 | 63.30 | 2,671 EUR | -983 |
| Dow Jones | Daily | 1.41 | 506 | 71.15 | 18,609 EUR | -7,365 |
| DAX 40 | Daily | 1.37 | 555 | 66.31 | 9,989 EUR | -3,831 |
| EUR/USD | 2 min | 1.35 | 5,690 | 22.04 | 147,182 USD | -95,915 |
| FTSE 100 | Daily | 1.35 | 391 | 72.63 | 4,926 EUR | -1,460 |
| EUR/USD | 3 min | 1.29 | 6,190 | 27.21 | 101,696 USD | -69,006 |
| Gold | 4 hours | 1.25 | 856 | 47.78 | 1,808 EUR | -917 |
| EUR/USD | Daily | 1.24 | 550 | 74.18 | 45,379 USD | -19,978 |
| Nikkei 225 | Daily | 1.24 | 397 | 71.03 | 20,214 USD | -8,103 |
| Nasdaq 100 | 4 hours | 1.24 | 905 | 55.14 | 8,644 EUR | -2,716 |
| S&P 500 | 4 hours | 1.22 | 863 | 50.29 | 2,118 EUR | -682 |
| Dow Jones | 30 min | 1.16 | 1,641 | 27.24 | 17,372 EUR | -8,859 |
| Dow Jones | 4 hours | 1.15 | 298 | 48.66 | 7,615 EUR | -6,958 |
| DAX 40 | 4 hours | 1.15 | 854 | 53.40 | 7,412 EUR | -2,818 |
| Gold | 5 min | 1.14 | 3,141 | 13.53 | 1,588 EUR | -745 |
| Dow Jones | 1 hour | 1.08 | 941 | 32.20 | 7,342 EUR | -5,710 |
| GBP/USD | 4 hours | 1.07 | 2,054 | 64.95 | 2,456 USD | -2,275 |
| EUR/USD | 5 min | 1.00 | 6,366 | 29.04 | -1,346 USD | -40,289 |
| Silver | 30 min | 0.82 | 5,310 | 32.20 | -46,708 USD | -51,178 |
| CAC 40 | Daily | n/a | 375 | 68.27 | 1,990 EUR | -1,678 |
Charts
Above 1.0 made money, below 1.0 lost money.
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.
// ============================================================ // Smoothed Bollinger // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long & short // Timeframe tested: Daily // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = true DEFPARAM PreloadBars = 10000 // --- Parameters --- positionSize = 1 // contracts per trade trendFilterOn = 1 // 1 = only trade with the long-term average, 0 = off trailingOn = 1 // 1 = use the ATR-scaled trailing stop, 0 = off stopLossPct = 5 // protective stop, percent of entry price takeProfitPct = 10 // profit target, percent of entry price longTrailFactor = 9 // trailing distance for longs, in scaled ATR units shortTrailFactor = 4 // trailing distance for shorts, in scaled ATR units atrTrailPeriod = 200 // ATR length for the trailing distance minTrailPoints = 5 // minimum trailing distance maxLosingBarsLong = 16 // close a losing long after this many bars maxLosingBarsShort = 2 // close a losing short after this many bars trendPeriod = 220 // trend filter SMA length bandPeriod = 17 // %b standard deviation and average length temaPeriod = 8 // TEMA smoothing length oversoldLevel = 30 // buy when %b is below this overboughtLevel = 90 // sell short when %b is above this // --- Indicators --- // ATR of a scaled price series, kept exactly as the tested code computes it. atrTrail = AverageTrueRange[atrTrailPeriod]((close/10)*PipSize)/1000 longTrailDistance = round(atrTrail*longTrailFactor) shortTrailDistance = round(atrTrail*shortTrailFactor) trendMA = Average[trendPeriod](close) trendUp = (close > trendMA OR NOT trendFilterOn) trendDown = (close < trendMA OR NOT trendFilterOn) // Heikin-Ashi style close, fed through a zero-lag TEMA. // The second term of haOpen has no /4, exactly as in the tested code. haOpen = ((Open[1]+High[1]+Low[1]+Close[1])/4 + (Open[2]+High[2]+Low[2]+Close[2]))/2 haClose = ((Open+High+Low+Close)/4 + haOpen + max(high, haOpen) + min(low, haOpen))/4 temaFirst = TEMA[temaPeriod](haClose) temaSecond = TEMA[temaPeriod](temaFirst) temaGap = temaFirst - temaSecond zeroLagHA = temaFirst + temaGap smoothedZeroLag = TEMA[temaPeriod](zeroLagHA) // Bollinger %b of the smoothed series. percentB = (smoothedZeroLag + 2*STD[bandPeriod](smoothedZeroLag) - WeightedAverage[bandPeriod](smoothedZeroLag)) / (4*STD[bandPeriod](smoothedZeroLag))*100
61 more lines: the entry and exit rules.
Read this first
Questions
Yes, with 1 contract and one position at a time. The rewritten code has not been compile checked.
Indices, gold, silver and currency pairs from 2 minutes to daily, and all but two runs were profitable. Dow Jones Daily made EUR 18,609.30 with a profit factor of 1.41.
On Nasdaq 100 Daily the maximum drawdown was EUR 3,077.50 against EUR 13,584.40 net profit.
The 220-day trend filter and percent based stops fit daily bars best. The daily index runs had higher profit factors than most intraday runs.
Related
Copy trading on US indices is available to ProRealAlgos members as spots open.