OPEN-SOURCE SCRIPT
Updated

Zen ABR

1 762
### **Average Bar Range (ABR) Levels** – A Simple Yet Powerful Scalping Tool

The **ABR Levels** indicator dynamically calculates the **average bar range** and plots three key levels on your chart:

✅ **0.5x ABR** – Half the average bar range
✅ **1x ABR** – The full average bar range
✅ **2x ABR** – Double the average bar range

This provides an **instant volatility gauge**, helping traders adjust position size, stop losses, and targets **based on current market conditions** rather than arbitrary numbers.

### **How It Works**
- The indicator calculates **the average range of the last 8 bars** (default setting, adjustable).
- The **ABR levels update in real time**, appearing in the **top-right corner of your chart** for easy reference.
- Works across **any instrument and timeframe** – great for scalpers and intraday traders.

### **Why Use ABR Levels?**
🚀 **Avoid oversized losses** – Trade dynamically instead of using fixed stops and targets.
📉 **Recognize shifts in market conditions** – Identify when volatility is expanding or contracting.
🎯 **Refine your entries & exits** – Use ABR levels to **scale** your positions intelligently.

### **Pro Tip:**
Never enter a trade **aiming for half-R** profits. If a trade goes badly, **you might manage it to break even or half-R**, but aiming for tiny wins will **wreck your long-term edge**.

🔹 **This script is open-source!** If you're not on TradingView, you can copy the code into any AI tool to generate it for your platform. 🚀
Release Notes
**Update Notes for Zen ABR v2**

This version addresses the stability issues reported by users and improves overall reliability:

• **Table flicker removed** — the ABR table is now created once using a persistent variable, preventing the repeated allocation that caused visual glitches and lag.
• **Full Bar Replay support** — the table now updates on every bar rather than relying on `barstate.isrealtime` or `barstate.islastconfirmedhistory`, ensuring ABR values refresh correctly during replay.
• **Improved ABR calculation** — the script now uses `ta.sma` for a cleaner and more robust average bar-range calculation.
• **Cleaner level toggles** — when ABR levels are turned on or off, the table cells are updated correctly without leaving outdated values behind.

These changes make the indicator more stable, more accurate, and fully compatible with both live charts and Bar Replay.

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.