Join today
Strategies / Mean reversion / Percent B Bollinger Trend

Percent B Bollinger Trend: Pullbacks Inside a Rising Market

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.

Mean reversionLong onlySwingSilver1 hour
5.43Profit factor
552,570Net profit USD
57.90%Win rate
3,202Trades
-18,577Max drawdown
173Avg trade

Best run of 11. Silver, 1 hour, spread 2, from run pf:2026-09-24-SILVER-1h.tsv:1.

Entry rules, long

  1. Close is above the 100-period SMA
  2. The 20-period SMA is above the 200-period SMA
  3. Members only

Exit rules

  1. Members only
  2. No stop loss or target

Test conditions

PeriodUp to 2026-09-25
InstrumentSilver, 1 hour
Spread2 points
Contracts1
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-09-25

Parameters

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

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
SilverBest run1 hour5.43 3,20257.90552,570 USD-18,577
Nasdaq 100Daily1.94 44067.5011,379 EUR-2,667
S&P 500Daily1.70 57558.432,596 EUR-551
Nikkei 225Daily1.57 33069.7026,975 USD-5,510
US Crude OilDaily1.57 29569.1510,773 EUR-2,032
Dow JonesDailyn/a 53071.7016,362 EUR-4,773
DAX 40Dailyn/a 49369.7810,886 EUR-3,131
Dow Jones4 hoursn/a 34571.887,869 EUR-2,475
Dow Jones1 hourn/a 1,17670.754,718 EUR-3,732
FTSE 100Dailyn/a 38869.073,703 EUR-1,229
S&P 5004 hoursn/a 1,11371.071,152 EUR-597

Charts

Results by run

Profit factor by run

Above 1.0 made money, below 1.0 lost money.

0.02.55.07.5101.0 = break-evenSilver · 1 hour5.43Nasdaq 100 · Daily1.94S&P 500 · Daily1.70Nikkei 225 · Daily1.57US Crude Oil · Daily1.57

Net profit against max drawdown

Net profitMax drawdown
0-20K-10K500K1.0MSilver · 1 hourNikkei 225 · DailyDow Jones · DailyNasdaq 100 · DailyDAX 40 · DailyUS Crude Oil · DailyDow Jones · 4 hoursDow Jones · 1 hourFTSE 100 · DailyS&P 500 · DailyS&P 500 · 4 hours

The code

ProBuilder, rewritten to house standard

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

Known weaknesses

  • There is no stop loss, so a pullback that turns into a crash is held until %B crosses 1.
  • The Silver 1 hour result of USD 552,570.00 is far larger than any other run, so one market drives the headline numbers.
  • It only trades long. Profit factor is missing for most runs, which only have sweep data.

Indicators used

Bollinger BandsSMA

How to load it

  1. Copy the code with the copy button above the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Questions

About this strategy

Can I run it in ProOrder?

Yes, it is long only with a position size of 1, placed in shares as published. The rewritten code has not been compile checked.

How did it do on other instruments?

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.

What drawdown came with the best run?

On Silver 1 hour the maximum drawdown was USD 18,577.00 against USD 552,570.00 net profit, trading 1 unit.

Why use a 5-period %B?

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

Strategies like this one

Bollinger Squeeze

Uses the same indicator.

14.30 PF · 86 trades

Stochastic Extreme Reversal

Best run on the same market, Silver.

3.94 PF · 974 trades

Dip In Uptrend

A similar profit factor.

5.49 PF · 54 trades

Buying pullbacks in trends? Come see the rest of our tests. Join the waitlist.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs