Thinkorswim ADX DMI Watchlist 22

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 Thinkorswim ADX DMI Watchlistidentify 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[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 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);

*Thinkorswim is a chart analysis platform offered by TD

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.

Watch the video, Thinkorswim ADX DMI Watchlist below:

__ Support our free content by making a purchase below. Thanks! __

Questions? Comments? Post a review?

22 thoughts on “Thinkorswim ADX DMI Watchlist

  • Thomas

    I read the book ADXcellence by Dr. Schaap he has ADX 8, but the DMI+/DMI- of 13. I think its the most useful ADX/DMI book I’ve read. I see that you have length can be set and I would think that would be ADX length. Is there a way to change DMI setting to 13 while keeping ADX as 8??

    • Pete Hahn Post author

      It is possible but requires rather extensive and complex modifications to the code. Essentially you have to compute both values separately. You can achieve the same result by adding the study twice, applying 8 to the first and turning off the DI plots. Then apply 13 to the second and turn off the ADX plot. Combining this all into a signal chart study or watchlist columns if far beyond the scope of a solution I can provide free of charge.

  • Rayan

    So i have a question i am trying to implement this alongside with my code for this moving average crossover scanner in order to signify how strong of a move the stock is trending either up or down. This is my code below.. please let me know how can we put two and two together i would kindly appreciate that! Code below is for 13SMA and 30SMA crossover on hourly aggregation.

    # Hourly Scan for 13/30 Crossover After 2 Weeks
    # Scans for crossovers in both directions
    # Choose hourly aggregation – Do NOT include extended hours

    # 70 is the number of hourly bars that total two weeks – adjust as desired
    input bars_since_cross = 70;

    # allows a bit of room to scan for the cross – 7 is within the current day
    input max_bars_since_cross = 7;

    def ma1 = average(close,13);
    def ma2 = average(close,30);

    def cross_up = ma1 crosses above ma2;
    def cross_dn = ma1 crosses below ma2;

    def count_after_cross_up = if cross_up and !cross_up[1] then 1
    else count_after_cross_up[1]+1;
    def count_after_cross_dn = if cross_dn and !cross_dn[1] then 1
    else count_after_cross_dn[1]+1;

    def long_entry = count_after_cross_up > bars_since_cross
    and cross_dn within max_bars_since_cross bars;
    def short_entry = count_after_cross_dn > bars_since_cross
    and cross_up within max_bars_since_cross bars;

    plot scan = long_entry or short_entry;

    # end scan code

    I also want to attach a picture of an example of how it would look like when it works but please feel free to shoot me an email:

  • Vimal Mittal


  • Omar Rivera

    Like this tool you have created. The only that I don’t understand is why in some stocks gives me a the message “custom expression subscription limit exceeded”. Why?

  • George

    I copied ADX script to TOS and the ADX Values in the watch list are different from the values in the TOS charts. Generally the values are higher in TOS

      • George

        Weekly, daily, and 4 hour. The 4h seems to be off the most. Values for the AUD/CAD currency pair. Watch list = W-25.13 D-15.21 4H-15.56. TOS chart = W-25.17 D-17.25 4H-38.08. TOS 4H chart isshowing a major trend to the upside

      • George

        You said there may be a problem with the watch list in TOS and I am not sure what to do next. Is there something I need to do, or is there something you could do to modify the code so the watch list works, or is this an internal problem with TOS. If it is a problem with TOS what do I show them and/or say to them to ID the problem?

      • Pete Hahn Post author

        What I am saying, and I thought I explained it pretty clear in that post I just linked…. is that the platform is clearly broken right now. Thinkorswim will need to fix this. I have no idea how many different things may be impacted. But it’s clear from the material I present in that post I linked, that something inside is broken. Something we have no control over.

  • Carmine

    I followed the instrument like you said on the video
    on my watchlist I get the same you have on the video. but on my charts I don’t have the study ADX I missing something

    • Pete Hahn Post author

      The chart study name is DMI. It’s one of the built in studies that come with Thinkorswim. The version I use in the video is a modified version. But the values are identical to the DMI.

      • Kenny Lovell

        Pete, Is there any way to script the ADX for these settings below? These are settings from Trade Station. Trying to see if they can be scripted into TOS. Changes color on the single line as it moves up above or down below the 20 line.

        Settings would be Wilders
        ADXLength – 14
        TriggerLevel – 20
        UsePlotColoring – True
        AboveTrigColor – Yellow
        BelowTrigColor – Red
        EqualTrigColor – Cyan
        ColorCellBGOnAlert – true

      • Pete Hahn Post author

        Sure. But the comments section of a video is certainly not the place to be solving requests of this complexity. I suggest you search the Q&A Forum to see if a solution already exists. If you don’t find the answer then post a new question.