OPEN-SOURCE SCRIPT
DMI ADX Bollinger Bands

This Pine Script code merges the classic DMI (Directional Movement Index) and ADX (Average Directional Index) indicators with Bollinger Bands, but with a unique twist: the Bollinger Bands are applied to the ADX line itself rather than the price.
This structure allows you to analyze not just the strength of the trend, but the volatility of that trend's momentum.
1. Components of the Indicator
+DI (Navy Line): Represents the strength of the bullish (upward) momentum.
-DI (Red Line): Represents the strength of the bearish (downward) momentum.
ADX (Green Line): Measures the absolute strength of the trend.
Bollinger Bands (Gray Lines & Blue Shading): Measure the volatility of the ADX line (i.e., how rapidly the trend is gaining or losing momentum).
2. How to Interpret the Signals
A. Trend Direction (DMI)
+DI > -DI: The market is trending upward.
-DI > +DI: The market is trending downward.
B. Trend Strength (ADX Levels)
Below 20: The market lacks a clear trend or is in a "ranging" (sideways) state.
20 – 40: A trend is forming and gaining strength. This is usually the prime area for trend-following strategies.
Above 40: The trend is very strong, but it also indicates the market is becoming "overextended" or at risk of exhaustion.
C. Trend Momentum (ADX + Bollinger Bands)
This is the core feature of your script:
ADX crosses above the Upper Band: The trend is gaining momentum explosively. This often indicates a strong breakout or an acceleration in the current price move.
ADX nears the Lower Band: The trend is losing steam or entering a consolidation/sideways phase.
ADX is between the bands: The trend is moving at a consistent, sustainable pace.
3. Trading Strategies
Trend-Following (Entry)
Entry: Look for a cross where +DI > -DI (for long) or -DI > +DI (for short), while the ADX is above 20.
Confirmation: Ideally, you want to see the ADX line moving upward, ideally heading toward the Upper Bollinger Band, confirming that the momentum is building.
Profit Taking / Reversal (Exhaustion)
When the ADX reaches the 40–50 level and touches or exceeds the Upper Bollinger Band, the trend is likely "overextended." This is a strong signal to consider taking profits or tightening your stop-loss, as the market may be due for a correction.
Identifying Ranging Markets
If the ADX line drops below the Lower Bollinger Band, the market has officially entered a low-volatility/sideways phase. Avoid trend-following strategies in this zone and consider strategies better suited for choppy markets.
This structure allows you to analyze not just the strength of the trend, but the volatility of that trend's momentum.
1. Components of the Indicator
+DI (Navy Line): Represents the strength of the bullish (upward) momentum.
-DI (Red Line): Represents the strength of the bearish (downward) momentum.
ADX (Green Line): Measures the absolute strength of the trend.
Bollinger Bands (Gray Lines & Blue Shading): Measure the volatility of the ADX line (i.e., how rapidly the trend is gaining or losing momentum).
2. How to Interpret the Signals
A. Trend Direction (DMI)
+DI > -DI: The market is trending upward.
-DI > +DI: The market is trending downward.
B. Trend Strength (ADX Levels)
Below 20: The market lacks a clear trend or is in a "ranging" (sideways) state.
20 – 40: A trend is forming and gaining strength. This is usually the prime area for trend-following strategies.
Above 40: The trend is very strong, but it also indicates the market is becoming "overextended" or at risk of exhaustion.
C. Trend Momentum (ADX + Bollinger Bands)
This is the core feature of your script:
ADX crosses above the Upper Band: The trend is gaining momentum explosively. This often indicates a strong breakout or an acceleration in the current price move.
ADX nears the Lower Band: The trend is losing steam or entering a consolidation/sideways phase.
ADX is between the bands: The trend is moving at a consistent, sustainable pace.
3. Trading Strategies
Trend-Following (Entry)
Entry: Look for a cross where +DI > -DI (for long) or -DI > +DI (for short), while the ADX is above 20.
Confirmation: Ideally, you want to see the ADX line moving upward, ideally heading toward the Upper Bollinger Band, confirming that the momentum is building.
Profit Taking / Reversal (Exhaustion)
When the ADX reaches the 40–50 level and touches or exceeds the Upper Bollinger Band, the trend is likely "overextended." This is a strong signal to consider taking profits or tightening your stop-loss, as the market may be due for a correction.
Identifying Ranging Markets
If the ADX line drops below the Lower Bollinger Band, the market has officially entered a low-volatility/sideways phase. Avoid trend-following strategies in this zone and consider strategies better suited for choppy markets.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.