Automatic Support & Resistance Indicator: Six Levels

Written by Dominic Walsh · Published · Last updated

The automatic support & resistance indicator counts touches rather than guessing. Fractal pivots across `Lookback` `400` bars get collected. Pivots sitting within a tolerance merge into one level. The busiest six then get drawn.

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 0
Alerts popup, push notification, email, sound
Inputs 17

What the Automatic Support & Resistance Indicator draws on the chart

Horizontal rays mark each surviving level, drawn as chart objects rather than plot buffers.

`ResColor` `clrCrimson` marks a level above current price.

`SupColor` `clrLimeGreen` marks one below it.

Each ray carries a right-edge tag with its price and touch count, and a corner panel summarises the map.

Automatic support & resistance indicator clustered levels on the EURUSD H1 chart.
Automatic support & resistance indicator clustered levels on the EURUSD H1 chart.

How the Automatic Support & Resistance Indicator calculates its values

Pivots first

`FractalDepth` `4` confirms a swing high or low with four bars on each side. The scan runs back `Lookback` `400` bars and collects every pivot price it finds.

Then clustering

`ClusterPoints` `200` sets how close two pivots must sit to count as the same level. The code walks the sorted price list and merges neighbours inside that distance, then averages each group into a single price.

Strength is the touch count

A cluster built from five pivots outranks one built from two. `MaxLevels` `6` keeps only the strongest, which is what stops a four-hundred-bar scan burying the chart in lines.

How to read the signals

Colour reports position against price now, so a level flips colour when price crosses it.

The touch count in each tag is the evidence behind that line.

Levels redraw as the four-hundred-bar window moves forward.

There are no plot buffers here, so nothing appears in the data window.

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

`EnableAlerts` sits above four routes and starts true beside `EnablePopup`. Set `EnablePushNotify` for the phone, `EnableEmail` for mail, or `EnableSound` to play `SoundFile`. Those three ship off. A touch reports at most once per closed bar.

Every Automatic Support & Resistance Indicator input

Core settings

Setting What it does Default
Lookback Bars scanned for pivots. Bars scanned for pivots, default `400`. 400
FractalDepth Bars either side of a pivot. Bars either side that confirm a pivot, default `4`. 4
ClusterPoints Merge pivots within N points. How close two pivots merge, in points, default `200`. 200
MaxLevels Strongest levels to draw. How many of the strongest levels get drawn, default `6`. 6

Display settings

Setting What it does Default
ResColor Resistance (above price). Colour above current price, default `clrCrimson`. crimson
SupColor Support (below price). Colour below current price, default `clrLimeGreen`. lime green
LineWidth Level line width. Thickness of each ray, default `2`. 2
LabelFont Price-label font size. 8
ShowPanel Show summary panel. Show the summary readout, default `true`. on
PanelCorner 0=UL 1=UR 2=LL 3=LR. 0
PanelBg (see inputs panel) black

Alert settings

Setting What it does Default
EnableAlerts Head switch over the alert routes, default `true`. on
EnablePopup Terminal box when price touches a level, default `true`. on
EnablePushNotify (see inputs panel) off
EnableEmail (see inputs panel) off
EnableSound (see inputs panel) off
SoundFile (see inputs panel) alert.wav
Automatic support & resistance indicator inputs panel with Lookback and ClusterPoints.
Automatic support & resistance indicator inputs panel with Lookback and ClusterPoints.

Settings that fit your chart

A four-hundred-bar scan needs history to chew on. EURUSD H1 is the reference chart, where that reaches back about two and a half weeks. On M5 the same count covers a day and a half. Daily charts stretch it past a year.

When the Automatic Support & Resistance Indicator fails

`ClusterPoints` `200` counts points, so the merge distance needs setting per instrument.

A level with two touches gets drawn alongside one with six unless the cap removes it.

Pivots confirm four bars late, so the newest turn is never in the map yet.

Copy the compiled Automatic Support & Resistance 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: Support and Resistance Strategy.

Download the Automatic Support & Resistance Indicator for MT4 and MT5

The zip holds the compiled Automatic Support & Resistance 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 ClusterPoints 200 merge?

Pivot prices sitting within two hundred points of each other. They become one level at their average price. On a five-digit pair that is twenty pips, which is wide enough to group a zone that price tested repeatedly.

How does FractalDepth 4 affect the map?

It sets how selective the pivot test is. Four bars either side rejects small wiggles and keeps genuine swings. Raising it gives fewer, stronger pivots and therefore fewer clusters worth drawing.

Why does MaxLevels 6 exist?

Four hundred bars produce far more clusters than a chart can show. Six is about what stays readable. The cap keeps the strongest by touch count, so raising it adds progressively weaker levels.

Does Lookback fill any plot buffers?

No. Every line, tag and panel is a chart object rather than a plot buffer, which is why the data window stays empty. It also means the levels survive a chart refresh without recalculating.

Are results guaranteed?

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

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