OPEN-SOURCE SCRIPT
Momentum Bands | Breakout

This strategy hunts for N-bar breakouts confirmed by volume expansion — but instead of trading every breakout blindly (like a standard Opening Range or Donchian breakout), it runs price through a trend filter and an RSI momentum check first. Breakouts that align with the EMA trend and show accelerating RSI get traded as genuine continuation moves. Breakouts that fire against the prevailing trend, with RSI already rolling over, get treated as exhaustion — and faded instead of chased. Built-in ATR-based position sizing and a trailing stop round it out into a complete, risk-managed system rather than just a signal generator.
Key Features
How It Works
Tips
Key Features
- Trend-gated entries — EMA fast/slow cross defines regime; longs only trade with the trend, fades only trade against it
- Volume-confirmed breakouts — requires expansion above the rolling volume average, not just a price poke
- RSI momentum-exhaustion filter — distinguishes accelerating momentum (real breakout) from divergence (fakeout)
- ATR-based risk sizing — position size auto-scales to a fixed % of equity risked, using ATR-derived stop distance
- ATR trailing stop — lets winners run instead of capping them at a fixed target
- Glowing ATR bands — layered, fading visual bands around trend basis for at-a-glance regime read
- Breakout candle highlighting — candles color-shift on signal and while a position is open
- Live + archived trailing-stop path — see the stop while a trade is open, and its full trail once closed
How It Works
- Price breaks above the highest high of the last N bars with volume above its rolling average — that's the breakout trigger.
- EMA fast vs. slow defines trend direction.
- RSI and its rate of change are checked at the breakout bar: still climbing and near its own recent peak = momentum confirms. Already fading or below its recent peak = momentum diverges.
- Confirmed + with-trend → long. Diverging + against-trend → short (fade).
- Every entry is sized off account risk %, not a fixed share count, and exits on an ATR stop plus ATR trailing stop.
Tips
- Backtest across multiple symbols and volatility regimes before trusting the defaults — breakout/fade systems behave very differently in trending vs. choppy markets
- Widen nLen (breakout lookback) on lower timeframes to reduce noise-driven false breakouts
- If fades are underperforming, try disabling allowShorts and running long-only to isolate performance
- Tighten rsiConfirmLvl for higher-conviction (fewer, cleaner) long signals
- Use the glowing bands as a quick visual regime check even when not actively watching signals
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.