HorizonAI
StrategyPro

Swing Breakout

A complete breakout trading strategy that waits for swing structure confirmation before entry. Includes automatic stop loss placement at structure, take profit targets, and risk/reward calculation. Perfect for momentum traders.

Full Source Code
Alert Templates
Build on with HorizonAI

What's Included

Structure-confirmed breakouts only
Automatic SL at swing structure
Multiple TP targets
Risk/reward ratio display
Entry, SL, TP alerts
Backtest-ready strategy

How Swing Breakout works

A swing breakout strategy trades the moment price pushes decisively beyond a prior swing high or swing low. Those swing points mark where the market last turned, so a clean break through them signals that buyers or sellers have overwhelmed the level and momentum is shifting in that direction. The break is the event the strategy is built around.

Confirmation is what separates a real breakout from a false one. Rather than entering the instant price ticks past a level, the approach waits for evidence such as a candle closing beyond the swing, a retest that holds, or momentum agreeing with the move. This filtering reduces the number of fakeouts that trap breakout traders.

Risk is defined by the structure itself. Stops are placed back beyond the broken swing, so if price reclaims the level the idea is cleanly invalidated, and targets are set at a defined risk-reward multiple or at the next structural level. Framing every trade this way keeps losses bounded and makes results measurable over a series of trades.

When to use it

  • Trading momentum continuation when price breaks a swing point in the direction of the larger trend
  • Entering on a confirmed break or a successful retest rather than the first touch of a level
  • Defining stops at the reclaimed swing so invalidation is objective
  • Targeting the next structural level or a fixed risk-reward multiple for consistent trade management

When it's not the right tool

  • In tight ranges where breakouts frequently fail and reverse back inside the range
  • Against a strong higher-timeframe trend, where counter-trend breakouts have a lower success rate
  • Around major news releases, when spikes can trigger entries and stops on the same move

Source Code Preview

Get the full PineScript v6 source code—use it as a foundation and build on top of it with HorizonAI.

swing-breakout.pine
1//@version=6
2indicator("Swing Breakout", overlay=true)
3// ─────────────────────────────────────
4// Swing Breakout - Full Source Code
5// ─────────────────────────────────────
6
7// Input Settings
8pivotLen = input.int(5, "Pivot Length")
9showLabels = input.bool(true, "Show Labels")
10
11// Core Logic
12pivotHigh = ta.pivothigh(high, pivotLen, pivotLen)
13pivotLow = ta.pivotlow(low, pivotLen, pivotLen)
14
15// Structure Detection
16var float lastHigh = na
17var float lastLow = na
18
19if not na(pivotHigh)
20 lastHigh := pivotHigh
21 // ... more logic
22
23// Break of Structure
24bosUp = close > lastHigh

200+ lines of source code

Unlock premium to access the full source code

Unlock Source Code

Frequently asked questions

How is a swing breakout different from a simple breakout?

A generic breakout can be any level, but a swing breakout specifically targets prior swing highs and lows, the points where price last reversed. Because those levels carry structural meaning and often hold resting orders, breaking them is more significant than breaking an arbitrary line. The strategy ties entries, stops and targets to that structure.

How do I avoid false breakouts?

The main defense is confirmation. Waiting for a candle to close beyond the swing, or for a retest that holds, filters out many spikes that immediately reverse. No method removes false breakouts entirely, which is why stops beyond the reclaimed level are essential.

Where should stops and targets go?

Stops typically sit just beyond the swing that was broken, so a reclaim invalidates the trade with a small, defined loss. Targets are commonly set at the next structural swing level or at a fixed risk-reward ratio. Anchoring both to structure keeps each trade objective and repeatable.

What timeframe suits swing breakout trading?

It works across timeframes, though higher timeframes such as the 1-hour and above tend to produce cleaner, more reliable swing breaks with less noise. Lower timeframes offer more setups but more fakeouts. Choose one that matches your risk tolerance, and remember nothing here is financial advice.

Get access to all 23+ scripts

Full source code, alert templates, and the perfect base to build on with HorizonAI. Join 10,000+ traders.