OPEN-SOURCE SCRIPT
Trimmed ATR

🧠 **Brief Description**:
Trimmed ATR is a modified volatility indicator that removes extreme values from the ATR calculation. This makes it more reliable for analyzing market conditions and filters out "noise" spikes. It is particularly useful for setting stop-losses and in strategies sensitive to false volatility.
🧾 **How Does Trimmed ATR Work?**
📌 For each bar:
- True Range (TR) is calculated.
- A sliding window of the last N TR values (where N = length) is stored.
- The TR list is sorted, and trimPercent % is cut off from each side:
- The smallest and largest values are removed.
- The remaining values are averaged → Trimmed ATR.
🔍 **Why Is This Important?**
Regular ATR can be distorted by outliers:
- A single spike can sharply inflate the ATR.
- This creates a false impression of market volatility.
🎯 Trimmed ATR solves this by eliminating the impact of anomalies, providing a more stable and accurate volatility measure.
📈 **What Does It Mean If Trimmed ATR Is Higher or Lower Than Regular ATR?**
🔵 **Trimmed ATR is lower than ATR** — this is normal:
- There are isolated TR spikes (high volatility on 1–2 bars).
- ATR increases, including these outliers.
- Trimmed ATR discards them → reflects the true average market background.
🧠 This is the most common case, indicating: a spike occurred, but the market is generally calm.
🟠 **Trimmed ATR is higher than ATR** — a rare but important signal:
- There were artificially low TR values (very small movements).
- ATR becomes too low.
- Trimmed ATR discards these "quiet" periods → provides a more realistic volatility estimate.
⚠️ This may indicate:
- Hidden pressure.
- Preparation for a breakout from a tight range.
- Underestimated volatility.
💡 **Applications**:
- **Trailing Stop**: Trimmed ATR helps avoid stop triggers due to noise.
- **Trend Filter**: Better reflects the "true" market dynamics.
- **Strategy Backtesting**: Eliminates distortions in volatility calculations.
Trimmed ATR is a modified volatility indicator that removes extreme values from the ATR calculation. This makes it more reliable for analyzing market conditions and filters out "noise" spikes. It is particularly useful for setting stop-losses and in strategies sensitive to false volatility.
🧾 **How Does Trimmed ATR Work?**
📌 For each bar:
- True Range (TR) is calculated.
- A sliding window of the last N TR values (where N = length) is stored.
- The TR list is sorted, and trimPercent % is cut off from each side:
- The smallest and largest values are removed.
- The remaining values are averaged → Trimmed ATR.
🔍 **Why Is This Important?**
Regular ATR can be distorted by outliers:
- A single spike can sharply inflate the ATR.
- This creates a false impression of market volatility.
🎯 Trimmed ATR solves this by eliminating the impact of anomalies, providing a more stable and accurate volatility measure.
📈 **What Does It Mean If Trimmed ATR Is Higher or Lower Than Regular ATR?**
🔵 **Trimmed ATR is lower than ATR** — this is normal:
- There are isolated TR spikes (high volatility on 1–2 bars).
- ATR increases, including these outliers.
- Trimmed ATR discards them → reflects the true average market background.
🧠 This is the most common case, indicating: a spike occurred, but the market is generally calm.
🟠 **Trimmed ATR is higher than ATR** — a rare but important signal:
- There were artificially low TR values (very small movements).
- ATR becomes too low.
- Trimmed ATR discards these "quiet" periods → provides a more realistic volatility estimate.
⚠️ This may indicate:
- Hidden pressure.
- Preparation for a breakout from a tight range.
- Underestimated volatility.
💡 **Applications**:
- **Trailing Stop**: Trimmed ATR helps avoid stop triggers due to noise.
- **Trend Filter**: Better reflects the "true" market dynamics.
- **Strategy Backtesting**: Eliminates distortions in volatility calculations.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.