OPEN-SOURCE SCRIPT
SPY ATR Bands

An all-in-one overlay that combines ATR-based deviation bands, all-time-high levels, and a weekly-EMA trend filter into a single clean tool. Built for swing dip-buying on SPY, but works on any symbol.
Features
• Multi-timeframe ATR bands (D / 4H / 1H) — Keltner-family bands built from an RMA centerline ± ATR × multiplier, with three depths each (narrow ×0.6 / main / wide ×1.5). Because they scale with ATR, a touch of the wide band means a statistically significant move relative to current volatility, not a fixed %. Lines are smoothed between higher-TF updates. Color-coded by TF (D / 4H / 1H), with optional narrow/wide layers.
• Intersection markers — A bubble is dropped at the deepest band touched within each incursion (narrow > main > wide), per timeframe. Instantly shows where price is interacting with each TF's volatility envelope.
• ATH line + pullback levels — Running all-time-high line plus −3 / −4 / −5 / −10 / −15 / −20 / −25% pullback levels (labels only). The ATH label shows price, days since the last ATH, and current trend-leg %. A live "Now" label shows price and exact % distance from the ATH (candle-colored).
• W EMA20 proxy (trend filter) — Approximates the weekly EMA20 on any timeframe (1H/Daily proxies, down to intraday) so you always see the higher-TF trend line. The line turns green when the last daily candle closes above it and red when it closes below — a clean bull/bear read. Includes a tolerance zone, an intersection marker, and an optional interpolation mode for a smooth line down to 5-minute charts.
• Built-in alerts — "Any intersection marker", "Lower-band touch (dip)", and "W EMA20 touch".
How to use
Watch for price tapping a lower band (oversold) while well below the ATH and above the W EMA20 line (trend intact). The deeper the band and the further from the ATH, the higher-conviction the pullback. The W EMA20 color tells you whether the broader regime is bullish or bearish.
Most colors, widths, tolerances and toggles are fully configurable in settings.
Not financial advice — for educational / technical-analysis use.
Features
• Multi-timeframe ATR bands (D / 4H / 1H) — Keltner-family bands built from an RMA centerline ± ATR × multiplier, with three depths each (narrow ×0.6 / main / wide ×1.5). Because they scale with ATR, a touch of the wide band means a statistically significant move relative to current volatility, not a fixed %. Lines are smoothed between higher-TF updates. Color-coded by TF (D / 4H / 1H), with optional narrow/wide layers.
• Intersection markers — A bubble is dropped at the deepest band touched within each incursion (narrow > main > wide), per timeframe. Instantly shows where price is interacting with each TF's volatility envelope.
• ATH line + pullback levels — Running all-time-high line plus −3 / −4 / −5 / −10 / −15 / −20 / −25% pullback levels (labels only). The ATH label shows price, days since the last ATH, and current trend-leg %. A live "Now" label shows price and exact % distance from the ATH (candle-colored).
• W EMA20 proxy (trend filter) — Approximates the weekly EMA20 on any timeframe (1H/Daily proxies, down to intraday) so you always see the higher-TF trend line. The line turns green when the last daily candle closes above it and red when it closes below — a clean bull/bear read. Includes a tolerance zone, an intersection marker, and an optional interpolation mode for a smooth line down to 5-minute charts.
• Built-in alerts — "Any intersection marker", "Lower-band touch (dip)", and "W EMA20 touch".
How to use
Watch for price tapping a lower band (oversold) while well below the ATH and above the W EMA20 line (trend intact). The deeper the band and the further from the ATH, the higher-conviction the pullback. The W EMA20 color tells you whether the broader regime is bullish or bearish.
Most colors, widths, tolerances and toggles are fully configurable in settings.
Not financial advice — for educational / technical-analysis use.
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.