Appearance

Personalize your experience

Mode
Accent Color
Direction
MarketplacestrategiesGolden Pocket Continuation
QuaScript

Golden Pocket Continuation

Free

Joins impulse legs from the 50 - 61.8 % retracement

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
quascriptstrategyfibonaccipullbackcontinuation
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.

Golden Pocket Continuationengine 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

Joins an impulse leg on its first deep retracement. The newest leg between two confirmed swings must be an impulse (at least `impulse` ATR long). When price then retraces into the 50 - 61.8 % band of that leg (the "golden pocket") and prints a bar that closes back in the leg's direction above the prior bar's high, the pullback is treated as finished. The stop sits beyond the 78.6 % level, where the leg's structure would be broken, and the first target is a retest of the leg's end with the remainder aimed at the 127.2 % extension. Entry: up-leg of `impulse` ATR or more, low inside the pocket, bullish close above the prior high (mirror for down-legs). Exit: stop beyond the 78.6 % level, half at the leg end, the rest at the 127.2 % extension; setup cancelled once price passes 78.6 %. Risk: 1 % per trade.


Settings

Swing bars left: 10

Swing bars right: 5

Minimum leg (ATR): 4


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

  • ▸ up-leg of `impulse` ATR or more, low inside the pocket, bullish close above the prior high (mirror for down-legs)

Exit Conditions

  • ▸ stop beyond the 78.6 % level, half at the leg end, the rest at the 127.2 % extension; setup cancelled once price passes 78.6 %

Measured backtest

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

Backtest this strategy

0.6%

Return

0.11

Sharpe

-15.3%

Max DD

44.3%

Win Rate

122

Trades

MarketTradesReturnSharpeMax DDWin rateProfit factor
BTCUSDT 1h1220.6%0.11-15.3%44.3%1.02
ETHUSDT 1h11410.3%0.94-9.4%44.7%1.29

Past results on historical data do not predict future returns.

Source Code

Edit in IDE
quascript
1strategy "Golden Pocket Continuation" {
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/// Joins an impulse leg on its first deep retracement. The newest leg between two confirmed swings
12/// must be an impulse (at least `impulse` ATR long). When price then retraces into the 50 - 61.8 %
13/// band of that leg (the "golden pocket") and prints a bar that closes back in the leg's direction
14/// above the prior bar's high, the pullback is treated as finished. The stop sits beyond the 78.6 %
15/// level, where the leg's structure would be broken, and the first target is a retest of the leg's
16/// end with the remainder aimed at the 127.2 % extension.
17/// Entry: up-leg of `impulse` ATR or more, low inside the pocket, bullish close above the prior
18/// high (mirror for down-legs). Exit: stop beyond the 78.6 % level, half at the leg end, the rest at
19/// the 127.2 % extension; setup cancelled once price passes 78.6 %. Risk: 1 % per trade.
20use "viz/premium" as pr
21left = param.int(10, title = "Swing bars left", min = 2, max = 50, group = "Swings")
22right = param.int(5, title = "Swing bars right", min = 1, max = 30, group = "Swings")
23impulse = param.float(4.0, title = "Minimum leg (ATR)", min = 1, max = 20, step = 0.5, group = "Swings")
24ph = ta.pivot_high(left, right)
25pl = ta.pivot_low(left, right)
26a = ta.atr(50)
27persist hi_p = na
28persist lo_p = na
29persist hi_x = 0
30persist lo_x = 0
31persist leg = 0
32if not math.is_na(ph) {
33 hi_p := ph
34 hi_x := bar.index - right
35 leg := hi_x > lo_x and not math.is_na(lo_p) ? 1 : leg
36}
37if not math.is_na(pl) {
38 lo_p := pl
39 lo_x := bar.index - right
40 leg := lo_x > hi_x and not math.is_na(hi_p) ? -1 : leg
41}
42span = hi_p - lo_p
43strong = span >= impulse * a
44// up-leg retracement levels measured down from the high; down-leg levels measured up from the low
45p50 = leg == 1 ? hi_p - span * 0.5 : lo_p + span * 0.5
46p618 = leg == 1 ? hi_p - span * 0.618 : lo_p + span * 0.618
47p786 = leg == 1 ? hi_p - span * 0.786 : lo_p + span * 0.786
48ext = leg == 1 ? hi_p + span * 0.272 : lo_p - span * 0.272
49persist armed = false
50if (not math.is_na(ph) or not math.is_na(pl)) { armed := strong and leg != 0 }
51if leg == 1 and low < p786 { armed := false }
52if leg == -1 and high > p786 { armed := false }
53go_l = armed and leg == 1 and low <= p50 and low >= p786 and close > open and close > high[1] and close < hi_p
54go_s = armed and leg == -1 and high >= p50 and high <= p786 and close < open and close < low[1] and close > lo_p
55flat = position.size == 0
56if flat and go_l {
57 stop = p786 - 0.25 * a
58 order.market("L", side.long)
59 exit.bracket("L half", entry = "L", stop = stop, target = hi_p, qty_pct = 50)
60 exit.bracket("L rest", entry = "L", stop = stop, target = ext)
61 armed := false
62}
63if flat and go_s {
64 stop = p786 + 0.25 * a
65 order.market("S", side.short)
66 exit.bracket("S half", entry = "S", stop = stop, target = lo_p, qty_pct = 50)
67 exit.bracket("S rest", entry = "S", stop = stop, target = ext)
68 armed := false
69}
70risk.max_drawdown(25)
71show = armed and strong
72z_top = render.line(show ? p50 : na, "Pocket 50 %", color = color.translucent(color.amber.300, 30), width = 1)
73z_bot = render.line(show ? p618 : na, "Pocket 61.8 %", color = color.translucent(color.amber.300, 30), width = 1)
74render.band(z_top, z_bot, texture = "gradient", upper_color = color.translucent(color.amber.300, 70), lower_color = color.translucent(color.orange.500, 70), opacity = 1, title = "Golden pocket")
75render.line(show ? p786 : na, "Invalidation 78.6 %", color = color.translucent(color.rose.400, 30), width = 1, stroke = style.dotted)
76render.line(show ? ext : na, "Extension 127.2 %", color = color.translucent(color.emerald.300, 40), width = 1, stroke = style.dashed)
77render.mark(go_l and flat, shape = shape.triangle_up, at = anchor.below_bar, color = color.amber.300, text = "GP", title = "Long from pocket")
78render.mark(go_s and flat, shape = shape.triangle_down, at = anchor.above_bar, color = color.orange.400, text = "GP", title = "Short from pocket")
79persist t = draw.table.create(anchor.top_right, 5, 2)
80if bar.is_last {
81 pr.heading(t, 2, "Golden Pocket Continuation", "Strategy · impulse retracement")
82 pr.row(t, 2, "Leg", leg == 1 ? str.format("Up {:.1f} ATR", span / a) : leg == -1 ? str.format("Down {:.1f} ATR", span / a) : "None", leg == 1 ? pr.BULL : leg == -1 ? pr.BEAR : pr.LABEL)
83 pr.row(t, 3, "Pocket", show ? str.format("{:.2f} .. {:.2f}", math.min(p50, p618), math.max(p50, p618)) : "Not armed", color.amber.300)
84 pr.row(t, 4, "Invalidation", show ? str.format("{:.2f}", p786) : "-", pr.BEAR)
85}
86 
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.