ADX Trend label for ThinkorSwim

horserider

Well-known member
VIP
Just a simple label telling if ADX is below 20 or above 30.

Code:
input length = 14;
input averageType = AverageType.WILDERS;
#input Label_Color_Choice =  {default "gray", "white"};

def ADX = DMI(length, averageType).ADX;

AddLabel (ADX > 30, "ADX > 30 ... TREND-directional strategy",
(color.GRAY));
 #GetColor(Label_Color_Choice));
AddLabel(ADX < 20, "ADX < 20 ... CHOP-range bound strategy", #GetColor(Label_Color_Choice));
(color.GRAY));

https://tos.mx/6ojWoS
 

markos

Well-known member
VIP
Simple is often best. Thank you for your continued help and contributions. (y)

Code:
#ADX by RH
input length    = 14;
input baseLine  = 20.0;

plot ADX = DMI( length ).ADX;
ADX.SetDefaultColor( Color.WHITE );

AssignBackgroundColor( if ADX > baseLine then Color.GREEN else if ADX < baseLine then Color.RED else Color.BLACK );
#### EOC ####
### notes ####
# Can anyone help me with a custom column script for ADX red under 20, over 20 green + the number of how mush the ADX is equal to inside the same column.
 

Ace_Trader

New member
2019 Donor
VIP
Hey guys...here is another variation of this chart label. Enjoy..!!
Code:
# beginning of code ----------------------

# current ADX as a label at top of the chart # # Label color changes according to value of ADX: # . Green if >25 # . YELLOW if 20 to 25 # . CYAN if < 20 #

input length = 14;

plot currentADX = ADX(length);

currentADX.hide();

DefineGlobalColor("ADXHigh", CreateColor(50, 205, 50)); DefineGlobalColor("ADXLow", Color.CYAN); DefineGlobalColor("ADXMid", Color.YELLOW);

AddLabel (yes, (Concat("ADX = ", Round(currentADX,1))),if currentADX > 25 then GlobalColor("ADXHigh") else if currentADX < 20 then GlobalColor("ADXLow") else GlobalColor("ADXMid"));

# end of code -------------------------------
 

Jim Klopp

New member
Hi, was just wandering around and saw your post awhile back. Could you tell me where you got that post from? Looks pretty cool if still available. I havent figured a way to know if is on the bid or ask... it makes a difference!!! Thanks,

Jim
 
Last edited by a moderator:

allnetbrett

New member
This is awesome, but I need a little help. I like to use ADX based on 15m timeframe in my watchlist column (and Scans), The ADX what time frame does the code above use? (Not talking about 14 welles wilder) I have tried, 1m, 2m, 5m, 15m, 30m, hourly, Daily, weekly, and monthly in my watchlist column, but none are equaling what is in the on ADX badge label code...

any help?
 

scott69

Member
Hello All, I am allowed to make this post very much because of the members here. I studied many of the posts dealing with labels. My immense gratitude to anyone that used labels in their scripts. A special shout-out to @markos for his RGB color labels. I referred to that over a dozen times when working on the various labels that I created for my studies. My system is quite simple. As I hinted to in other posts, I trade NQs. My first step, as many do, is to review the daily chart for an overview. I then rely on the 15 minute charts for the general trend. Then the 5 minute chart for the setup. Finally the 1 minute for the trigger. The 5 minute is really the most important chart I use, and this label script is used on there and the settings reflect how I use it. I have found that most powerful trends begin with the ADX (5) on the 5 minutes chart below 25. Also, many trends reverse with it over 70. I use the Hull MA in combination to identify a trend. I hope that you can use it or modify it for your own purposes.

Code:
##### Begin Code #####

# SD_ADXLabel
# Scott XXX
# Version: 01
# Original: November 17, 2020
# Last Mod: November 18, 2020

declare upper;

input ADXLength = 5;
input ADXLower = 25;
input ADXMid = 40;
input ADXHigh = 70;
input MALength = 10;

def ADXlabel = reference ADX(ADXLength).ADX;
def MA = reference HullMovingAvg(close,MALength);

AddLabel(yes, "                     ADX SETTING UP                     ", if ADXlabel < ADXLower then Color.CYAN else Color.BLACK);

AddLabel(yes, " ADX WATCH ", if ADXlabel < ADXMid then Color.WHITE else Color.BLACK);

AddLabel(yes, " ADX TREND WEAKENING ", if (ADXlabel < ADXlabel[1]) then Color.YELLOW else Color.BLACK);

AddLabel(yes, "           UP TREND           ", if ADXlabel > ADXlabel[1] and MA > MA[1] then Color.GREEN else Color.BLACK);

AddLabel(yes, "           DOWN TREND           ", if ADXlabel > ADXlabel[1] and MA < MA[1] then Color.RED else Color.BLACK);

AddLabel(yes, " ADX HIGH ", if ADXlabel > ADXHigh then Color.MAGENTA else Color.BLACK);

##### End Code #####
 
Hello All, I am allowed to make this post very much because of the members here. I studied many of the posts dealing with labels. My immense gratitude to anyone that used labels in their scripts. A special shout-out to @markos for his RGB color labels. I referred to that over a dozen times when working on the various labels that I created for my studies. My system is quite simple. As I hinted to in other posts, I trade NQs. My first step, as many do, is to review the daily chart for an overview. I then rely on the 15 minute charts for the general trend. Then the 5 minute chart for the setup. Finally the 1 minute for the trigger. The 5 minute is really the most important chart I use, and this label script is used on there and the settings reflect how I use it. I have found that most powerful trends begin with the ADX (5) on the 5 minutes chart below 25. Also, many trends reverse with it over 70. I use the Hull MA in combination to identify a trend. I hope that you can use it or modify it for your own purposes.
just wanted to say that i have a very similar trading strategy and i am sure your making money bc I find thats the only way to stay consistent. Awesome labels btw. well i think, ima try em out tomorrow! thanks for the code bro!
 

andre.muhammad

Member
VIP
How Would I Paint the Bars to Match the Color of my ADX Label

Code:
input length = 14;
plot currentADX = ADX(length);
currentADX.hide();
DefineGlobalColor("ADXHigh", CreateColor(50, 205, 50)); DefineGlobalColor("ADXLow", Color.CYAN); DefineGlobalColor("ADXMid", Color.YELLOW);
AddLabel (yes, (Concat("ADX = ", Round(currentADX,1))),if currentADX > 25 then GlobalColor("ADXHigh") else if currentADX < 20 then GlobalColor("ADXLow") else GlobalColor("ADXMid"));
 
Last edited by a moderator:

rad14733

Well-known member
VIP
@andre.muhammad Here you go...

Ruby:
input length = 14;

plot currentADX = ADX(length);

currentADX.hide();

DefineGlobalColor("ADXHigh", CreateColor(50, 205, 50)); DefineGlobalColor("ADXLow", Color.CYAN); DefineGlobalColor("ADXMid", Color.YELLOW);

AddLabel (yes, (Concat("ADX = ", Round(currentADX,1))),if currentADX > 25 then GlobalColor("ADXHigh") else if currentADX < 20 then GlobalColor("ADXLow") else GlobalColor("ADXMid"));

AssignPriceColor(if currentADX > 25 then GlobalColor("ADXHigh") else if currentADX < 20 then GlobalColor("ADXLow") else GlobalColor("ADXMid"));
 

Rayanmjr

New member
Adx/dmi trend strength indicator for custom watchlist. I really need this to be working for the top left side of thinkorswim showing for each ticker with same color as noted below. Please let me know thank you.

Code:
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);

@rad14733
 
Last edited:

Similar threads

Top