## DMI Stochastic

DMI Stochastic was authored by Barbara Star in the Stocks and Commodities Magazine, January 2013. The J. Welles Wilder Directional Movement Plus and Minus Indexes are combined to create an oscillator. These oscillator values are used as input to the famaliar Stochastic Oscillator. A moving average of the price is also plotted. The user may change the input (close), methods, period lengths and guide values. This indicator’s definition is further expressed in the condensed code given in the calculation below. ### How To Trade Using DMI Stochastic

No trading signals are calculated for this indicator

### How To Access in MotiveWave

Go to the top menu, choose Add Study, start typing in this study name until you see it appear in the list, click on the study name, click OK.

Important Disclaimer: The information provided on this page is strictly for informational purposes and is not to be construed as advice or solicitation to buy or sell any security. Please see our Risk Disclosure and Performance Disclaimer Statement.

### Calculation

//input = price, user defined, default is closing price
//dmiPeriod = user defined, default is 10
//fastKPeriod = user defined, default is 10
//slowKPeriod = user defined, default is 3
//smoothPeriod = user defined, default is 3
//stochasticMethod = moving average, user defined, default is SMA
//maPeriod = user defined, default is 50
//maMethod = moving average, user defined, default is SMA //index = current bar number

```//Calculate the +DM, -DM and TR
pDm = series.getPositiveDM(index);
nDm = series.getNegativeDM(index);
tr = series.getTrueRange(index);

//Calculate the Average +DM, -DM and TR
pdMa = series.smma(index, dmiPd, PDM);
ndMa = series.smma(index, dmiPd, NDM);
tra = series.smma(index, dmiPd, TR);

//Determine the +DI, -DI and DX
pdi = pdMa / tra * 100;
ndi = ndMa / tra * 100;
Plot: dmiOsc = ndi - pdi;
if (dmiOsc moreThan midGuide) series.setBarColor(index, DMI_OSC, upColor);
else series.setBarColor(index, DMI_OSC, downColor);

//DMI Stochastic
lowest = series.lowest(index, fastkPd, DMI_OSC);
highest = series.highest(index, fastkPd, DMI_OSC);
fastK = (dmiOsc - lowest) / (highest - lowest) * 100.0;
slowK = series.ma(stochMethod, index, slowkPd, FAST_K);
Plot: dmiStoch =series.ma(stochMethod, index, stochSmPd, SLOW_K);

//MA
Plot: ma = series.ma(maMethod, index, maPd, input);```