ADX Custom Watchlist Column for ThinkorSwim


New member
I've used this for quite some time. Helps keep me on my hands and when it's a good time to dive in. Anyway, thought I'd pass it on. I don't remember where I got it. I think it was sent to me through one of my trading partners. In any event, hope it helps someone.

Readings less than 25, I sit and wait. 25-50, I'm picking a spot and jumping in. +50, I'm in with both hands, the car , the dog and the house. (short or long)

#ADX Watchlist

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
ADX.AssignValueColor(if diPlus > diMinus then Color.GREEN else if diMinus > diPlus then Color.RED else Color.BLACK);
AssignBackgroundColor(if adx > threshold then Color.BLUE else Color.BLACK);

Similar threads