Trendline Breakout Alert Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

A trendline break means more when price closes clearly past the line. The trendline breakout alert indicator draws resistance through the two newest swing highs and support through the two newest swing lows, then marks a close that clears either line by a quarter of the average range.

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: Breakout Buy, Breakout Sell
Alerts popup, push notification, email, sound
Inputs 14

What each plot looks like

Two trendlines and two marks on price.

`ResColor` `clrTomato` draws the resistance line.

`SupColor` `clrDodgerBlue` draws the support line.

`Breakout Buy` prints lime with arrow 233.

`Breakout Sell` prints red with arrow 234.

`ShowLines` controls the line drawing.

  • Breakout Buy: arrow, lime, width 2, arrow code 233
  • Breakout Sell: arrow, red, width 2, arrow code 234
trendline breakout alert indicator: Trendlines with buffered break marks, EURUSD H1.
Trendlines with buffered break marks, EURUSD H1.

How it all fits together

Swings

`Depth` `5` bars on each side confirm a swing. The two newest highs then define resistance.

Buffer

A close must clear the projected line by `BreakBuffer` `0.25` of an `AtrPeriod` `14` range.

Break

A close past the buffered line, after a close inside it, prints a mark. Same-side marks then wait `CooldownBars` `4` bars.

Reading it in practice

Tomato slopes across recent highs.

Blue, in turn, slopes across recent lows.

Both lines move when new swings confirm.

However, marks need a clear close past the line.

So `ArrowOffset` `0.6` spaces marks in ranges.

Also, swings confirm five bars late.

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

Buffered breaks report once per bar through `EnableAlerts`, and popups are the only messages sent by default.

Every Trendline Breakout Alert Indicator input

Core settings

Setting What it does Default
Depth Fractal half-width (bars each side of a pivot). Swing strength in bars per side, `5`. 5
AtrPeriod ATR period (arrow offset + break buffer). Range window, `14`. 14
BreakBuffer Break confirm distance in ATR. How far past the line a close must land, `0.25`. 0.25
CooldownBars Min bars between arrows of same side. Wait before repeating a side, `4`. 4

Display settings

Setting What it does Default
ArrowOffset Arrow offset in ATR. Mark gap in ranges, `0.6`. 0.6
ResColor Resistance line color. Resistance colour, `clrTomato`. tomato
SupColor Support line color. Support colour, `clrDodgerBlue`. dodger blue
ShowLines Draw the trend lines on chart. Draw the trendlines, `true`. on

Alert settings

Setting What it does Default
EnableAlerts Master alert switch, `true`. on
EnablePopup Popup, `true`. on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
trendline breakout alert indicator: Inputs panel, swing depth above the break buffer.
Inputs panel, swing depth above the break buffer.

Which markets and timeframes suit it

Five-bar swings give lines that last a few days on the hourly EURUSD screenshot. On M15 they redraw often. On D1 they match hand-drawn trendlines.

Its weaknesses

Lines through two swings are fragile.

A quarter range is a modest buffer.

Steep lines break often and falsely.

Out of the box, only popups report.

Copy the compiled Trendline Breakout Alert 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.

Related on forexmt4systems.com: London Session Breakout Strategy.

Download the Trendline Breakout Alert Indicator for MT4 and MT5

The zip holds the compiled Trendline Breakout Alert 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

What does BreakBuffer 0.25 require?

A close at least a quarter of the average range beyond the projected line. The build ignores closes that barely poke through, which removes many false breaks.

Which swings does Depth 5 connect?

The two most recent swing highs, each with five lower highs on both sides, form resistance. The two most recent swing lows form support in the same way.

How does this differ from a trendline price alert?

Both draw lines through recent swings. This build adds the quarter-range buffer and a four-bar cooldown, so breaks must be clearer before a mark prints.

Why does CooldownBars 4 matter?

Price often chops around a line after breaking it. The cooldown keeps one mark per break instead of several on the bars that follow, which makes the chart easier to read.

Are results guaranteed?

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

Category: this is part of our Trend collection. 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