Squeeze Breakout

Squeeze Breakout is a strategy that trades NAS100 on 15-minute bars. It holds at most 1 open trade and waits 200 bars before trading.

trade management

squeeze-breakout.abx
1strategy "Squeeze Breakout"
2market: NAS100
3bars: 15m
4max_open: 1
5warmup: 200
6
7bb = bollinger(close, 20, multiplier: 2.0)
8kc = keltner(close, 20, multiplier: 1.5)
9squeeze_on = bb.upper < kc.upper and bb.lower > kc.lower
10released = ends(squeeze_on)
11momentum_up = linreg_slope(close, 20) > 0
12
13when released and momentum_up and close > kc.upper:
14buy risk: 1%, stop: kc.middle, target: 2R:
15trail by: atr(14) * 2, after: 1R
16
17when released and not momentum_up and close < kc.lower:
18sell risk: 1%, stop: kc.middle, target: 2R:
19trail by: atr(14) * 2, after: 1R
20
21background orange.fade(90), when: squeeze_on
Watch it run · NAS100 · 15m bars
entrystoptargetexit

Sample data. Not a result. The real AlgoBarsX engine ran this exact script on made-up bars, and this replays what it drew and did. It shows no profit or loss, and it says nothing about how the script would do in a real market.

Replay of this script on 150 sample bars: 2 trades.

What this script says

Squeeze Breakout is a strategy that trades NAS100 on 15-minute bars. It holds at most 1 open trade and waits 200 bars before trading.

It calculates bb as the Bollinger Bands (source the close, length 20, multiplier 2.0), kc as the Keltner Channels (source the close, length 20, multiplier 1.5), squeeze_on as whether bb.upper is below kc.upper and bb.lower is above kc.lower, released as whether squeeze_on stops being true and momentum_up as whether the linreg slope (source the close, length 20) is above 0.

When released and momentum_up and the close is above kc.upper, it buys at market, risking 1% of the balance, with a stop at kc.middle and with a target 2R from the entry; once open, it trails the stop by 2 × the 14-bar ATR once the trade reaches 1R.

When released and not momentum_up and the close is below kc.lower, it sells at market, risking 1% of the balance, with a stop at kc.middle and with a target 2R from the entry; once open, it trails the stop by 2 × the 14-bar ATR once the trade reaches 1R.

On the chart, it shades the background when squeeze_on.

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account