Appearance
Personalize your experience
Bollinger Mean Reversion
FreeMean reversion from the Bollinger extremes
Live engine preview
The QuaScript engine's own output on the chart the terminal uses. Change the settings or edit the code and press Run to recompute it.
About
Fades closes outside the 2-sigma band when RSI agrees, but only while the Hurst exponent says the market is mean reverting. Exits at the basis or on a 3-sigma stop.
Settings
Band length: 20
Band width: 2
Max Hurst: 0.5
Measured backtests
Run by the backtest engine on public candles, 2025-11-01 to 2026-11-01, with the script's own commission and slippage, on BTCUSDT 1h (Binance) and ETHUSDT 1h (Binance). The figures per market are in the Measured backtest panel below. Past results do not predict future returns.
Backtest it yourself
Open it on the backtesting page to run it on any symbol, interval and date range, then use Monte Carlo, optimisation, walk-forward and robustness tests.
Strategy Rules
Entry Conditions
Exit Conditions
Measured backtest
BTCUSDT 1h (Binance), 2025-11-01 to 2026-11-01 · backtest engine, script costs included
-0.5%
Return
-0.15
Sharpe
-3.9%
Max DD
16.4%
Win Rate
61
Trades
| Market | Trades | Return | Sharpe | Max DD | Win rate | Profit factor |
|---|---|---|---|---|---|---|
| BTCUSDT 1h | 61 | -0.5% | -0.15 | -3.9% | 16.4% | 0.94 |
| ETHUSDT 1h | 61 | -5.6% | -1.15 | -7.8% | 9.8% | 0.51 |
Past results on historical data do not predict future returns.
Source Code
Edit in IDE| 1 | strategy "Bollinger Mean Reversion" { |
| 2 | overlay = true |
| 3 | capital = 50000 |
| 4 | commission = 0.04 |
| 5 | sizing = percent_equity |
| 6 | size = 50 |
| 7 | } |
| 8 | /// Fades closes outside the 2-sigma band when RSI agrees, but only while the Hurst exponent |
| 9 | /// says the market is mean reverting. Exits at the basis or on a 3-sigma stop. |
| 10 | len = param.int(20, title = "Band length", min = 5) |
| 11 | k = param.float(2.0, title = "Band width", min = 0.5, max = 5, step = 0.1) |
| 12 | h_max = param.float(0.5, title = "Max Hurst", min = 0.3, max = 0.7, step = 0.01) |
| 13 | |
| 14 | (mid, up, dn) = ta.bollinger(close, len, k) |
| 15 | sd = (up - mid) / k |
| 16 | r = ta.rsi(close, 14) |
| 17 | reverting = stat.hurst(close, 100) < h_max |
| 18 | if position.size == 0 and reverting { |
| 19 | if close < dn and r < 30 { |
| 20 | order.market("L", side.long) |
| 21 | exit.bracket("L exit", entry = "L", stop = mid - 3 * sd, target = mid) |
| 22 | } |
| 23 | if close > up and r > 70 { |
| 24 | order.market("S", side.short) |
| 25 | exit.bracket("S exit", entry = "S", stop = mid + 3 * sd, target = mid) |
| 26 | } |
| 27 | } |
| 28 | pu = render.line(up, "Upper", color = color.slate.500) |
| 29 | pd = render.line(dn, "Lower", color = color.slate.500) |
| 30 | render.line(mid, "Basis", color = color.amber.400) |
| 31 | render.band(pu, pd, color = color.sky.500, opacity = 0.06) |
| 32 | render.background(reverting ? na : color.translucent(color.slate.500, 92)) |
| 33 |
Reviews
No reviews yet. Be the first to review this listing.