Market Direction Indicator [LazyBear]

Market Direction Indicator ( MDI ), by Donald Lambert, is an extension of simple moving average cross over systems. Series of price cross over points are determined to derive MDI .

Note that the short/long lengths will differ between instruments. They need to be tuned properly.

I have added an option to specify a "cutoff" parameter. When MDI is in the cutoff zone (-/+ cutoff), bars are colored gray. Set this to zero to turn off cutoffs.

Other options:
- OverlayMode: Enable this to color bars. MDI values are not plotted. If unchecked, MDI default rendering mode is Histogram mode.
- ShowBelowZero: Plots the negative values below zero (Oscillator mode)

Use "MDI" and "ZeroLine" for setting up alerts. Make sure MDI is in OscillatorMode.

Master list of all my indicators:
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Want to use this script on a chart?
// @author LazyBear 
// List of all my indicators: 
study("Market Direction Indicator [LazyBear]", shorttitle="MDI_LB")
lenMA1=input(13, title="Short Length"), lenMA2=input(55, title="Long Length")
cutoff=input(2, title="No-trend cutoff")
sbz=input(false, title="Show Below Zero")
om=input(false, title="Enable overlay mode")
calc_cp2(src, len1, len2) =>
    (len1*(sum(src, len2-1)) - len2*(sum(src, len1-1))) / (len2-len1)

cp2=calc_cp2(src, lenMA1, lenMA2)
mdi=100*(nz(cp2[1]) - cp2)/((src+src[1])/2)
plot(om ? na : 0, color=gray, title="ZeroLine"), plot(om ? na : sbz ? mdi : abs(mdi), style=columns, color=mdic, linewidth=3, title="MDI")
barcolor(om ? mdic:na)
List of my free indicators:
List of my indicators at Appstore:


I cannot enable the indicator to its color mode, its all grey, what can I do let me know when you get a chance thanks
500 coins
My first impression was this is a good indicator. Second impression is that it shows a lot of false signals typical to moving average cross systems. I studied moving average crosses a lot. As you wrote: "They need to be tuned properly. " So this is a good indicator, but only after extensive research of discovering the right combination of moving average periods for each time-frame.
+5 Reply
ChartArt ChartArt
Another setting which I highly recommend to tune properly is the "cutoff" parameter, which is able to drastically reduce the noise of the mentioned false signals.

For example your default periods with a much higher cutoff setting:
+4 Reply
@ChartArt, Hi Where can i access this indicator.
Would there be a way to have it so that the indicator on the bottom can color the candles without losing the display? As in, not having to run two instances of the indicator (one merged to the candles, and another unmerged on its own)...
+1 Reply
LazyBear SirNoseDvoidoffunk
To allow both bar coloring and histogram, change Line 18 of the script to the following:

plot(0, color=gray, title="ZeroLine"), plot( sbz ? mdi : abs(mdi), style=columns, color=mdic, linewidth=3, title="MDI")
+1 Reply
No That's a Good One.... Nice Job
+1 Reply