Appearance
Personalize your experience
GARCH Sigma Breakout
Admin's ChoiceFreeTrades GARCH sigma events in the trend direction
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
Buys or sells genuine volatility events. A GARCH(1,1) forecast gives the expected one-bar move; a close beyond k forecast sigmas from the previous close, in the direction of the longer trend, is an event the model did not expect, and such events tend to start moves rather than end them. Entry: |close - previous close| above k GARCH sigmas, with the close on the trend side of the slow EMA. Exit: stop at the event bar's far side, target `reward` R, trailing after 1R. Risk: 1 % per trade. Method: Bollerslev (1986).
Settings
Alpha (shock weight): 0.06
Beta (persistence): 0.92
Event size (sigma): 2.5
Trend EMA: 200
Target (R): 2.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
- ▸ |close - previous close| above k GARCH sigmas, with the close on the trend side of the slow EMA
Exit Conditions
- ▸ stop at the event bar's far side, target `reward` R, trailing after 1R
Measured backtest
BTCUSDT 1h (Binance), 2025-11-01 to 2026-11-01 · backtest engine, script costs included
-14.4%
Return
-0.88
Sharpe
-19.9%
Max DD
26.2%
Win Rate
103
Trades
| Market | Trades | Return | Sharpe | Max DD | Win rate | Profit factor |
|---|---|---|---|---|---|---|
| BTCUSDT 1h | 103 | -14.4% | -0.88 | -19.9% | 26.2% | 0.81 |
| ETHUSDT 1h | 88 | 20.2% | 1.27 | -9.8% | 36.4% | 1.31 |
Past results on historical data do not predict future returns.
Source Code
Edit in IDE| 1 | strategy "GARCH Sigma Breakout" { |
| 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 | /// Buys or sells genuine volatility events. A GARCH(1,1) forecast gives the expected one-bar move; |
| 12 | /// a close beyond k forecast sigmas from the previous close, in the direction of the longer trend, |
| 13 | /// is an event the model did not expect, and such events tend to start moves rather than end them. |
| 14 | /// Entry: |close - previous close| above k GARCH sigmas, with the close on the trend side of the |
| 15 | /// slow EMA. Exit: stop at the event bar's far side, target `reward` R, trailing after 1R. |
| 16 | /// Risk: 1 % per trade. Method: Bollerslev (1986). |
| 17 | use "viz/premium" as pr |
| 18 | alpha = param.float(0.06, title = "Alpha (shock weight)", min = 0.01, max = 0.3, step = 0.01, group = "GARCH") |
| 19 | beta = param.float(0.92, title = "Beta (persistence)", min = 0.5, max = 0.99, step = 0.01, group = "GARCH") |
| 20 | k = param.float(2.5, title = "Event size (sigma)", min = 1, max = 6, step = 0.1, group = "Entry") |
| 21 | trend = param.int(200, title = "Trend EMA", min = 20, max = 1000, group = "Entry") |
| 22 | reward = param.float(2.5, title = "Target (R)", min = 0.5, max = 10, step = 0.1, group = "Risk") |
| 23 | (vol, _) = hft.garch(close, alpha, beta, 0) |
| 24 | sig = vol / 100 |
| 25 | s_prev = sig[1] |
| 26 | move = (close - close[1]) / math.max(close[1] * s_prev, 1e-12) |
| 27 | t = ta.ema(close, trend) |
| 28 | flat = position.size == 0 |
| 29 | up_ev = move > k and close > t |
| 30 | dn_ev = move < -k and close < t |
| 31 | if flat and up_ev { |
| 32 | stop = low |
| 33 | order.market("L", side.long) |
| 34 | exit.bracket("L exit", entry = "L", stop = stop, target = close + (close - stop) * reward, trail_offset = close - stop, trail_trigger = close + (close - stop)) |
| 35 | } |
| 36 | if flat and dn_ev { |
| 37 | stop = high |
| 38 | order.market("S", side.short) |
| 39 | exit.bracket("S exit", entry = "S", stop = stop, target = close - (stop - close) * reward, trail_offset = stop - close, trail_trigger = close - (stop - close)) |
| 40 | } |
| 41 | risk.max_drawdown(25) |
| 42 | pu = render.line(close[1] * (1 + k * s_prev), "Event high", color = color.translucent(color.orange.300, 50), width = 1) |
| 43 | pl = render.line(close[1] * (1 - k * s_prev), "Event low", color = color.translucent(color.sky.300, 50), width = 1) |
| 44 | render.band(pu, pl, color = color.indigo.400, opacity = 0.05, title = "Expected range") |
| 45 | render.line(t, "Trend EMA", color = color.amber.300, width = 1.5) |
| 46 | render.mark(up_ev, shape = shape.diamond, at = anchor.below_bar, color = color.orange.300, size = 0.6, title = "Up event") |
| 47 | render.mark(dn_ev, shape = shape.diamond, at = anchor.above_bar, color = color.sky.300, size = 0.6, title = "Down event") |
| 48 | persist tb = draw.table.create(anchor.top_right, 4, 2) |
| 49 | if bar.is_last { |
| 50 | pr.heading(tb, 2, "GARCH Sigma Breakout", "Strategy · volatility events") |
| 51 | pr.row(tb, 2, "Forecast sigma", str.format("{:.2%}", sig), color.white) |
| 52 | pr.row(tb, 3, "Last move", str.format("{:+.1f} sigma", move), math.abs(move) > k ? pr.WARN : color.white) |
| 53 | } |
| 54 |
Reviews
No reviews yet. Be the first to review this listing.