Doji Reader Indicator: Doji Detection With a Trend Filter

Written by Dominic Walsh · Published · Last updated

A doji on its own tells you very little. The doji reader indicator handles that by testing two things. First, whether the candle really qualifies by body and wick proportion. Second, whether it arrived at the end of a directional run. Every doji it finds gets a gold dot. Only the ones following a run in one direction earn a buy or sell arrow.

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 3: Doji Dot, Buy, Sell
Alerts popup
Inputs 5

What the Doji Reader Indicator draws on the chart

Doji Dot places a gold marker above every candle that clears the shape test.

Buy prints a lime arrow below a doji that ended a downward run.

Sell prints a red arrow above a doji that ended an upward run.

Dots and arrows can share a candle, since one describes the shape and the other the context.

  • Doji Dot: arrow, gold, width 2, arrow code 159
  • Buy: arrow, lime, width 2, arrow code 233
  • Sell: arrow, red, width 2, arrow code 234
Doji reader indicator on EURUSD H1 with gold doji dots and filtered buy and sell arrows
Doji reader indicator on EURUSD H1 with gold doji dots and filtered buy and sell arrows

How the Doji Reader Indicator calculates its values

Testing the candle shape

Two proportions decide whether a candle qualifies. `InpBodyRatio` caps the body as a share of the full high to low range. `InpWickRatio` sets how long the wicks must run relative to that body. Using ratios rather than pip values lets the same settings work on a quiet pair and a volatile one without adjustment.

Checking what came before

A short loop walks back `InpTrendBars` candles and compares each close with the one before it. downTrend starts true and clears the moment close[i + k] matches or beats close[i + k + 1]. upTrend clears on the opposite comparison. Only an unbroken run survives, so a downtrend needs three consecutive lower closes by default.

Choosing the arrow

The doji’s own body decides which direction it suggests. bullishDoji holds when close[i] >= open[i], and bearishDoji covers the reverse. A bullish doji ending a downward run writes BuyArr at low[i] minus offset. A bearish doji ending an upward run writes SellArr at high[i] plus offset, where offset comes from `InpArrowOffset` in points.

How to read the signals

Gold dots without an arrow mark doji that appeared mid-range, where the pattern carries least information.

An arrow means the shape test and the trend test both passed on the same bar.

The arrow points against the run before it, since the pattern reads as hesitation after a directional move.

Several dots in a row without arrows suggest the market is drifting rather than trending.

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

Signals reach you through a terminal popup only. `InpAlertsOn` defaults to `true`, and the message waits for the bar to close. That matters here, because a candle can look like a doji while forming and then close with a full body.

Every Doji Reader Indicator input

Core settings

Setting What it does Default
InpBodyRatio Max body/range ratio for doji. Largest body allowed as a fraction of the candle’s range, default `0.10`. Raise it toward 0.20 to admit near-doji candles. 0.10
InpWickRatio Min wick-to-body ratio. Smallest wick-to-body ratio accepted, default `1.5`, which keeps flat candles with tiny wicks out. 1.5
InpTrendBars Bars to confirm prior trend. Consecutive closes needed to call a prior run, default `3`. Increase it to demand a longer move before any arrow. 3

Display settings

Setting What it does Default
InpArrowOffset Arrow offset in points. Gap between candle and arrow in points, default `10`. 10

Alert settings

Setting What it does Default
InpAlertsOn Enable alerts on closed bar. on
Doji reader indicator inputs showing InpBodyRatio, InpWickRatio and InpTrendBars
Doji reader indicator inputs showing InpBodyRatio, InpWickRatio and InpTrendBars

Settings that fit your chart

Candle patterns need candles with structure, which rules out the fastest charts where spread dominates the body. EURUSD H1 is the reference capture. H1 and H4 give doji that mean something, and the daily chart gives fewer but stronger ones. On M1 almost any bar clears a 0.10 body ratio during a quiet hour, so expect dots everywhere and few useful arrows.

When the Doji Reader Indicator fails

A three bar run sets a low bar for calling a trend. Plenty of arrows will follow moves that never amounted to more than a drift.

The body ratio measures against the candle’s own range, so a doji inside a very small range clears the test while representing almost no activity.

Doji cluster around session changes and thin liquidity, where the hesitation they show concerns participation rather than any change of intent.

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

Download the Doji Reader Indicator for MT4 and MT5

The zip holds the compiled Doji Reader 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 a Doji Dot sometimes appear with no arrow?

The two tests run separately. Doji Dot marks any candle clearing the shape test set by `InpBodyRatio` and `InpWickRatio`. The arrow needs something extra: an unbroken run of `InpTrendBars` closes in one direction immediately before it. A doji in the middle of a range clears the first test and fails the second.

What does InpWickRatio at 1.5 rule out?

Candles with a small body and equally small wicks, which look like a doji by body alone but really amount to a quiet bar. Requiring wicks at least one and a half times the body means the candle must have travelled and come back, which is the rejection this pattern is meant to describe.

Is InpTrendBars at 3 enough to call a trend?

It runs deliberately loose, and it is the first setting to change. The default `3` means three consecutive closes in one direction, which catches short pushes as well as real moves. Raising it to five or six cuts the arrow count and leaves the doji that follow a more convincing run.

Does the Buy arrow direction come from the doji or the prior trend?

Both must agree. The run before the candle decides which arrow is possible, and the doji’s own close against its open decides whether it qualifies. A bullish doji after a downward run gives a buy. A bullish doji after an upward run gives nothing, because the code looks for hesitation against the move rather than with it.

Are results guaranteed?

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

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