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.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。