Custom Watchlist Column Color Coded Based on ADX/DMI Study
The Trend Detector indicator. The DMI (Directional Movement Index) is used by many traders to identify the beginning and direction of trends in the price action. For many years, traders have used multiple time frames to identify opportunities to trade in the direction of the trend. In this video we show how to add three custom columns in a watchlist, one for Weekly, one for Daily and one for Hourly. You can set these to whatever time frames you prefer. Each of the custom columns display all three of the DMI plots. How do we do that? You’ll have to watch the video to find out!
Build your watchlist today
After following our step-by-step instructions you will have your own custom watchlist containing many chart’s worth of information. You will be able to see the position of the DI+ and DI- lines as well as the value of the ADX. All available in a single glance. After setting up the watchlist, we’ll conclude with a demonstration of how to read and interpret the output.
Here is the code you will need to set up your watchlist columns:
input length = 14; input averageType = AverageType.WILDERS; input threshold = 20; def hiDiff = high - high; def loDiff = low - 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 diPlus = 100 * MovingAverage(averageType, plusDM, length) / ATR; def diMinus = 100 * MovingAverage(averageType, minusDM, length) / ATR; def DX = if (diPlus + diMinus > 0) then 100 * AbsValue(diPlus - diMinus) / (diPlus + diMinus) else 0; # the value of the ADX is shown in the custom column plot ADX = MovingAverage(averageType, DX, length); # the colors change based on the postions of various lines to the threshold # when ADX is below threshold, backgrond is black # when ADX is above threshold, the background changes based on which di line is on top # need to have sufficient contrast between color of background and value to ensure it's legible # try using a white background # the color of the adx value is green for diPlus > diMinus, otherwise red ADX.AssignValueColor(if diPlus > diMinus then Color.DARK_GREEN else if diMinus > diPlus then Color.DARK_RED else Color.BLACK); AssignBackgroundColor(if adx > threshold then Color.WHITE else Color.BLACK);
Click and drag interface to build custom watchlist columns. No code experience required:
TD Ameritrade provides financial services including the trading of Stocks, Futures, Options and Forex.
Please be sure to share this page with your friends and colleagues. Leaving comments below is the best way to help make the content of this site even better.