Appearance

Personalize your experience

Mode
Accent Color
Direction
MarketplacestrategiesCompression Release
QuaScript

Compression Release

Free

Ranked compression release with regression thrust

0.0(0)
0 installs 0 0 comments
Q
159 listings

The QuaTick team's QuaScript analyses, run by the native C++ engine.

View Profile
quascriptstrategyvolatilitycompressionbreakout
Free
Backtest this strategy Open in QuaTick IDE Edit in IDE
Version
Updated
Compatible

Live engine preview

QuaScriptQuaScript

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.

Compression Releaseengine result
Loading the engine result…
quatick-charts · QuaScript engine on synthetic 1-minute bars · drag to pan · scroll to zoom · Run executes the script on the engine (⌘/Ctrl+Enter while editing)

About

Trades the expansion that follows a ranked volatility compression. Compression is the mean of two percentile ranks (Bollinger width and short-term range against ATR); a release is the first bar the score leaves the compressed zone, and the side comes from the slope of a short regression measured in ATR per bar, so only directional releases are traded. Entry: compression release with thrust beyond the threshold. Exit: stop at the compression range's far side, target `reward` R, trailing after 1R, time stop. Risk: 1 % per trade.


Settings

Width length: 20

Rank window: 250

Compressed above: 80

Thrust length: 12

Release thrust (ATR / bar): 0.08

Target (R): 2.5

Maximum bars held: 60


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

  • ▸ compression release with thrust beyond the threshold

Exit Conditions

  • ▸ stop at the compression range's far side, target `reward` R, trailing after 1R, time stop

Measured backtest

BTCUSDT 1h (Binance), 2025-11-01 to 2026-11-01 · backtest engine, script costs included

Backtest this strategy

-4.9%

Return

-0.43

Sharpe

-17.4%

Max DD

40.9%

Win Rate

71

Trades

MarketTradesReturnSharpeMax DDWin rateProfit factor
BTCUSDT 1h71-4.9%-0.43-17.4%40.9%0.88
ETHUSDT 1h62-4.2%-0.33-13.1%33.9%0.89

Past results on historical data do not predict future returns.

Source Code

Edit in IDE
quascript
1strategy "Compression Release" {
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/// Trades the expansion that follows a ranked volatility compression. Compression is the mean of
12/// two percentile ranks (Bollinger width and short-term range against ATR); a release is the first
13/// bar the score leaves the compressed zone, and the side comes from the slope of a short
14/// regression measured in ATR per bar, so only directional releases are traded.
15/// Entry: compression release with thrust beyond the threshold. Exit: stop at the compression
16/// range's far side, target `reward` R, trailing after 1R, time stop.
17/// Risk: 1 % per trade.
18use "viz/premium" as pr
19len = param.int(20, title = "Width length", min = 5, max = 200, group = "Compression")
20rank_len = param.int(250, title = "Rank window", min = 50, max = 2000, group = "Compression")
21tight = param.float(80, title = "Compressed above", min = 50, max = 99, group = "Compression")
22th_len = param.int(12, title = "Thrust length", min = 3, max = 100, group = "Thrust")
23th_min = param.float(0.08, title = "Release thrust (ATR / bar)", min = 0, max = 1, step = 0.01, group = "Thrust")
24reward = param.float(2.5, title = "Target (R)", min = 0.5, max = 10, step = 0.1, group = "Risk")
25hold = param.int(60, title = "Maximum bars held", min = 2, max = 1000, group = "Risk")
26bbw = ta.bollinger_width(close, len, 2)
27range_ratio = ta.sma(ta.true_range(), 5) / math.max(ta.atr(len * 5), 1e-12)
28score = 100 - (stat.percent_rank(bbw, rank_len) + stat.percent_rank(range_ratio, rank_len)) / 2
29(_, slope, _) = stat.linreg(close, th_len, 0)
30a = ta.atr(len)
31thrust = slope / math.max(a, 1e-12)
32compressed = score >= tight
33box_hi = ta.highest(high, len)
34box_lo = ta.lowest(low, len)
35released = compressed[1] and not compressed
36flat = position.size == 0
37if flat and released and thrust > th_min {
38 order.market("L", side.long)
39 exit.bracket("L exit", entry = "L", stop = box_lo, target = close + (close - box_lo) * reward, trail_offset = close - box_lo, trail_trigger = close + (close - box_lo))
40}
41if flat and released and thrust < -th_min {
42 order.market("S", side.short)
43 exit.bracket("S exit", entry = "S", stop = box_hi, target = close - (box_hi - close) * reward, trail_offset = box_hi - close, trail_trigger = close - (box_hi - close))
44}
45if position.size != 0 and position.bars_held >= hold { exit.close_all() }
46risk.max_drawdown(25)
47ph = render.line(box_hi, "Range high", color = color.translucent(color.violet.300, compressed ? 20 : 70), width = 1)
48plo = render.line(box_lo, "Range low", color = color.translucent(color.violet.300, compressed ? 20 : 70), width = 1)
49render.band(ph, plo, color = color.translucent(color.violet.500, compressed ? 82 : 98), opacity = 1, title = "Compression box")
50render.mark(released and thrust > th_min, shape = shape.arrow_up, at = anchor.below_bar, color = color.cyan.300, text = "Release", title = "Release up")
51render.mark(released and thrust < -th_min, shape = shape.arrow_down, at = anchor.above_bar, color = color.pink.300, text = "Release", title = "Release down")
52persist t = draw.table.create(anchor.top_right, 4, 2)
53if bar.is_last {
54 pr.heading(t, 2, "Compression Release", "Strategy · ranked squeeze, regression thrust")
55 pr.row(t, 2, "Compression score", str.format("{:.0f}", score), compressed ? color.violet.300 : color.white)
56 pr.row(t, 3, "Thrust", str.format("{:+.3f} ATR / bar", thrust), thrust > 0 ? pr.BULL : pr.BEAR)
57}
58 
Read-only preview. Open in the QuaTick IDE to edit and deploy.

Reviews

No reviews yet. Be the first to review this listing.

Discussion

Sign in to join the discussion. Your posts and replies show up on your profile.