Appearance
Personalize your experience
VWAP Deviation Reversion
FreeFades quiet stretches from session VWAP
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 stretches away from the session VWAP measured in volume-weighted standard deviations, but only on low relative volume: a stretch made without participation tends to snap back, a stretch on heavy volume is often the start of a trend and is left alone. Entry: close beyond the 2-sigma VWAP band, relative volume below the limit, and a reversal bar. Exit: target at VWAP, stop beyond the 3-sigma band (at least 1 ATR away), flat at the session change. Risk: 1 % per trade.
Settings
Entry band (sigma): 2
Stop band (sigma): 3.2
Maximum relative volume: 1.2
Relative volume window: 48
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
- ▸ close beyond the 2-sigma VWAP band, relative volume below the limit, and a reversal bar
Exit Conditions
- ▸ target at VWAP, stop beyond the 3-sigma band (at least 1 ATR away), flat at the session change
Measured backtest
BTCUSDT 1h (Binance), 2025-11-01 to 2026-11-01 · backtest engine, script costs included
-24.7%
Return
-4.61
Sharpe
-25.1%
Max DD
26.5%
Win Rate
313
Trades
| Market | Trades | Return | Sharpe | Max DD | Win rate | Profit factor |
|---|---|---|---|---|---|---|
| BTCUSDT 1h | 313 | -24.7% | -4.61 | -25.1% | 26.5% | 0.42 |
| ETHUSDT 1h | 448 | -24.6% | -3.36 | -25.5% | 29.9% | 0.58 |
Past results on historical data do not predict future returns.
Source Code
Edit in IDE| 1 | strategy "VWAP Deviation Reversion" { |
| 2 | overlay = true |
| 3 | capital = 100000 |
| 4 | commission = 0.05 |
| 5 | slippage = 1 |
| 6 | sizing = risk_percent |
| 7 | max_leverage = 1 |
| 8 | size = 1 |
| 9 | pyramiding = 1 |
| 10 | } |
| 11 | /// Fades stretches away from the session VWAP measured in volume-weighted standard deviations, but |
| 12 | /// only on low relative volume: a stretch made without participation tends to snap back, a stretch |
| 13 | /// on heavy volume is often the start of a trend and is left alone. |
| 14 | /// Entry: close beyond the 2-sigma VWAP band, relative volume below the limit, and a reversal bar. |
| 15 | /// Exit: target at VWAP, stop beyond the 3-sigma band (at least 1 ATR away), flat at the session change. |
| 16 | /// Risk: 1 % per trade. |
| 17 | use "viz/premium" as pr |
| 18 | k_in = param.float(2.0, title = "Entry band (sigma)", min = 0.5, max = 4, step = 0.1, group = "Bands") |
| 19 | k_stop = param.float(3.2, title = "Stop band (sigma)", min = 1, max = 6, step = 0.1, group = "Bands") |
| 20 | rv_max = param.float(1.2, title = "Maximum relative volume", min = 0.3, max = 5, step = 0.1, group = "Filter") |
| 21 | rv_len = param.int(48, title = "Relative volume window", min = 5, max = 1000, group = "Filter") |
| 22 | (vw, up1, dn1) = ta.vwap(bar.typical, "day", 1) |
| 23 | sdv = up1 - vw |
| 24 | rv = volume / math.max(ta.sma(volume, rv_len), 1e-12) |
| 25 | quiet = rv < rv_max |
| 26 | a = ta.atr(20) |
| 27 | long_sig = close[1] < vw[1] - k_in * sdv[1] and close > open and quiet |
| 28 | short_sig = close[1] > vw[1] + k_in * sdv[1] and close < open and quiet |
| 29 | flat = position.size == 0 |
| 30 | if flat and long_sig { |
| 31 | order.market("L", side.long) |
| 32 | exit.bracket("L exit", entry = "L", stop = math.min(vw - k_stop * sdv, close - a), target = vw) |
| 33 | } |
| 34 | if flat and short_sig { |
| 35 | order.market("S", side.short) |
| 36 | exit.bracket("S exit", entry = "S", stop = math.max(vw + k_stop * sdv, close + a), target = vw) |
| 37 | } |
| 38 | dom = time.day(time) |
| 39 | if dom != dom[1] and position.size != 0 { exit.close_all() } |
| 40 | risk.max_drawdown(25) |
| 41 | pu = render.line(vw + k_in * sdv, "Upper band", color = color.translucent(color.rose.300, 45), width = 1) |
| 42 | pv = render.line(vw, "VWAP", color = color.amber.300, width = 2) |
| 43 | pd = render.line(vw - k_in * sdv, "Lower band", color = color.translucent(color.emerald.300, 45), width = 1) |
| 44 | render.band(pu, pv, texture = "gradient", direction = "edges", upper_color = color.rose.500, lower_color = color.slate.900, opacity = 0.16, title = "Rich zone") |
| 45 | render.band(pv, pd, texture = "gradient", direction = "edges", upper_color = color.slate.900, lower_color = color.emerald.500, opacity = 0.16, title = "Cheap zone") |
| 46 | persist t = draw.table.create(anchor.top_right, 4, 2) |
| 47 | if bar.is_last { |
| 48 | pr.heading(t, 2, "VWAP Deviation Reversion", "Strategy · quiet stretches") |
| 49 | pr.row(t, 2, "Deviation", str.format("{:+.2f} sigma", (close - vw) / math.max(sdv, 1e-12)), color.white) |
| 50 | pr.row(t, 3, "Relative volume", str.format("{:.2f}", rv), quiet ? pr.BULL : pr.WARN) |
| 51 | } |
| 52 |
Reviews
No reviews yet. Be the first to review this listing.