OPEN-SOURCE SCRIPT
Not-So-Average True Range (nsATR)

Not-So-Average True Range (nsATR)
By: Sherlock_MacGyver
This is not your grandpa’s ATR.
This is an intelligent, direction-aware volatility detection framework that reacts in real time to abnormal price movement — and it doesn’t just react… it adapts, it amplifies, and it knows which way price moved.
nsATR is built to replace the ancient [code]ta.rma(tr, len)[/code] formula entirely. Use it inside your indicators, strategies, or even position sizing formulas.
---
🧠 Core Logic:
---
🎨 Features:
---
🧬 Why It Matters:
Standard ATR treats all candles equally.
nsATR knows better.
It sees when the market's hiding a buildup, when it explodes, and which way it ran. And now — it shows you everything visually.
If you’re still using default ATR in 2025, you’re trading like it’s 1999.
This isn’t an upgrade. It’s an evolution.
nsATR: Smart. Adaptive. Directional. Real-Time.
💥 Volatility has never looked this good.
By: Sherlock_MacGyver
This is not your grandpa’s ATR.
This is an intelligent, direction-aware volatility detection framework that reacts in real time to abnormal price movement — and it doesn’t just react… it adapts, it amplifies, and it knows which way price moved.
nsATR is built to replace the ancient [code]ta.rma(tr, len)[/code] formula entirely. Use it inside your indicators, strategies, or even position sizing formulas.
---
🧠 Core Logic:
- Calculates a standard ATR as the baseline
- Detects "breaches" when the current candle’s True Range exceeds a smoothed ATR baseline × a multiplier
- When breached, applies a power transformation to the current candle’s range, amplifying the ATR output
- Optional smoothing can be applied after the logic to stabilize the output curve
- All breaches are analyzed for direction (up/down) and visualized accordingly
---
🎨 Features:
- Directional Breach Markers:
🟢 Green triangle (↓ below candle) = upward breach
🔴 Red triangle (↑ above candle) = downward breach - Directional Background Glow:
Paints the background in lime or red based on breach direction
Two toggles: one for the chart, one for the indicator pane - Dual ATR Visualization:
- Adaptive ATR (powered, responsive, breach-aware)
- Classic ATR (for side-by-side comparison) - Optional Smoothing for both ATR lines
Keeps curves clean without killing responsiveness - Real-Time Breach Alert:
Alerts fire as soon as a breach occurs — no need to wait for the bar to close
Perfect for higher timeframe candles when early entry matters
---
🧬 Why It Matters:
Standard ATR treats all candles equally.
nsATR knows better.
It sees when the market's hiding a buildup, when it explodes, and which way it ran. And now — it shows you everything visually.
If you’re still using default ATR in 2025, you’re trading like it’s 1999.
This isn’t an upgrade. It’s an evolution.
nsATR: Smart. Adaptive. Directional. Real-Time.
💥 Volatility has never looked this good.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.