Fractal Trend Lines Indicator: The Anchor Points, Not the Lines

Written by Dominic Walsh · Published · Last updated

Worth being clear about this one up front: it marks fractal points, it does not draw the lines. The fractal trend lines indicator finds classic five-bar fractal highs and lows and plots them, giving you the anchors that a trend line gets drawn through. Connecting them stays your job, which is how most discretionary traders prefer it.

This build ships as a compiled .ex4 for MT4 and .ex5 for MT5; the screenshots below come from EURUSD H1.

Platforms MT4 (.ex4) + MT5 (.ex5)
Chart window Main price chart
Plots 2: Fractal Up, Fractal Dn
Alerts popup, push notification, email, sound
Inputs 6

What the Fractal Trend Lines Indicator draws on the chart

Fractal Up marks confirmed fractal highs in crimson.

Fractal Dn marks confirmed fractal lows in tan.

Nothing joins them up. You get no trend line objects, no channels and no zones.

Bars that fail the test carry no value, so only the pivots themselves appear.

  • Fractal Up: plot, crimson
  • Fractal Dn: plot, tan
Fractal trend lines indicator on EURUSD H1 marking five-bar fractal highs and lows
Fractal trend lines indicator on EURUSD H1 marking five-bar fractal highs and lows

How the Fractal Trend Lines Indicator calculates its values

The classic five-bar test

A fractal high needs high[i] to beat high[i-1] and high[i-2] on one side, and high[i+1] and high[i+2] on the other. Five bars in total with the candidate in the middle. Bill Williams defined it this way and the code follows it exactly, with no depth setting to change.

The mirror for lows

A fractal low inverts every comparison: low[i] must sit under low[i-1], low[i-2], low[i+1] and low[i+2]. The same strict inequality applies, so two bars sharing an identical low cancel each other out and neither becomes a fractal.

Clearing and assigning each bar

Every bar starts with UpBuf[i] and DnBuf[i] set to 0.0 before the tests run. A bar that passes receives high[i] or low[i], so the marker sits exactly on the extreme rather than offset from it. latest tracks rates_total – 1 for the alert check on the most recent completed bar.

How to read the signals

Two fractal highs at descending prices give you the anchors for a falling trend line.

Confirmation always lags by two bars, because the test needs the two candles to the right.

A long run without fractals on one side usually means a strong one-way move, since the test needs bars on both flanks.

The markers sit on the exact high or low, so you can anchor a line to them precisely.

Alert channels in this build: popup, push notification, email and sound, one message per closed bar.

Four channels sit beneath `EnableAlerts`: popup, push notification, email and sound, with `SoundFile` naming the clip. Only the popup starts enabled. A message follows a newly confirmed fractal on a closed bar, and the guard allows one per bar. Note that these six alert switches are the only inputs this build has; the fractal test itself carries nothing to tune.

Every Fractal Trend Lines Indicator input

Alert settings

Setting What it does Default
EnableAlerts (see inputs panel) on
EnablePopup (see inputs panel) on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
Fractal trend lines indicator inputs panel: the six alert switches are the only settings
Fractal trend lines indicator inputs panel: the six alert switches are the only settings

Settings that fit your chart

Fractals are timeframe agnostic and work anywhere you would draw a trend line by hand. EURUSD H1 is the reference chart. On M5 fractals appear every few bars and most anchor nothing worth drawing. H1 and H4 give a spacing that suits manual trend lines. On the daily chart each fractal marks a swing of real significance, and there are few enough to keep track of.

When the Fractal Trend Lines Indicator fails

Nothing here draws a trend line, despite the name. If you expected automatic lines and channels, this is not that tool.

The fixed five-bar window has no setting. On a fast chart you cannot widen it to filter noise, and on a slow one you cannot tighten it.

Strict inequalities mean a double top with two identical highs produces no fractal at either bar, which is exactly where many traders would want an anchor.

Copy the compiled Fractal Trend Lines Indicator file into your MQL4/Indicators folder, and the MT5 build into MQL5/Indicators, then restart the terminal and drag it onto a chart. The step-by-step guide with screenshots is at how to install MT4 and MT5 indicators.

Download the Fractal Trend Lines Indicator for MT4 and MT5

The zip holds the compiled Fractal Trend Lines Indicator build for MT4 and MT5, plus a short README. Compiled files only, no source. Enter your email below and the download link arrives in your inbox.

Download this indicator free

Enter your email and the file is yours. You also get the full MT4 and MT5 library.

  • 1,380+ indicators
  • MT4 and MT5 files
  • No spam, unsubscribe any time

FAQ

Does the fractal trend lines indicator actually draw trend lines?

No, and the name oversells it. It plots Fractal Up and Fractal Dn markers at confirmed five-bar pivots and stops there. It creates no line, channel or zone objects. Those markers are the anchor points you connect yourself, which suits traders who choose which swings a line should respect.

Why are there no settings for the fractal depth?

Because the build implements the classic five-bar definition literally: two bars either side of the candidate. That window is hard-coded, so the only inputs are the six alert switches. If you need an adjustable depth, a configurable pivot tool is the better fit.

How long after the swing does a Fractal Up appear?

Two bars. The test needs high[i+1] and high[i+2] to exist and to come in lower before it can confirm the candidate. That delay is inherent to any fractal, and it is why the marker never moves once it prints.

Why does a double top sometimes produce no fractal?

The comparisons are strict. high[i] must be greater than each neighbour, not greater than or equal. Two bars at an identical high each fail against the other, so neither qualifies. It is a known quirk of the classic definition rather than a fault in this build.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Fractal Trend Lines Indicator as one input. Always backtest before trading live.

Category: this is part of our Trend collection. Also, truly, browse more Trend for MetaTrader, or explore every MT4 indicator and MT5 indicator on the site.

External references

Dominic Walsh - Forex trader and MT4/MT5 developer

About the author

Written by Dominic Walsh, a Forex trader and MT4/MT5 indicator, Expert Advisor and script developer. Every tool on forexmt4systems.com is tested on live charts before release and ships with ready-to-use compiled MT4 (.ex4) and MT5 (.ex5) files. Learn more about the trader and developer behind this site.

How we build, test and correct every tool: Editorial & Testing Policy. Trading carries risk; see the disclaimer.

Leave a Comment