Indicator · Pine Script v5 · Own pane

ATR Expansion with Trend

by quantxaashish

This indicator identifies potential bullish breakout opportunities by detecting volatility expansions in the direction of an established trend.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code11
Settings2inputs
LicenceMIT
Last update12 days ago16 Oct 2026

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 indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

11 lines of Pine Script v5 from backend/app/pine/examples/atr_expansion.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

atr_expansion.pine
//@version=5
indicator("ATR expansion with trend")
atrLen = input.int(14, title="atr_length")
maLen = input.int(50, title="trend_ma")
a = ta.atr(atrLen)
expanding = a > 1.5 * ta.sma(a, atrLen)
trendUp = close > ta.sma(close, maLen)
bigBar = (high - low) > 1.2 * a
fire = expanding and trendUp and bigBar and close > open
alertcondition(fire, title="atr_expansion_up")
plotshape(fire, title="long", location=location.belowbar)

Overview

ATR Expansion with Trend calculates the Average True Range (ATR) and determines if volatility is expanding by comparing ATR to its moving average. A signal fires when ATR expands, price trades above a trend moving average, the current bar range is significantly larger than the ATR, and the candle closes green. It plots long signals below the bar and provides alert functionality. The user can adjust the ATR period and trend moving average length. It does not include exit rules or stop loss levels.

Details

Published by

quantxaashish on GitHub

Type

Indicator, Pine Script v5

Draws

Separate pane below the chart

Category

Trend, Volatility & bands, Breakout

Markets

Stocks

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
atr_lengthint14atrLen
trend_maint50maLen
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

EMA Breakout

by jerryinyang
5 stars

This indicator calculates and plots the exponential moving average on the chart, along with Keltner Channel bands. It applies optional filters based on Keltner Channel and Money Flow to identify breakout signals. Breakouts occur when price crosses the EMA with

Indicator v4 TrendMoving averages
Updated 2 years ago · None stated GitHub repository of EMA Breakout
114 stars

This indicator adapts Michael Chalek's Dual Thrust trading concept to plot breakout levels and overlay bands directly on the price chart. It calculates lookback ranges based on historical price action and provides two algorithmic variations along with multiple

Indicator v4 TrendBreakout Repaints
Updated 1 year ago · None stated GitHub repository of Dual Thrust Trading Algorithm

The Market Tradability Engine calculates multi-factor tradability, balance, compression, and direction scores to evaluate market regime quality. It classifies market conditions into eight distinct states, including Balance, Compression, Ready, Breakout, Trend,

Indicator v6 TrendVolatility & bands
Updated yesterday · MIT GitHub repository of Market Tradability Engine [WavesUnchained]

GainzAlgo V2 Alpha

by Bakomebandias
8 stars

This overlay indicator scores breakouts of recent highs and lows against failed-breakout checks, EMA trend alignment, RSI momentum, and an ATR volatility band. It plots green buy and red sell labels when conditions pass a minimum score, and it prints ATR-based

Indicator v6 TrendOscillators & momentum
Updated 6 months ago · None stated GitHub repository of GainzAlgo V2 Alpha
3 stars

Greeffer's Long Study calculates Donchian Channels alongside a volume moving average filter to generate trade signals. When price touches the lower or upper channel boundaries combined with volume exceeding a custom moving average multiplier, the indicator tri

Indicator v4 TrendVolatility & bands
Updated 4 years ago · CC0-1.0 GitHub repository of Greeffer's Long Study

Bollinger Bands

by Web3Degenerate
2 stars

This overlay indicator plots customized asymmetrical Bollinger Bands on the price chart to detect breakout trade signals. It calculates a middle simple moving average and standard deviation bands using separate standard deviation multipliers for upper and lowe

Indicator v5 Volatility & bandsBreakout
Updated 2 years ago · None stated GitHub repository of Bollinger Bands

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers