Trend Duration Forecast
- Indicatori
- Israr Hussain Shah
- Versione: 2.0
It utilizes a Hull Moving Average (HMA) to detect trend direction and statistically forecasts the probable duration of the current move based on historical market behavior.
Key Features
-
Smooth Trend Detection: Uses the Hull Moving Average (HMA) to filter noise while minimizing lag, providing clean Bullish/Bearish signals.
-
Real-Time Duration Counter: Displays a dynamic label at the start of the current trend showing the "Real Length" (number of bars the trend has been active).
-
Probabilistic Forecasting: Automatically calculates the average length of the last
trends. It projects a "Future Line" and a "Probable Length" label, helping you estimate if the current trend has room to run or is nearing exhaustion. -
Statistical Dashboard: A neat table in the bottom-right corner displays the duration of the last 10 Bullish and Bearish trends, along with their running averages.
-
Historical Markers: Leaves persistent labels and arrows on previous trends, allowing you to visually backtest how accurate the trend signals were in the past.
Input Parameters
-
Smoothing Length (Default: 50): The period for the Hull Moving Average. Higher values reduce noise but increase lag; lower values are more responsive.
-
Trend Detection Sensitivity (Default: 3): The number of consecutive bars required to confirm a change in slope. A value of 3 prevents "fake-outs" in choppy markets.
-
Trend Sample Size (Default: 10): The number of past trends stored to calculate the "Probable Length" average.
-
Visual Settings: Customizable colors for Up/Down trends, text size, and history limits to optimize performance.
How to Use
This indicator is best used to answer the question: "Is this trend just starting, or is it over-extended?"
1. Identifying Entry Points
-
Buy Signal: The HMA line turns Green (default). A "Trend Up" label appears with a Real Length of 0.
-
Sell Signal: The HMA line turns Orange/Red (default). A "Trend Down" label appears.
2. Managing Trades (The Forecast)
Look at the "Probable Length" label projected to the right of the price:
-
Early Trend: If the current "Real Length" (e.g., 15 bars) is significantly lower than the "Probable Length" (e.g., 40 bars), the trend may have strong continuation potential.
-
Trend Exhaustion: If the "Real Length" exceeds the "Probable Length" average, the trend is statistically over-extended, and you should tighten stops or consider taking profits.
3. Using the Dashboard
-
Check the table in the bottom-right corner.
-
If the Average Bullish Trend is 50 bars and the Average Bearish Trend is only 10 bars, the market is in a strong uptrend regime. Focus on Buy signals and be cautious with Sell signals.
Installation Instructions
-
Download the .mq5 file.
-
Place it in your MetaTrader 5 Indicators folder (File -> Open Data Folder -> MQL5 -> Indicators).
-
Attach to a chart (Works on all timeframes, though H1 and H4 are recommended for swing trading).

It works good! Nice job...