The trendline alert indicator draws the diagonal you would draw by hand. Two deep pivots anchor each line. A twelve-bar fractal is a demanding test, so the lines it finds are the obvious ones rather than every wiggle.
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: Trendline Break Buy, Trendline Break Sell |
| Alerts | popup, push notification, email, sound |
| Inputs | 13 |
What the Trendline alert Indicator draws on the chart
`Trendline Break Buy` uses arrow 233 in aqua.
`Trendline Break Sell` uses arrow 234 in tomato.
`ShowLines` adds the projected trend objects in tomato and dodger blue.
Mark distance scales with range at `ArrowMult` `1.0`.
- Trendline Break Buy: arrow, aqua, width 2, arrow code 233
- Trendline Break Sell: arrow, tomato, width 2, arrow code 234

How the Trendline alert Indicator calculates its values
Deep pivots only
`Depth` `12` asks a bar to beat twelve neighbours on each side. That is far stricter than a three-bar test, so the pivot list stays short and the lines stay meaningful.
Two points make a slope
Given two pivot highs the code works out the slope between them, then evaluates that line at the current bar. Falling lines come from highs and rising ones from lows.
A close cuts it
The current close must sit beyond the projected level while the previous close sat on the other side. Comparing both bars is what makes it a break rather than a state.
How to read the signals
A twelve-bar pivot confirms twelve bars late, so each line arrives well after its anchor.
The level a break needs changes every bar, because the line slopes.
Arrow distance follows range, so it suits any instrument without tuning.
`LineWidth` `2` keeps the projections visible under price.
Alert channels in this build: popup, push notification, email and sound, one message per closed bar.
`EnableAlerts` is the umbrella and starts true with `EnablePopup`. `EnablePushNotify` raises a phone alert, `EnableEmail` posts mail and `EnableSound` sounds `SoundFile`. Those three arrive off. Nothing fires until the cutting bar has closed.
Every Trendline alert Indicator input
Core settings
| Setting | What it does | Default |
|---|---|---|
Depth |
fractal half-width for swing pivots. Half-width of the fractal that confirms a pivot, default `12`. | 12 |
ATRPeriod |
ATR length for arrow offset. Window behind the arrow spacing, default `14`. | 14 |
Display settings
| Setting | What it does | Default |
|---|---|---|
ArrowMult |
arrow distance = ATR * this. Arrow distance as a multiple of range, default `1.0`. | 1.0 |
ResColor |
resistance trend line. Line colour above price, default `clrTomato`. | tomato |
SupColor |
support trend line. Line colour below price, default `clrDodgerBlue`. | dodger blue |
LineWidth |
trend-line width. Thickness of both projections, default `2`. | 2 |
ShowLines |
draw the projected trend lines. Draw the projected lines at all, default `true`. | on |
Alert settings
| Setting | What it does | Default |
|---|---|---|
EnableAlerts |
Umbrella above the four delivery routes, default `true`. | on |
EnablePopup |
Terminal box when a projection gets cut, default `true`. | on |
EnablePushNotify |
Phone alert when a projection gets cut, default `false`. | off |
EnableEmail |
(see inputs panel) | off |
EnableSound |
(see inputs panel) | off |
SoundFile |
(see inputs panel) | alert.wav |

Settings that fit your chart
Deep pivots need history. EURUSD H1 is the reference chart. A twelve-bar fractal there covers half a day either side. On M5 the lines still form but redraw often. H4 holds one line for weeks.
When the Trendline alert Indicator fails
Twelve bars of confirmation each side is a long wait for a fresh line.
Only the newest pair of pivots anchors each line, so older structure gets dropped.
A sloping level makes a break partly a matter of timing.
Copy the compiled Trendline 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.
Background reading on the method behind the Trendline alert Indicator: Foreign exchange option on Wikipedia, Stockcharts Pseudo Symbols at StockCharts ChartSchool.
Download the Trendline alert Indicator for MT4 and MT5
The zip holds the compiled Trendline 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.
FAQ
Why does Depth 12 give better lines?
It rejects small turns. A bar must beat twelve neighbours on each side, so only significant swings become anchors. Fewer, larger pivots mean the lines match what an experienced eye would draw.
How does ArrowMult 1.0 space the marks?
It sets the gap as one full range reading rather than a fixed point count. A busy session pushes the arrow further out and a quiet one keeps it close, with no per-instrument tuning needed.
What does ShowLines change?
Only whether the projections appear. The break test runs either way, so switching it off gives you arrows on a clean chart while the underlying calculation carries on unchanged.
Does a Trendline Break Buy need a close?
Yes, and the previous close must sit on the other side of the line. A wick that pierces the projection and pulls back within the same bar leaves nothing behind.
Are results guaranteed?
No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Trendline 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
- For background on this concept, see Foreign exchange option on Wikipedia.
- For broader market context, see Stockcharts Pseudo Symbols at StockCharts ChartSchool.
