Buy Sell Trend Indicator: DI Cross Arrows With ADX 14

Written by Dominic Walsh · Published · Last updated

The buy sell trend indicator draws BUY and SELL arrows straight on the price chart. It watches the two directional lines behind ADX and marks the bar where they swap places. A strength check has to pass at the same time, so it ignores crosses in flat conditions.

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: BUY, SELL
Alerts popup
Inputs 5

What the Buy sell trend Indicator draws on the chart

BUY (lime, code 233) sits under the bar low when the positive directional line crosses above the negative one.

SELL (red, code 234) sits above the bar high on the opposite cross.

It plots nothing else. There is no line on the chart, only the two markers.

  • BUY: arrow, lime, width 3, arrow code 233
  • SELL: arrow, red, width 3, arrow code 234
EURUSD H1: the buy sell trend indicator printing a BUY arrow under the bar after a DI cross.
EURUSD H1: the buy sell trend indicator printing a BUY arrow under the bar after a DI cross.

How the Buy sell trend Indicator calculates its values

Reading the directional lines

Four calls pull the positive and negative directional values for the current bar and the one before it, all at the AdxPeriod length. A fifth call pulls the main strength value.

A cross then comes down to a plain comparison. The positive line has to sit at or below the negative one on the earlier bar, and above it now.

Filtering by trend strength

A cross on its own prints nothing. The main value has to clear AdxThreshold on the same bar before a marker appears.

That is what keeps the chart clean through quiet stretches, when the two directional lines cross back and forth with no move behind them.

What happens on the first attach

MaxBars caps how much history the first pass covers. It defaults to 1500 bars, and the code takes whichever is smaller, that cap or the chart itself.

After that pass only new bars get calculated. The cap keeps that first attach quick on a chart with deep history, and it plays no part in the signal rule.

How to read the signals

A lime BUY says the positive directional line has just taken the lead while the strength reading agrees a move is running.

A red SELL says the negative line has taken over instead.

Long gaps with no markers usually mean the strength reading has been sitting under AdxThreshold, not that no crosses happened.

Markers sit on the bar of the cross. They do not move after that bar closes.

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

The alert here is the MT4 popup only. There is no push, email or sound option in the inputs, and a bar time check keeps it to one popup per closed bar.

Every Buy sell trend Indicator input

Core settings

Setting What it does Default
AdxPeriod ADX / DI Wilder smoothing period. AdxPeriod sets the smoothing length for the strength reading and both directional lines. It defaults to 14. 14
AdxThreshold Minimum ADX to confirm trend. AdxThreshold is the minimum strength a cross needs. It defaults to 20.0. Raising it to 25 or 30 cuts the marker count and skips weaker moves. 20.0

Display settings

Setting What it does Default
ArrowOffsetPts Arrow offset from bar high/low (points). ArrowOffsetPts is the gap in points between a marker and its candle. It defaults to 30 and has no effect on when a signal fires. 30

Alert settings

Setting What it does Default
EnableAlerts Enable alerts on closed bar. on
MaxBars Max bars to compute on first attach (perf cap). MaxBars limits the first calculation pass to 1500 bars by default. Raise it if you want markers further back in history. 1500
Inputs panel for the buy sell trend indicator with AdxPeriod, AdxThreshold and ArrowOffsetPts.
Inputs panel for the buy sell trend indicator with AdxPeriod, AdxThreshold and ArrowOffsetPts.

Settings that fit your chart

The screenshot uses EURUSD H1. Directional crosses filtered by strength suit charts where a move lasts more than a handful of bars, so H1 and H4 give the cleanest result. On M1 and M5 the two lines cross constantly and AdxThreshold does almost all the filtering. Raising that threshold usually fixes a chart that prints too many markers.

When the Buy sell trend Indicator fails

The strength reading rises after a move has started. Both the gate and the cross trail the turn, so a marker rarely lands at the extreme.

A choppy chart can still lift the reading over 20.0 briefly. Markers in that window tend to come in pairs pointing opposite ways.

The cross and the strength check are the only rules here. There is no level, no channel and no wider context beyond that one reading.

Setting MaxBars low leaves older parts of the chart unmarked, which can look like missed signals rather than bars the code never calculated.

Copy the compiled Buy sell trend 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 Buy sell trend Indicator: Triple exponential moving average on Wikipedia, Basecurrency at Investopedia.

Download the Buy sell trend Indicator for MT4 and MT5

The zip holds the compiled Buy sell trend 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 AdxThreshold at 20.0 actually block?

It stops a directional cross from printing anything while the strength reading sits below 20.0. Crosses still happen underneath that level, they simply produce nothing on the chart. Raising AdxThreshold makes the tool wait for a stronger reading, and the marker count drops with it.

Does the BUY arrow move after the bar closes?

No. The code puts it at the bar low minus ArrowOffsetPts, using values from bars that have already finished. Once the candle closes, nothing about the cross or the strength reading behind it can change, so the marker holds its place.

Why is the MT4 popup the only alert channel here?

This build carries a single alert channel. EnableAlerts turns the MT4 popup on or off, and the inputs offer no email, sound or mobile option at all. If you want a phone alert, run it alongside a tool that carries one, or watch the chart yourself.

How far back does MaxBars let markers appear?

MaxBars decides that. At the default of 1500 the first pass covers the newest 1500 bars, or the whole chart if it happens to be shorter. Older candles stay unmarked until you raise the value and reload the file onto the chart.

Are results guaranteed?

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

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