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
 
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.
 
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 -------------------------------
 
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:
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?
 
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!
 
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:
@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"));
 
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:
Has anyone here plotted a base line for adx/mdi? looking for just a simple baseline at 20-25. I'd assume its a simple task, but I absolutely have no clue how to code. Help would be greatly appreciated.
 
@D12E4M3R Plotting a base line is as simple as plot baseline = 25;. Add it to whatever ADX study you use and change the value to plot the line at your desired level.
 
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

Thks!

Adding realtime values and context text/colors

Code:
# ADX Dynamic Label
# karmic913
# Adds ADX value and context
# From horserider https://usethinkscript.com/threads/adx-trend-label-for-thinkorswim.403/


input length = 14;
input averageType = AverageType.WILDERS;
def ADX = DMI(length, averageType).ADX;

AddLabel(ADX > 20, Concat(Round(ADX,1), " | ADX Trendy "), (color.GREEN));
AddLabel(ADX < 20, Concat(Round(ADX,1), " | ADX Choppy "), (color.RED));

Screen-Shot-2021-06-16-at-10-48-25-AM.png
 
Last edited:
Thks!

Adding realtime values and context text/colors

Code:
# ADX Dynamic Label
# karmic913
# Adds ADX value and context
# From horserider https://usethinkscript.com/threads/adx-trend-label-for-thinkorswim.403/


input length = 14;
input averageType = AverageType.WILDERS;
def ADX = DMI(length, averageType).ADX;

AddLabel(ADX > 20, Concat(Round(ADX,1), " | ADX Trendy "), (color.GREEN));
AddLabel(ADX < 20, Concat(Round(ADX,1), " | ADX Choppy "), (color.RED));
I was intrigued with ADX Dynamic Label by @karmic913. I created a daily study scan filter that provides Trendy (>20) and high Return of Change (30%). Good for swing trades. You just add your price and volume requirements. Good luck! @cabe1332

# ADX ROC Study Daily scan filter
# cabe1332

# code start

# ADX = trendy > 20
def length = 14;
input averageType = AverageType.WILDERS;
def ADX = DMI(length, averageType).ADX;
def x = ADX > 20;

# RateOfChange > 30%
def price = close(period = AggregationPeriod.day);
def change = round((price - price[5]) / price[5] * 100,0);
def rc = change > 30;

plot scan = x and rc;

# code end
 
Last edited by a moderator:
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 #####
I have modified this label to save property. It was assigning color.black and taking up space. Modified code below.

# SD_ADXLabel
# credit to Scott XXX
# cabe1332
# Modified 20210906

# code start
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, if ADXlabel < ADXLower then " ADX SETTING UP " else if ADXlabel < ADXMid then " ADX Watch " else if (ADXlabel < ADXlabel[1]) then " ADX TREND WEAKENING " else if ADXlabel > ADXlabel[1] and MA > MA[1] then " ADX UPTREND " else if ADXlabel > ADXlabel[1] and MA < MA[1] then " ADX DOWNTREND " else if ADXlabel > ADXHigh then " ADX HIGH " else " ", if ADXlabel < ADXLower then Color.CYAN else if ADXlabel < ADXMid then Color.WHITE else if (ADXlabel < ADXlabel[1]) then Color.YELLOW else if ADXlabel > ADXlabel[1] and MA > MA[1] then Color.GREEN else if ADXlabel > ADXlabel[1] and MA < MA[1] then Color.RED else if ADXlabel > ADXHigh then Color.MAGENTA else Color.light_gray);

# code ends
 
I have modified this label to save property. It was assigning color.black and taking up space. Modified code below.

# ADX Dynamic Label
# cabe1332

# code stat
input ADXLength = 6;
input ADXLower = 25;
input ADXMid = 40;
input ADXHigh = 75;
#input MALength = 10;
input MALength = 9;

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

# ADX Label
AddLabel(yes, if ADXlabel < ADXLower then " ADX " + Round(ADXlabel,1) + ": SETTING UP " else if ADXlabel < ADXMid then " ADX " + Round(ADXlabel,1) + ": CHOPPY - Watch/Wait " else if ADXlabel < ADXlabel[1] then " ADX " + Round(ADXlabel,1) + ": TREND WEAKENING " else if ADXlabel > ADXlabel[1] and MA > MA[1] and ADXlabel < ADXHigh then " ADX " + Round(ADXlabel,1) + ": UPTRENDING " else if ADXlabel > ADXlabel[1] and MA < MA[1] then " ADX " + Round(ADXlabel,1) + ": DOWNTRENDING " else if ADXlabel > ADXHigh then " ADX " + Round(ADXlabel,1) + ": HIGH/WAIT TO COOL OFF " else " ", if ADXlabel < ADXLower then Color.CYAN else if ADXlabel < ADXMid then Color.RED else if (ADXlabel < ADXlabel[1]) then Color.YELLOW else if ADXlabel > ADXlabel[1] and MA > MA[1] and ADXlabel < ADXHigh then Color.GREEN else if ADXlabel > ADXlabel[1] and MA < MA[1] then Color.RED else if ADXlabel > ADXHigh then Color.MAGENTA else Color.light_gray);

# end of ADX
# code ends
Just updated the code with params that work for my style. You can play around with the input to work best for you. Good luck! @cabe1332
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
414 Online
Create Post

Similar threads

Similar threads

The Market Trading Game Changer

Join 2,500+ subscribers inside the useThinkScript VIP Membership Club
  • Exclusive indicators
  • Proven strategies & setups
  • Private Discord community
  • ‘Buy The Dip’ signal alerts
  • Exclusive members-only content
  • Add-ons and resources
  • 1 full year of unlimited support

Frequently Asked Questions

What is useThinkScript?

useThinkScript is the #1 community of stock market investors using indicators and other tools to power their trading strategies. Traders of all skill levels use our forums to learn about scripting and indicators, help each other, and discover new ways to gain an edge in the markets.

How do I get started?

We get it. Our forum can be intimidating, if not overwhelming. With thousands of topics, tens of thousands of posts, our community has created an incredibly deep knowledge base for stock traders. No one can ever exhaust every resource provided on our site.

If you are new, or just looking for guidance, here are some helpful links to get you started.

What are the benefits of VIP Membership?
VIP members get exclusive access to these proven and tested premium indicators: Buy the Dip, Advanced Market Moves 2.0, Take Profit, and Volatility Trading Range. In addition, VIP members get access to over 50 VIP-only custom indicators, add-ons, and strategies, private VIP-only forums, private Discord channel to discuss trades and strategies in real-time, customer support, trade alerts, and much more. Learn all about VIP membership here.
How can I access the premium indicators?
To access the premium indicators, which are plug and play ready, sign up for VIP membership here.
Back
Top