Trendline by Angle Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

Hand-drawn trendlines depend on which swings you pick. The trendline by angle indicator removes that choice: it starts a line at the latest swing low and swing high and gives each a fixed angle of 30 degrees, scaled by the average range. A touch of the line that closes back on its right side prints a mark.

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

What each plot looks like

Two angled lines and two marks on price.

`UpLineColor` `clrLime` draws the rising line.

`DnLineColor` `clrRed` draws the falling line.

`Angle Line Buy` prints lime with arrow 233.

`Angle Line Sell` prints red with arrow 234.

Lines restart when a new swing confirms.

  • Angle Line Buy: arrow, lime, width 2, arrow code 233
  • Angle Line Sell: arrow, red, width 2, arrow code 234
trendline by angle indicator: Fixed-angle trendlines with touch marks, EURUSD H1.
Fixed-angle trendlines with touch marks, EURUSD H1.

How the Trendline by Angle Indicator calculates its values

Anchors

`Depth` `8` bars on each side confirm a swing. The newest swing low anchors the rising line.

Angle

`AngleDegrees` `30.0` sets the tilt. The build turns it into price per bar using the `AtrPeriod` `14` range, times `SlopeScale` `1.0`.

Touch

A bar whose low comes within `TouchTolAtr` `0.20` of a range of the rising line and closes above it prints a buy.

How to watch it

Green rises from the newest swing low.

Red, by contrast, falls from the newest swing high.

So a lime mark is a touch that held.

Likewise, a red mark is a rejection from above.

`ArrowGapAtr` `0.60` also spaces the marks.

Swings confirm eight bars late.

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

Touches that hold send one message per bar under `EnableAlerts`, with the popup the only route on by default.

Every Trendline by Angle Indicator input

Core settings

Setting What it does Default
Depth fractal half-width for swing pivots. Bars on each side of a swing, `8`. 8
AtrPeriod ATR period (angle-to-price scaling). Range window for the slope, `14`. 14
AngleDegrees fixed trend-line angle in degrees. Line tilt in degrees, `30.0`. 30.0
SlopeScale extra multiplier on the ATR slope. Extra slope multiplier, `1.0`. 1.0
TouchTolAtr touch tolerance as fraction of ATR. Touch distance in ranges, `0.20`. 0.20

Display settings

Setting What it does Default
ArrowGapAtr arrow offset from bar in ATR units. Mark gap in ranges, `0.60`. 0.60
UpLineColor Rising line colour, `clrLime`. lime
DnLineColor Falling line colour, `clrRed`. red

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 by angle indicator: Inputs panel, angle and slope settings above the colours.
Inputs panel, angle and slope settings above the colours.

Where this one belongs

Fixed-angle lines suit trending charts. On the hourly EURUSD screenshot, a new line forms every few days. On M15 lower `AngleDegrees` for gentler lines, while on D1 a 30-degree line matches steady trends.

Where this one struggles

A fixed angle ignores how steep the trend really is.

Lines restart with each new swing.

Touches in sideways markets mean little.

Only the popup is on at first.

Copy the compiled Trendline by Angle 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 by Angle Indicator: Trend line (technical analysis) on Wikipedia, Average True Range at Investopedia.

Download the Trendline by Angle Indicator for MT4 and MT5

The zip holds the compiled Trendline by Angle 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

How does AngleDegrees 30.0 become a price slope?

The build takes the tangent of 30 degrees, about 0.58, and multiplies it by the average range at the swing. The line rises that much per bar.

What does TouchTolAtr 0.20 count as a touch?

A bar whose low comes within a fifth of an average range of the rising line. The bar must also close above the line for the mark to print.

Why do the Angle Line Buy lines restart?

Each line anchors to the newest confirmed swing. Once a fresh swing low confirms, the rising line starts over from that new low, keeping the same thirty-degree tilt as before.

Is a fixed AngleDegrees line better than two-point lines?

It is more consistent. Two-point lines come out steep or flat depending on which swings happened to form; this one keeps the same slope every time, so touches mean the same thing.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Trendline by Angle 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