What this TradingView script does
The Directional Imbalance Index is designed to track market strength by counting how often price sets new highs or lows over a defined lookback period. Every time a bar forms a new extreme, the indicator records a +1 count for either bullish (highs) or bearish (lows). These counts are aggregated into a rolling calculation, allowing traders to see which side dominates and how directional imbalance evolves.
🔵 CONCEPTS
- Each new highest high → adds a bullish count (+1).
- Each new lowest low → adds a bearish count (+1).
- Counts are stored inside arrays over a user-defined Calculation Period.
for i = 0 to period-1 h = high l = low
if h == upper countUp.push(1) if l == lower countDn.push(1)
- The balance between bullish and bearish counts highlights dominance and imbalance.
- Normalized percentages help compare both sides (e.g., 65% bullish vs 35% bearish).
🔵 FEATURES
How traders can use it
Use Directional Imbalance Index as a chart context layer inside TradingView: read the structure it highlights, compare it with your market bias, and let the script narrow which moves deserve attention.
The strongest workflow is to combine the script with higher timeframe structure, volume context, and a repeatable execution plan instead of treating any single label as a standalone trade.




