OPEN-SOURCE SCRIPT
ADX Forecast Colorful [DiFlip]

ADX Forecast Colorful [DiFlip]
Introducing one of the most advanced ADX indicators available — a fully customizable analytical tool that integrates forward-looking forecasting capabilities. ADX Forecast Colorful is a scientific evolution of the classic ADX, designed to anticipate future trend strength using linear regression. Instead of merely reacting to historical data, this indicator projects the future behavior of the ADX, giving traders a strategic edge in trend analysis.
⯁ Real-Time ADX Forecasting
For the first time, a public ADX indicator incorporates linear regression (least squares method) to forecast the future behavior of ADX. This breakthrough approach enables traders to anticipate trend strength changes based on historical momentum. By applying linear regression to the ADX, the indicator plots a projected trendline n periods ahead — helping users make more accurate and timely trading decisions.
⯁ Highly Customizable
The indicator adapts seamlessly to any trading style. It offers a total of 26 long entry conditions and 26 short entry conditions, making it one of the most configurable ADX tools on TradingView. Each condition is fully adjustable, enabling the creation of statistical, quantitative, and automated strategies. You maintain full control over the signals to align perfectly with your system.
⯁ Innovative and Science-Based
This is the first public ADX indicator to apply least-squares predictive modeling to ADX dynamics. Technically, it embeds machine learning logic into a traditional trend-strength indicator. Using linear regression as a predictive engine adds powerful statistical rigor to the ADX, turning it into an intelligent, forward-looking signal generator.
⯁ Scientific Foundation: Linear Regression
Linear regression is a fundamental method in statistics and machine learning used to model the relationship between a dependent variable y and one or more independent variables x. The basic formula for simple linear regression is:
y = β₀ + β₁x + ε
Where:
y = predicted value (e.g., future ADX)
x = explanatory variable (e.g., bar index or time)
β₀ = intercept
β₁ = slope (rate of change)
ε = random error term
The goal is to estimate β₀ and β₁ by minimizing the sum of squared errors. This is achieved using the least squares method, ensuring the best linear fit to historical data. Once the coefficients are calculated, the model extends the regression line forward, generating the ADX projection based on recent trends.
⯁ Least Squares Estimation
To minimize the error, the regression coefficients are calculated as:
β₁ = Σ((xᵢ - x̄)(yᵢ - ȳ)) / Σ((xᵢ - x̄)²)
β₀ = ȳ - β₁x̄
Where:
Σ = summation
x̄ and ȳ = means of x and y
i ranges from 1 to n (number of data points)
These formulas provide the best linear unbiased estimator under Gauss-Markov conditions — assuming constant variance and linearity.

⯁ Linear Regression in Machine Learning
Linear regression is a foundational algorithm in supervised learning. Its power in producing quantitative predictions makes it essential in AI systems, predictive analytics, time-series forecasting, and automated trading. Applying it to the ADX essentially places an intelligent forecasting engine inside a classic trend tool.
⯁ Visual Interpretation
Imagine an ADX time series like this:
Time → [..............]
ADX → [ 68, 65, 61, 59, 57, ... ]
The regression line smooths these values and projects them n periods forward, creating a predictive trajectory. This forecasted ADX line can intersect with the actual ADX, offering smarter buy and sell signals.

⯁ Summary of Scientific Concepts
Linear Regression: Models variable relationships with a straight line.
Least Squares: Minimizes prediction errors for best fit.
Time-Series Forecasting: Predicts future values using historical data.
Supervised Learning: Trains models to predict outcomes from inputs.
Statistical Smoothing: Reduces noise and highlights underlying trends.
⯁ Why This Indicator Is Revolutionary
Scientifically grounded: Based on rigorous statistical theory.
Unprecedented: First public ADX using least-squares forecast modeling.
Smart: Uses machine learning logic.
Forward-Looking: Generates predictive, not just reactive, signals.
Customizable: Flexible for any strategy or timeframe.
⯁ Conclusion
By merging ADX and linear regression, this indicator enables traders to predict market momentum rather than merely follow it. ADX Forecast Colorful is not just another indicator — it’s a scientific leap forward in technical analysis. With 26 fully configurable entry conditions and smart forecasting, this open-source tool is built for creating cutting-edge quantitative strategies.
⯁ Example of simple linear regression with one independent variable
This example demonstrates how a basic linear regression works when there is only one independent variable influencing the dependent variable. This type of model is used to identify a direct relationship between two variables.
⯁ In linear regression, observations (red) are considered the result of random deviations (green) from an underlying relationship (blue) between a dependent variable (y) and an independent variable (x)
This concept illustrates that sampled data points rarely align perfectly with the true trend line. Instead, each observed point represents the combination of the true underlying relationship and a random error component.
⯁ Visualizing heteroscedasticity in a scatterplot with 100 random fitted values using Matlab
Heteroscedasticity occurs when the variance of the errors is not constant across the range of fitted values. This visualization highlights how the spread of data can change unpredictably, which is an important factor in evaluating the validity of regression models.
⯁ The datasets in Anscombe’s quartet were designed to have nearly the same linear regression line (as well as nearly identical means, standard deviations, and correlations) but look very different when plotted
This classic example shows that summary statistics alone can be misleading. Even with identical numerical metrics, the datasets display completely different patterns, emphasizing the importance of visual inspection when interpreting a model.
⯁ Result of fitting a set of data points with a quadratic function
This example illustrates how a second-degree polynomial model can better fit certain datasets that do not follow a linear trend. The resulting curve reflects the true shape of the data more accurately than a straight line.
⯁ What is the ADX?
The Average Directional Index (ADX) is a technical analysis indicator developed by J. Welles Wilder. It measures the strength of a trend in a market, regardless of whether the trend is up or down.
The ADX is an integral part of the Directional Movement System, which also includes the Plus Directional Indicator (+DI) and the Minus Directional Indicator (-DI). By combining these components, the ADX provides a comprehensive view of market trend strength.
⯁ How to use the ADX?
The ADX is calculated based on the moving average of the price range expansion over a specified period (usually 14 periods). It is plotted on a scale from 0 to 100 and has three main zones:
Strong Trend: When the ADX is above 25, indicating a strong trend.
Weak Trend: When the ADX is below 20, indicating a weak or non-existent trend.
Neutral Zone: Between 20 and 25, where the trend strength is unclear.
⯁ Entry Conditions
Each condition below is fully configurable and can be combined to build precise trading logic.
📈 BUY
🅰️ Signal Validity: The signal will remain valid for X bars.
🅰️ Signal Sequence: Configurable as AND or OR.
🅰️ +DI > -DI
🅰️ +DI < -DI
🅰️ +DI > ADX
🅰️ +DI < ADX
🅰️ -DI > ADX
🅰️ -DI < ADX
🅰️ ADX > Threshold
🅰️ ADX < Threshold
🅰️ +DI > Threshold
🅰️ +DI < Threshold
🅰️ -DI > Threshold
🅰️ -DI < Threshold
🅰️ +DI (Crossover) -DI
🅰️ +DI (Crossunder) -DI
🅰️ +DI (Crossover) ADX
🅰️ +DI (Crossunder) ADX
🅰️ +DI (Crossover) Threshold
🅰️ +DI (Crossunder) Threshold
🅰️ -DI (Crossover) ADX
🅰️ -DI (Crossunder) ADX
🅰️ -DI (Crossover) Threshold
🅰️ -DI (Crossunder) Threshold
🔮 +DI (Crossover) -DI Forecast
🔮 +DI (Crossunder) -DI Forecast
🔮 ADX (Crossover) +DI Forecast
🔮 ADX (Crossunder) +DI Forecast
📉 SELL
🅰️ Signal Validity: The signal will remain valid for X bars.
🅰️ Signal Sequence: Configurable as AND or OR.
🅰️ +DI > -DI
🅰️ +DI < -DI
🅰️ +DI > ADX
🅰️ +DI < ADX
🅰️ -DI > ADX
🅰️ -DI < ADX
🅰️ ADX > Threshold
🅰️ ADX < Threshold
🅰️ +DI > Threshold
🅰️ +DI < Threshold
🅰️ -DI > Threshold
🅰️ -DI < Threshold
🅰️ +DI (Crossover) -DI
🅰️ +DI (Crossunder) -DI
🅰️ +DI (Crossover) ADX
🅰️ +DI (Crossunder) ADX
🅰️ +DI (Crossover) Threshold
🅰️ +DI (Crossunder) Threshold
🅰️ -DI (Crossover) ADX
🅰️ -DI (Crossunder) ADX
🅰️ -DI (Crossover) Threshold
🅰️ -DI (Crossunder) Threshold
🔮 +DI (Crossover) -DI Forecast
🔮 +DI (Crossunder) -DI Forecast
🔮 ADX (Crossover) +DI Forecast
🔮 ADX (Crossunder) +DI Forecast
🤖 Automation
All BUY and SELL conditions are compatible with TradingView alerts, making them ideal for fully or semi-automated systems.
⯁ Unique Features
Introducing one of the most advanced ADX indicators available — a fully customizable analytical tool that integrates forward-looking forecasting capabilities. ADX Forecast Colorful is a scientific evolution of the classic ADX, designed to anticipate future trend strength using linear regression. Instead of merely reacting to historical data, this indicator projects the future behavior of the ADX, giving traders a strategic edge in trend analysis.
⯁ Real-Time ADX Forecasting
For the first time, a public ADX indicator incorporates linear regression (least squares method) to forecast the future behavior of ADX. This breakthrough approach enables traders to anticipate trend strength changes based on historical momentum. By applying linear regression to the ADX, the indicator plots a projected trendline n periods ahead — helping users make more accurate and timely trading decisions.
⯁ Highly Customizable
The indicator adapts seamlessly to any trading style. It offers a total of 26 long entry conditions and 26 short entry conditions, making it one of the most configurable ADX tools on TradingView. Each condition is fully adjustable, enabling the creation of statistical, quantitative, and automated strategies. You maintain full control over the signals to align perfectly with your system.
⯁ Innovative and Science-Based
This is the first public ADX indicator to apply least-squares predictive modeling to ADX dynamics. Technically, it embeds machine learning logic into a traditional trend-strength indicator. Using linear regression as a predictive engine adds powerful statistical rigor to the ADX, turning it into an intelligent, forward-looking signal generator.
⯁ Scientific Foundation: Linear Regression
Linear regression is a fundamental method in statistics and machine learning used to model the relationship between a dependent variable y and one or more independent variables x. The basic formula for simple linear regression is:
y = β₀ + β₁x + ε
Where:
y = predicted value (e.g., future ADX)
x = explanatory variable (e.g., bar index or time)
β₀ = intercept
β₁ = slope (rate of change)
ε = random error term
The goal is to estimate β₀ and β₁ by minimizing the sum of squared errors. This is achieved using the least squares method, ensuring the best linear fit to historical data. Once the coefficients are calculated, the model extends the regression line forward, generating the ADX projection based on recent trends.
⯁ Least Squares Estimation
To minimize the error, the regression coefficients are calculated as:
β₁ = Σ((xᵢ - x̄)(yᵢ - ȳ)) / Σ((xᵢ - x̄)²)
β₀ = ȳ - β₁x̄
Where:
Σ = summation
x̄ and ȳ = means of x and y
i ranges from 1 to n (number of data points)
These formulas provide the best linear unbiased estimator under Gauss-Markov conditions — assuming constant variance and linearity.
⯁ Linear Regression in Machine Learning
Linear regression is a foundational algorithm in supervised learning. Its power in producing quantitative predictions makes it essential in AI systems, predictive analytics, time-series forecasting, and automated trading. Applying it to the ADX essentially places an intelligent forecasting engine inside a classic trend tool.
⯁ Visual Interpretation
Imagine an ADX time series like this:
Time → [..............]
ADX → [ 68, 65, 61, 59, 57, ... ]
The regression line smooths these values and projects them n periods forward, creating a predictive trajectory. This forecasted ADX line can intersect with the actual ADX, offering smarter buy and sell signals.
⯁ Summary of Scientific Concepts
Linear Regression: Models variable relationships with a straight line.
Least Squares: Minimizes prediction errors for best fit.
Time-Series Forecasting: Predicts future values using historical data.
Supervised Learning: Trains models to predict outcomes from inputs.
Statistical Smoothing: Reduces noise and highlights underlying trends.
⯁ Why This Indicator Is Revolutionary
Scientifically grounded: Based on rigorous statistical theory.
Unprecedented: First public ADX using least-squares forecast modeling.
Smart: Uses machine learning logic.
Forward-Looking: Generates predictive, not just reactive, signals.
Customizable: Flexible for any strategy or timeframe.
⯁ Conclusion
By merging ADX and linear regression, this indicator enables traders to predict market momentum rather than merely follow it. ADX Forecast Colorful is not just another indicator — it’s a scientific leap forward in technical analysis. With 26 fully configurable entry conditions and smart forecasting, this open-source tool is built for creating cutting-edge quantitative strategies.
⯁ Example of simple linear regression with one independent variable
This example demonstrates how a basic linear regression works when there is only one independent variable influencing the dependent variable. This type of model is used to identify a direct relationship between two variables.
⯁ In linear regression, observations (red) are considered the result of random deviations (green) from an underlying relationship (blue) between a dependent variable (y) and an independent variable (x)
This concept illustrates that sampled data points rarely align perfectly with the true trend line. Instead, each observed point represents the combination of the true underlying relationship and a random error component.
⯁ Visualizing heteroscedasticity in a scatterplot with 100 random fitted values using Matlab
Heteroscedasticity occurs when the variance of the errors is not constant across the range of fitted values. This visualization highlights how the spread of data can change unpredictably, which is an important factor in evaluating the validity of regression models.
⯁ The datasets in Anscombe’s quartet were designed to have nearly the same linear regression line (as well as nearly identical means, standard deviations, and correlations) but look very different when plotted
This classic example shows that summary statistics alone can be misleading. Even with identical numerical metrics, the datasets display completely different patterns, emphasizing the importance of visual inspection when interpreting a model.
⯁ Result of fitting a set of data points with a quadratic function
This example illustrates how a second-degree polynomial model can better fit certain datasets that do not follow a linear trend. The resulting curve reflects the true shape of the data more accurately than a straight line.
⯁ What is the ADX?
The Average Directional Index (ADX) is a technical analysis indicator developed by J. Welles Wilder. It measures the strength of a trend in a market, regardless of whether the trend is up or down.
The ADX is an integral part of the Directional Movement System, which also includes the Plus Directional Indicator (+DI) and the Minus Directional Indicator (-DI). By combining these components, the ADX provides a comprehensive view of market trend strength.
⯁ How to use the ADX?
The ADX is calculated based on the moving average of the price range expansion over a specified period (usually 14 periods). It is plotted on a scale from 0 to 100 and has three main zones:
Strong Trend: When the ADX is above 25, indicating a strong trend.
Weak Trend: When the ADX is below 20, indicating a weak or non-existent trend.
Neutral Zone: Between 20 and 25, where the trend strength is unclear.
⯁ Entry Conditions
Each condition below is fully configurable and can be combined to build precise trading logic.
📈 BUY
🅰️ Signal Validity: The signal will remain valid for X bars.
🅰️ Signal Sequence: Configurable as AND or OR.
🅰️ +DI > -DI
🅰️ +DI < -DI
🅰️ +DI > ADX
🅰️ +DI < ADX
🅰️ -DI > ADX
🅰️ -DI < ADX
🅰️ ADX > Threshold
🅰️ ADX < Threshold
🅰️ +DI > Threshold
🅰️ +DI < Threshold
🅰️ -DI > Threshold
🅰️ -DI < Threshold
🅰️ +DI (Crossover) -DI
🅰️ +DI (Crossunder) -DI
🅰️ +DI (Crossover) ADX
🅰️ +DI (Crossunder) ADX
🅰️ +DI (Crossover) Threshold
🅰️ +DI (Crossunder) Threshold
🅰️ -DI (Crossover) ADX
🅰️ -DI (Crossunder) ADX
🅰️ -DI (Crossover) Threshold
🅰️ -DI (Crossunder) Threshold
🔮 +DI (Crossover) -DI Forecast
🔮 +DI (Crossunder) -DI Forecast
🔮 ADX (Crossover) +DI Forecast
🔮 ADX (Crossunder) +DI Forecast
📉 SELL
🅰️ Signal Validity: The signal will remain valid for X bars.
🅰️ Signal Sequence: Configurable as AND or OR.
🅰️ +DI > -DI
🅰️ +DI < -DI
🅰️ +DI > ADX
🅰️ +DI < ADX
🅰️ -DI > ADX
🅰️ -DI < ADX
🅰️ ADX > Threshold
🅰️ ADX < Threshold
🅰️ +DI > Threshold
🅰️ +DI < Threshold
🅰️ -DI > Threshold
🅰️ -DI < Threshold
🅰️ +DI (Crossover) -DI
🅰️ +DI (Crossunder) -DI
🅰️ +DI (Crossover) ADX
🅰️ +DI (Crossunder) ADX
🅰️ +DI (Crossover) Threshold
🅰️ +DI (Crossunder) Threshold
🅰️ -DI (Crossover) ADX
🅰️ -DI (Crossunder) ADX
🅰️ -DI (Crossover) Threshold
🅰️ -DI (Crossunder) Threshold
🔮 +DI (Crossover) -DI Forecast
🔮 +DI (Crossunder) -DI Forecast
🔮 ADX (Crossover) +DI Forecast
🔮 ADX (Crossunder) +DI Forecast
🤖 Automation
All BUY and SELL conditions are compatible with TradingView alerts, making them ideal for fully or semi-automated systems.
⯁ Unique Features
- Linear Regression: (Forecast)
- Signal Validity: The signal will remain valid for X bars
- Signal Sequence: Configurable as AND/OR
- Condition Table: BUY/SELL
- Condition Labels: BUY/SELL
- Plot Labels in the Graph Above: BUY/SELL
- Automate and Monitor Signals/Alerts: BUY/SELL
- Background Colors: "bgcolor"
- Background Colors: "fill"
- Linear Regression (Forecast)
- Signal Validity: The signal will remain valid for X bars
- Signal Sequence: Configurable as AND/OR
- Table of Conditions: BUY/SELL
- Conditions Label: BUY/SELL
- Plot Labels in the graph above: BUY/SELL
- Automate & Monitor Signals/Alerts: BUY/SELL
- Background Colors: "bgcolor"
- Background Colors: "fill"
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
🪄 Check out the indicators and strategies we are creating at Titans_Invest ✨
tradingview.com/u/Titans_Invest/
tradingview.com/u/Titans_Invest/
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.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
🪄 Check out the indicators and strategies we are creating at Titans_Invest ✨
tradingview.com/u/Titans_Invest/
tradingview.com/u/Titans_Invest/
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.