Disparity Index Indicator: Percent Away From The Mean

Written by Dominic Walsh · Published · Last updated

The disparity index indicator measures distance in percent. Steve Nison named the reading in Beyond Candlesticks. It asks how far a close sits from its own average. Divide by that average and the number works on any chart.

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 Separate window (levels 0)
Plots 7: Disparity above average, Disparity below average, Disparity smoothing, Upper rail, Lower rail, Re-entry from below, Re-entry from above
Alerts popup, push notification, email, sound
Inputs 27

What the Disparity Index Indicator draws on the chart

Columns fill the pane. One colour sits above zero and one below.

A pale `Disparity smoothing` line runs over them at `InpSignalPeriod` `5`.

Two rails track the spread of the reading itself.

Arrows mark a re-entry. A small panel prints the current numbers.

  • Disparity above average: histogram, custom RGB colour, width 3
  • Disparity below average: histogram, custom RGB colour, width 3
  • Disparity smoothing: line, gainsboro, width 2
  • Upper rail: line, custom RGB colour, width 1
  • Lower rail: line, custom RGB colour, width 1
  • Re-entry from below: arrow, custom RGB colour, width 2, arrow code 233
  • Re-entry from above: arrow, custom RGB colour, width 2, arrow code 234
Disparity index indicator columns, rails and re-entry arrows on EURUSD H1.
Disparity index indicator columns, rails and re-entry arrows on EURUSD H1.

How the Disparity Index Indicator calculates its values

One formula, two colours

iMA gives the average at `InpMaPeriod` `14`. The code takes the close and subtracts that average. Then it divides by the average and multiplies by a hundred. Both column buffers copy the same number, so the colours cannot disagree.

The rails breathe

`InpBandWindow` `100` bars feed a rolling mean and spread. `InpBandSigma` `2.0` sets how far each rail sits from that mean. A fixed band would mean little from one chart to the next.

Three guards thin the arrows

A mark needs the reading to come back inside a rail. The move outside has to be real, not a graze. `InpAmpGate` `0.25` asks for extra depth past the rail over `InpAmpLookback` `14` bars. `InpMinBarsApart` `10` keeps two marks on one side apart.

How to read the signals

Zero is the average itself, not a guess.

A tall column says price ran far from that average.

Arrows point at a return inside a rail, never at the extreme.

`InpShowPanel` hides the readout when it crowds the chart.

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

Four routes exist and `EnableAlerts` gates them all. `EnablePopup` is the one that ships true. `EnablePushNotify` reaches a phone. `EnableEmail` sends mail. `EnableSound` plays `SoundFile`. Each closed bar can send one message.

Every Disparity Index Indicator input

Core settings

Setting What it does Default
InpMaPeriod Moving-average period n used as the disparity reference. Bars in the reference average, default `14`. 14
InpMaMethod Averaging method for the reference average. How that average gets built, default `MODE_SMA`. MODE_SMA
InpAppliedPrice Price the reference average is built from. Price the average reads, default `PRICE_CLOSE`. PRICE_CLOSE
InpSignalPeriod Simple average applied to the disparity series. Bars in that pale line, default `5`. 5
InpBandWindow Bars used for the rolling mean and standard deviation. Bars behind the rolling mean, default `100`. 100
InpBandSigma Rail distance in standard deviations of the disparity series. How far a rail sits from that mean, default `2.0`. 2.0
InpAmpGate Extra sigma the excursion must reach BEYOND the rail. Extra depth a move must reach past a rail, default `0.25`. 0.25
InpAmpLookback Bars scanned back to measure the excursion that just ended. Bars behind the depth check, default `14`. 14
InpMinBarsApart Minimum bars between two arrows on the same side. Bars between two marks on one side, default `10`. 10
InpX Panel X offset (px). 12
InpY Panel Y offset (px) on the MAIN chart window. 120

Display settings

Setting What it does Default
InpShowSignal Draw the smoothing line over the disparity columns. Draw the pale line over the columns, default `true`. on
InpArrowOffset Arrow offset from the rail, share of the plotted span. Gap between a mark and its rail, default `0.12`. 0.12
InpShowPanel Show the disparity readout panel. Show the readout panel, default `true`. on
InpCorner Panel corner (0=UL 1=UR 2=LL 3=LR). 0
InpFontSize Panel font size. 9
InpFont Panel font. Consolas
InpMaxPanelWidthPx Hard cap on the panel background width in pixels. 900
InpPanelBg Panel background colour. RGB 12,20,34
InpBorderColor Panel border colour. RGB 80,140,255
InpTextColor Panel text colour. gainsboro

Alert settings

Setting What it does Default
EnableAlerts Master alert switch. on
EnablePopup Terminal popup alert. on
EnablePushNotify Push notification to the phone. off
EnableEmail Email alert. off
EnableSound Play a sound file. off
SoundFile Sound file name. alert.wav
Disparity index indicator inputs panel with InpMaPeriod, InpBandWindow and InpBandSigma.
Disparity index indicator inputs panel with InpMaPeriod, InpBandWindow and InpBandSigma.

Settings that fit your chart

A percent reading works on any chart. EURUSD H1 is the reference chart. There `InpMaPeriod` `14` covers over half a day. `InpBandWindow` `100` looks back four days. On M5 the rails tighten fast. Daily bars give far fewer moves outside them.

When the Disparity Index Indicator fails

Rails move as the market changes. Today’s level is not next week’s.

A re-entry says the move outside ended. It does not say a new one began.

The panel sits on the main chart window and can overlap other tools.

Copy the compiled Disparity Index 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 Disparity Index Indicator for MT4 and MT5

The zip holds the compiled Disparity Index 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 InpMaPeriod 14 anchor?

The average behind every reading. Fourteen bars is the default. `InpMaMethod` and `InpAppliedPrice` decide how it gets built. Change the period and the whole series shifts. The yardstick moved, so every value moves with it.

Why does InpBandSigma build moving rails?

Because a fixed band means different things on different charts. These rails come from the spread of the reading itself. `InpBandWindow` sets how many bars feed that spread. They widen when the market gets busy. They tighten when it goes quiet.

What does InpAmpGate 0.25 filter out?

Shallow grazes. A move must travel a quarter of a deviation past the rail. Only then does the return count. The default is loose on purpose. A bar that just crossed a two-deviation rail sits at zero extra depth.

Does EnablePushNotify start switched on?

No. `EnableAlerts` and `EnablePopup` are the two that arrive true. A terminal dialog is what you get out of the box. The other three begin false. Switch on `EnablePushNotify`, `EnableEmail` or `EnableSound` as you need them.

Are results guaranteed?

No. Trading involves risk. Results are not guaranteed; past performance is not indicative of future results. Use the Disparity Index 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