DeMark Trend Alert Indicator for MT4 and MT5

Written by Dominic Walsh · Published · Last updated

The demark trend alert indicator counts rather than measures. Compare each close with the close four bars earlier. Nine in a row on the same side completes a setup, and the ninth bar gets a mark. Tom DeMark built the count to find where a run has gone on long enough.

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: TD Bullish Setup 9, TD Bearish Setup 9
Alerts popup, push notification, email, sound
Inputs 9

Plot by plot

Two arrow plots on the price chart.

`TD Bullish Setup 9` uses arrow 233 in dodger blue.

`TD Bearish Setup 9` uses arrow 234 in crimson.

Bullish marks hang below the low.

Bearish marks sit above the high.

`ArrowOffsetPips` `5.0` sets that gap.

  • TD Bullish Setup 9: arrow, dodger blue, width 2, arrow code 233
  • TD Bearish Setup 9: arrow, crimson, width 2, arrow code 234
demark trend alert indicator: A completed nine-bar count marked on EURUSD H1.
A completed nine-bar count marked on EURUSD H1.

How the source computes it

The comparison

One close against another. `LookbackOffset` `4` decides which one. Each bar meets the close four back, and nothing else enters the test.

Counting to nine

The run must stay whole. `SetupLength` `9` bars all closing above their reference completes a bullish setup. A single bar on the other side resets the counter.

Marking the ninth

Only the completing bar earns an arrow. Bars one through eight of the run stay bare, so a long trend leaves a scattering rather than a wall.

Reading it in practice

A mark says a nine-bar run just completed.

Colour tells you which side the run ran on.

A completed count means exhaustion, not reversal.

Counts complete more often in a steady drift.

One bar against the run resets the whole count.

Both sides can complete within a few bars in a range.

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

`EnableAlerts` governs the count alerts and arrives true with `EnablePopup`. `EnablePushNotify` reaches a phone, `EnableEmail` posts mail and `EnableSound` plays `SoundFile`. Those three start off, and each count reports once.

Every Demark Trend Alert Indicator input

Core settings

Setting What it does Default
SetupLength Setup count target (DeMark = 9). Closes needed in a row, `9`. 9
LookbackOffset Bars-ago compare offset (DeMark = 4). Bars back for the comparison, `4`. 4

Display settings

Setting What it does Default
ArrowOffsetPips Arrow distance from bar high/low (pips). Pips between mark and candle, `5.0`. 5.0

Alert settings

Setting What it does Default
EnableAlerts Master switch, `true`. on
EnablePopup Box in the terminal, `true`. on
EnablePushNotify Buzz on a phone, `false`. off
EnableEmail Mail on a completed count, `false`. off
EnableSound Cue on a completed count, `false`. off
SoundFile Which clip plays, `”alert.wav”`. alert.wav
demark trend alert indicator: Inputs panel with SetupLength and LookbackOffset.
Inputs panel with SetupLength and LookbackOffset.

Chart and timeframe notes

Nine bars is a short window on any chart, so the count travels well. EURUSD H1 is the reference chart. Counts complete a few times a week there. On M5 they complete daily. On daily bars each one covers a fortnight.

Where it falls down

A completed count often precedes more of the same trend.

The test ignores how far price moved.

A single close on the other side wipes eight bars of work.

Nothing here confirms the count with anything else.

Copy the compiled Demark Trend 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 Demark Trend Alert Indicator: Price action trading on Wikipedia, DeMarker Indicator at BabyPips.

Download the Demark Trend Alert Indicator for MT4 and MT5

The zip holds the compiled Demark Trend 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

Why does LookbackOffset compare four bars back?

DeMark chose four, and the choice matters. Comparing with the previous close would turn the count into a simple streak. Skipping back four asks whether the market has genuinely progressed across a short span.

What does a completed SetupLength 9 mean?

That nine bars in a row closed on the same side of their reference. DeMark read that as a run long enough to tire, which describes persistence rather than predicting anything.

Can one close break a SetupLength 9 run?

Yes, immediately. The run must stay whole, so a single bar closing on the wrong side sends the counter back to zero however many bars had already stacked up behind it.

Why does only bar nine get a TD Bullish Setup 9 arrow?

Because bars one through eight are an incomplete setup. An arrow on each of them would fill the chart during any steady trend, and the count only means something once it finishes.

Are results guaranteed?

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

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