Trend Age And Maturity Gauge
"This trend has run a long way already" is a judgement traders make by eye, usually too late. This indicator replaces the eyeball with a measurement: it finds confirmed swing pivots using a symmetric fractal test, treats the run between two consecutive pivots as a "leg", and builds a trailing sample of how long (in bars) and how far (in price) this instrument's legs have typically run. The leg currently in progress - from the last confirmed pivot to right now - is then given a percentile rank against that sample on both measures. A leg sitting at the 90th percentile for age, distance, or both has already outlasted or outrun nine out of ten of its own recent predecessors on this instrument and timeframe. That does not mean it has to end this bar, but it does mean the base rate has shifted - late-cycle legs are exactly the ones a fresh trend-following entry tends to get caught by. The gauge reports this as two percentile lines plus a plain-language panel label rather than a single blended score, because age and distance can disagree (a slow grind can be old without being far, a spike can be far without being old) and collapsing that distinction away would hide the more useful half of the read. The pivot scan only re-runs once per closed bar, since a fractal pivot cannot newly confirm mid-bar, keeping the indicator light on a live chart despite scanning back over InpLookbackBars bars. Notes and limitations - Like every fractal-based pivot detector, the most recent InpSwingBars bars of pivot state are provisional and can still revise as new bars close - this affects which bar is treated as the "last confirmed pivot," not the historical leg sample it is compared against. - The percentile distribution is drawn only from this chart's own recent legs; a young chart or an illiquid symbol with few confirmed pivots produces a thin, noisier sample. - This describes how the current leg compares with recent history, it does not forecast when the leg will end. - Buffers only carry a value on the bar where they were computed live and freeze there - the tool is a current-state gauge, not a backfilled historical percentile series.
Indicator · MT4 · v1.0 · Free
About Trend Age And Maturity Gauge
Trend Age And Maturity Gauge is an indicator for MetaTrader 4. It can alert you with a pop-up, sound, email or push message. It has 9 settings, such as Swing bars, Lookback bars and Leg sample. MQL source code included.
Files in the download: TrendAgeMaturityGauge.ex4, TrendAgeMaturityGauge.mq4, TrendAgeMaturityGauge.txt.
Settings
| Setting | Default | What it does |
|---|---|---|
| Swing bars | 5 | Bars required on each side to confirm a swing pivot |
| Lookback bars | 1000 | How far back to search for pivots |
| Leg sample | 30 | Completed legs kept for the percentile distribution |
| Late threshold | 80.0 | Percentile at/above which the leg is flagged late |
| Alerts | true | Alert once when either percentile crosses the threshold |
| Corner | CORNER_LEFT_UPPER | Panel corner |
| X distance | 10 | Panel horizontal offset, pixels |
| Y distance | 20 | Panel vertical offset, pixels |
| Font size | 10 | Panel font size |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Indicators.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the indicator from the Navigator onto a chart and adjust the settings.
Tags: Pivot Points · Fractals · Trend · Trailing Stop & Break-even · Alerts · MT4 Indicator · MQL4 Source Code