OPEN-SOURCE SCRIPT
Complete DMI + ADX System

Drawing the historical data of the +DI and -DI lines is actually one of the most common ways traders visualize the "tug-of-war" between buyers and sellers.
When you load this script, you will see a green line and a red line constantly chasing each other.
The Crosses: When the Green line crosses above the Red line, the buyers have officially taken control of the momentum.
The "Jaws": When the Green line is going up and the Red line is going down simultaneously, the lines look like an alligator opening its jaws. The wider the jaws, the stronger the trend.
The Squeeze: When the Green and Red lines are tangled together in a tight knot, the market is "choppy" and there is no clear direction. (This is exactly when your Time Box breakouts are most likely to fail!).
Adding the ADX (Average Directional Index) gives you the complete "Directional Movement System." It is the missing puzzle piece that tells you if a breakout is real or just noise.
If the +DI and -DI lines are the "Steering Wheel" telling you which way the market is turning, the ADX is the "Gas Pedal" telling you how much momentum is behind that turn.
When you look at this new pane below your chart, here is the exact step-by-step checklist to read the market's mind:
1. Who is in control? (The Cross)
Look at the Green (+DI) and Red (-DI) lines. Whichever line is on top is currently winning the tug-of-war.
2. Is there actually a trend? (The ADX)
Look at the White line (ADX).
If the White line is below the dashed 25 line, the market is asleep. It is chopping sideways. Do not trust breakouts here.
If the White line is crossing above 25, the market is waking up. A strong trend is starting.
Activate the Alert in TradingView
Save your script and make sure it is loaded on your chart.
Press Alt + A (or Option + A on Mac) to open the Create Alert menu.
Condition: Click the top dropdown and select your custom indicator name (e.g., "Custom +DI & -DI History").
In the second dropdown right below it, select "DMI Bullish (+DI crosses Up)".
Trigger: Select "Once Per Bar Close" (Crucial: This prevents fake alerts if the lines cross mid-candle and then un-cross before the candle finishes).
Notifications: Choose how you want to be notified (App push, pop-up, or email).
Click Create.
When you load this script, you will see a green line and a red line constantly chasing each other.
The Crosses: When the Green line crosses above the Red line, the buyers have officially taken control of the momentum.
The "Jaws": When the Green line is going up and the Red line is going down simultaneously, the lines look like an alligator opening its jaws. The wider the jaws, the stronger the trend.
The Squeeze: When the Green and Red lines are tangled together in a tight knot, the market is "choppy" and there is no clear direction. (This is exactly when your Time Box breakouts are most likely to fail!).
Adding the ADX (Average Directional Index) gives you the complete "Directional Movement System." It is the missing puzzle piece that tells you if a breakout is real or just noise.
If the +DI and -DI lines are the "Steering Wheel" telling you which way the market is turning, the ADX is the "Gas Pedal" telling you how much momentum is behind that turn.
When you look at this new pane below your chart, here is the exact step-by-step checklist to read the market's mind:
1. Who is in control? (The Cross)
Look at the Green (+DI) and Red (-DI) lines. Whichever line is on top is currently winning the tug-of-war.
2. Is there actually a trend? (The ADX)
Look at the White line (ADX).
If the White line is below the dashed 25 line, the market is asleep. It is chopping sideways. Do not trust breakouts here.
If the White line is crossing above 25, the market is waking up. A strong trend is starting.
Activate the Alert in TradingView
Save your script and make sure it is loaded on your chart.
Press Alt + A (or Option + A on Mac) to open the Create Alert menu.
Condition: Click the top dropdown and select your custom indicator name (e.g., "Custom +DI & -DI History").
In the second dropdown right below it, select "DMI Bullish (+DI crosses Up)".
Trigger: Select "Once Per Bar Close" (Crucial: This prevents fake alerts if the lines cross mid-candle and then un-cross before the candle finishes).
Notifications: Choose how you want to be notified (App push, pop-up, or email).
Click Create.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.