Dynamic Support Resistance Indicator: ATR-Clustered Zones

Written by Dominic Walsh · Published · Last updated

The dynamic support resistance indicator ranks levels by where price is now. It gathers swing pivots across `InpLookback` bars, groups any that sit within half an ATR of each other, then draws only the three nearest zones above and below the current close. Levels move as price does.

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: ResZone, SupZone
Alerts popup
Inputs 7

What the Dynamic Support Resistance Indicator draws on the chart

ResZone puts a dodger blue mark on a bar that reached a resistance level and closed below it.

SupZone puts a red mark on the mirror case at a support level.

OBJ_HLINE objects carry the drawn zones themselves.

Only `InpZonesShown` levels appear on each side, so the chart stays readable.

  • ResZone: arrow, dodger blue, width 2, arrow code 234
  • SupZone: arrow, red, width 2, arrow code 233
Dynamic support resistance indicator on EURUSD H1 with the nearest clustered zones
Dynamic support resistance indicator on EURUSD H1 with the nearest clustered zones

How the Dynamic Support Resistance Indicator calculates its values

Collecting the pivots

A swing high needs `InpSwingStrength` `3` bars on each side that fail to beat it. The scan reaches back `InpLookback` `200` bars and stops once it has `InpMaxLevels` `5` on each side. Highs and lows go into separate arrays.

Clustering by volatility

width takes the current ATR at `InpAtrPeriod` `14` times `InpAtrMult` `0.5`. Pivots closer together than that width merge into one zone. Because the width comes from ATR, the same setting groups sensibly on a quiet pair and a fast one.

Picking what to draw

The code sorts the surviving zones by distance from the current close, then keeps `InpZonesShown` `3` on each side. tol for a touch takes a quarter of the bar ATR, with a floor of three points. A touch needs the bar to reach the level and close on the correct side of it.

How to read the signals

Zones are ordered by proximity, so the nearest ones are the ones you see.

A mark means price reached a level and failed to close through it.

Levels shift as older pivots drop out of the `InpLookback` window.

Widen `InpAtrMult` to merge more pivots into fewer, thicker zones.

Alert channels in this build: popup, one message per closed bar.

`InpAlerts` ships on and raises a terminal popup when price touches a drawn level. This build carries no push, email or sound channel. The guard permits one message per closed bar, so a bar sitting on a zone will not repeat.

Every Dynamic Support Resistance Indicator input

Core settings

Setting What it does Default
InpLookback Lookback window (bars). Bars in the pivot scan, default `200`. 200
InpSwingStrength Swing pivot strength (bars each side). Bars each side of a pivot, default `3`. 3
InpMaxLevels Max swing highs/lows to collect. Pivots collected on each side before the scan stops, default `5`. 5
InpAtrPeriod ATR period for clustering. ATR length behind the cluster width, default `14`. 14
InpAtrMult ATR multiplier for cluster width. Cluster width in ATR units, default `0.5`. 0.5
InpZonesShown Top zones each side to draw. Zones drawn on each side, default `3`. 3

Alert settings

Setting What it does Default
InpAlerts Alert on level touch. Popup when price touches a level, default `true`. on
Dynamic support resistance indicator inputs: InpLookback, InpSwingStrength, InpAtrMult, InpZonesShown
Dynamic support resistance indicator inputs: InpLookback, InpSwingStrength, InpAtrMult, InpZonesShown

Settings that fit your chart

Clustered levels want a chart with repeated turns at similar prices. EURUSD H1 is the reference chart, where `InpLookback` at `200` covers about eight trading days. On M5 that window is under a day and the zones churn quickly. On H4 the same setting spans a month of structure.

When the Dynamic Support Resistance Indicator fails

Proximity is not importance. The nearest zone is not always the one that matters.

A pivot from eight days ago carries the same weight as one from yesterday.

`InpMaxLevels` `5` caps the collection early, so a busy chart loses genuine levels.

Copy the compiled Dynamic 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.

Background reading on the method behind the Dynamic Support Resistance Indicator: Dynamic currency conversion on Wikipedia, Cme Futures And Spot Prices at StockCharts ChartSchool.

Download the Dynamic Support Resistance Indicator for MT4 and MT5

The zip holds the compiled Dynamic 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 InpAtrMult at 0.5 group together?

Pivots that sit within half the current ATR of each other. On a chart where ATR reads 20 pips, that is a 10 pip band. Raise it and more pivots merge into fewer, thicker zones. Lower it for more zones built from fewer pivots each.

Why does InpZonesShown cap the drawing at three?

Because two hundred bars produce far more levels than a chart can carry. Three per side is readable and keeps the nearest structure in view. Raise it if you would rather see the whole set, at the cost of a busier chart.

How does InpSwingStrength define a pivot?

The bar must beat every bar within three positions on each side. That is a small window on purpose, since the clustering step does the real filtering afterwards. Raise it if you want only larger turns feeding the zones.

What makes a ResZone mark appear?

A bar that reached a resistance level within tolerance and still closed below it. Tolerance is a quarter of the bar ATR, with a three point floor. So the mark records a rejection rather than a mere touch.

Are results guaranteed?

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

Category: this is part of our Support and Resistance collection. Also, truly, browse more Support and Resistance 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