The system buys short pullbacks inside an uptrend: price above the 100-period SMA, the 20 SMA above the 200 SMA, and Bollinger %B (5, 1) under 0.2 for two bars. It sells when %B crosses above 1.
Best run of 11. Silver, 1 hour, spread 2, from run pf:2026-09-24-SILVER-1h.tsv:1.
| Period | Up to 2026-09-25 |
| Instrument | Silver, 1 hour |
| Spread | 2 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 Shares per trade | 1 |
| bandPeriod Bollinger band length | 5 |
| bandWidth Band width in standard deviations | 1 |
| trendPeriod Close must be above this average | 100 |
| fastPeriod Fast trend average | 20 |
| slowPeriod Slow trend average | 200 |
| entryLevel %B dip level | 0.2 |
| exitLevel %B exit level | 1 |
Every run
| Market | Timeframe | PF | Trades | Win % | Net | Max DD |
|---|---|---|---|---|---|---|
| SilverBest run | 1 hour | 5.43 | 3,202 | 57.90 | 552,570 USD | -18,577 |
| Nasdaq 100 | Daily | 1.94 | 440 | 67.50 | 11,379 EUR | -2,667 |
| S&P 500 | Daily | 1.70 | 575 | 58.43 | 2,596 EUR | -551 |
| Nikkei 225 | Daily | 1.57 | 330 | 69.70 | 26,975 USD | -5,510 |
| US Crude Oil | Daily | 1.57 | 295 | 69.15 | 10,773 EUR | -2,032 |
| Dow Jones | Daily | n/a | 530 | 71.70 | 16,362 EUR | -4,773 |
| DAX 40 | Daily | n/a | 493 | 69.78 | 10,886 EUR | -3,131 |
| Dow Jones | 4 hours | n/a | 345 | 71.88 | 7,869 EUR | -2,475 |
| Dow Jones | 1 hour | n/a | 1,176 | 70.75 | 4,718 EUR | -3,732 |
| FTSE 100 | Daily | n/a | 388 | 69.07 | 3,703 EUR | -1,229 |
| S&P 500 | 4 hours | n/a | 1,113 | 71.07 | 1,152 EUR | -597 |
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.
// ============================================================ // Percent B Bollinger Trend // ProRealAlgos Strategy Library | prorealalgos.com // Type: Mean reversion // Direction: Long only // Timeframe tested: 1 hour // ============================================================ // --- Settings --- DEFPARAM CumulateOrders = false DEFPARAM PreloadBars = 10000 // --- Parameters --- positionSize = 1 // shares per trade bandPeriod = 5 // Bollinger band length bandWidth = 1 // band width in standard deviations trendPeriod = 100 // close must be above this average fastPeriod = 20 // fast average of the trend filter slowPeriod = 200 // slow average of the trend filter entryLevel = 0.2 // %B below this counts as a dip exitLevel = 1 // %B crossing above this closes the trade // --- Indicators --- lowerBand = Average[bandPeriod](close) - bandWidth * STD[bandPeriod](close) upperBand = Average[bandPeriod](close) + bandWidth * STD[bandPeriod](close) percentB = (close - lowerBand) / (upperBand - lowerBand) trendMA = Average[trendPeriod](close) fastMA = Average[fastPeriod](close) slowMA = Average[slowPeriod](close)
14 more lines: the entry and exit rules.
Read this first
Questions
Yes, it is long only with a position size of 1, placed in shares as published. The rewritten code has not been compile checked.
All 10 listed runs were profitable. Nasdaq 100 Daily had a profit factor of 1.94 and Nikkei 225 Daily 1.57 with USD 26,974.80 net profit.
On Silver 1 hour the maximum drawdown was USD 18,577.00 against USD 552,570.00 net profit, trading 1 unit.
A short band reacts to dips that last a day or two, while the 100 and 200 SMA filters keep the system on the side of the bigger trend.
Related
The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.