DMI (Directional Movement Index) Watchlist for ThinkorSwim

BenTen

BenTen

Administrative
Staff
VIP
The DMI indicator (Directional Movement Index) will tell you which direction the price of a stock is moving. When the +DI line is above the -DI line, it means there is more upward movement than downward and vice versa.

The way I use the DMI is a bit different. Instead of using this indicator to tell bullish or bearish trend, I use it as a sideways detector. When the two lines are moving next to each other, it's telling me that the market is choppy at the moment.

Here is an example on the $BYND chart:



The DMI indicator is available right inside ThinkorSwim. You can just add it without additional code. To make things a bit easier on my part, I asked @WalkingBallista if it was possible to make a Watchlist column that displays the range between the DMI lines. The closer they are to each other the more likely that the stock isn't moving anywhere. And of course, he said yes.

Here is the DMI Range watchlist column for anyone interested.



thinkScript Code

Rich (BB code):
# WalkingBallista DMI Range
# https://usethinkscript.com/d/193-dmi-directional-movement-index-watchlist-for-thinkorswim

input length = 14;
input averageType = AverageType.WILDERS;

def hiDiff = high - high[1];
def loDiff = low[1] - low;

def plusDM = if hiDiff > loDiff and hiDiff > 0 then hiDiff else 0;
def minusDM =  if loDiff > hiDiff and loDiff > 0 then loDiff else 0;

def ATR = MovingAverage(averageType, TrueRange(high, close, low), length);
def "DI+" = 100 * MovingAverage(averageType, plusDM, length) / ATR;
def "DI-" = 100 * MovingAverage(averageType, minusDM, length) / ATR;

plot range = AbsValue(AbsValue("DI+")-AbsValue("DI-"));

Shareable Link

 
Last edited:
S

soary

Member
Hi Ben, Nice work. I added the ADX and this DMI indicator to my watchlist but don’t under how to interpret the DMI numbers. I understand ADX > and < 20-25 indicates trend strength and understand how DMI works when looking at it on a chart and it expands and contracts but don’t know what the numbers mean in a watchlist columns. As an example, after the close on 5/8/20 APA reads ADX 28.73 which means strong trend and the DMI read 16.18. What does the DMI reading mean by itself and what does it mean relative to the ADX? Thanks
 
S

soary

Member
@soary Here is an article explaining more about DMI.
Ben, I read that earlier and just checked again as a refresher because years ago I started out with the ADX & DMI. What I tried to say in my previous post is that I understand how they are used on a chart but now DMI is in a watchlist column with numbers. I get the ADX numbers as explained in the article as being significant if over/under 20-25 but as far as DMI article only talks about what it means when DMI contracts or expands.. As far as DMI in a watchlist with numbers, how wide is wide? and how narrow is narrow? Is the DMI numbers interpreted same as ADX by being significant if over/under 20-25? Thanks
 

Top