Strategy · Pine Script v5 · On the chart

Trend-Breakout System mit VIX Heatmap Gate

by NinjaEde

This strategy generates long entry signals by combining a Donchian Channel breakout with a moving average trend filter, volume confirmation, and a macro volatility regime gate based on CBOE VIX and VIX3M ratios.

View on GitHub

GitHub stars2on the repository
Pine versionv5runs as is
Lines of code80
Settings5inputs
LicenceMIT
Last update10 months ago24 Dec 2025

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new strategy, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart. The trades and results appear in the Strategy Tester tab; adjust the settings with the gear icon.

Source Code

80 lines of Pine Script v5 from Trend-Breakout System mit VIX Heatmap Gate.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

Trend-Breakout System mit VIX Heatmap Gate.pine
//@version=5
strategy(
    "Trend-Breakout System mit VIX Heatmap Gate",
    overlay=true,
    initial_capital=100000,
    default_qty_type=strategy.percent_of_equity,
    default_qty_value=10,
    pyramiding=0
)

// =====================
// VIX HEATMAP REGIME
// =====================
vix   = request.security("CBOE:VIX", timeframe.period, close)
vix3m = request.security("CBOE:VIX3M", timeframe.period, close)

ratio = vix / vix3m

score = 0
score += ratio < 0.98 ? 1 : 0
score += ratio < 0.95 ? 1 : 0
score += vix < 20 ? 1 : 0
score += vix < 15 ? 1 : 0

regimeOK = score >= 3

// =====================
// TREND FILTER
// =====================
maLen = input.int(50, "Trend MA")
ma    = ta.sma(close, maLen)

trendOK = close > ma and ma > ma[1]

// =====================
// BREAKOUT ENTRY
// =====================
donLen = input.int(20, "Donchian Lookback")
volLen = input.int(20, "Volume SMA")

donHigh   = ta.highest(high, donLen)
volOK     = volume > ta.sma(volume, volLen)

breakout = close > donHigh[1] and volOK

// =====================
// ENTRY
// =====================
if breakout and trendOK and regimeOK
    strategy.entry("Trend Breakout Long", strategy.long)

// =====================
// EXIT
// =====================
atrLen = input.int(14, "ATR Length")
atrMul = input.float(2.5, "ATR Multiplier")

atr = ta.atr(atrLen)

strategy.exit(
    "ATR Exit",
    from_entry="Trend Breakout Long",
    stop=close - atr * atrMul
)

// Regime kippt → sofort raus
if strategy.position_size > 0 and score < 2
    strategy.close("Trend Breakout Long")

// =====================
// VISUALS
// =====================
bgcolor(
     score >= 3 ? color.new(color.green, 85) :
     score == 2 ? color.new(color.yellow, 85) :
     color.new(color.red, 85)
)

plot(donHigh, "Donchian High", color=color.orange)
plot(ma, "MA50", color=color.blue)

Overview

Trend-Breakout System mit VIX Heatmap Gate enters long positions when prices break above the recent Donchian high, volume exceeds its moving average, price remains above a rising SMA, and the VIX regime score is favorable. Positions are exited using an ATR-based stop loss or closed if the VIX regime drops. The script plots the trend line, Donchian high, and background regime colors directly on the chart.

Details

Published by

NinjaEde on GitHub

Type

Strategy, Pine Script v5

Draws

On the price chart

Category

Trend, Breakout, Volatility & bands, Volume

Markets

Stocks, Indices

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Trend MAint50maLen
Donchian Lookbackint20donLen
Volume SMAint20volLen
ATR Lengthint14atrLen
ATR Multiplierfloat2.5atrMul
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

106 stars

This Pine v4 strategy draws on the price chart and filters breakouts with a fixed Supertrend, ATR length, volume moving-average markup, and moving-average alignment, plus short and long high-low periods. Trade direction defaults to long and can include shorts.

Strategy v4 BreakoutTrend
Updated 2 years ago · GPL-3.0 GitHub repository of Breakout Trend Trading - V1
1 stars

This strategy plots Donchian upper and lower channels along with the midpoint on the price chart. It generates long signals on a price crossover above the upper Donchian band when volume exceeds a moving average multiple if the filter is enabled, and short sig

Strategy v6 TrendBreakout
Updated 2 months ago · None stated GitHub repository of TN Sovereign Donchian Breakout
257 stars

This strategy plots VWMA-based Bollinger bands on the 1-minute ES futures price chart for volatility analysis and potential breakout identification. It calculates dynamic long and short stop loss and take profit levels using percentage inputs relative to entry

Strategy v6 Volatility & bandsSupport & resistance
Updated 6 weeks ago · None stated GitHub repository of V1.6 ES - Futures 1M No Repaint

均线突破交易系统

by tangly1024
76 stars

This strategy trades long breakouts of a fast and a slow moving average on the price chart. It opens a long position when price crosses above either average, using a percentage of equity as size. It reduces the position by a set share when the high reaches the

Strategy v5 TrendMoving averages
Updated 4 months ago · None stated GitHub repository of 均线突破交易系统
23 stars

This strategy evaluates breakout and trend opportunities on the price chart using a weighted composite score of volume, trend, and candlestick structure. It tracks volume spikes, fast and slow EMAs, higher-timeframe EMA trend alignment, opening ranges, and ses

Strategy v6 TrendVolume Repaints
Updated 3 weeks ago · Custom licence GitHub repository of TradingAlpha Point-Clip Strategy

VOL/BBW/RSI/15 Strategy

by SammyEnigma
18 stars

This strategy overlays Bollinger Bands on the price chart and trades a long squeeze setup. It enters long when band width is below 0.022 and volume is at least the seven-bar average, using a stop order at the lower band. It places a short order when close cros

Strategy v4 Volatility & bandsVolume
Updated 6 years ago · None stated GitHub repository of VOL/BBW/RSI/15 Strategy

More strategys

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers