Resource icon

thinkScript Colors: List of Standard Colors for ThinkorSwim Indicators

You can customize a plot in your thinkScript code by changing its color. Here is a list of available thinkScript colors supported in ThinkorSwim.

The list below is just a set of constants. You can also use other color formats such as RGB in your code.
  • COLOR.BLACK
  • COLOR.BLUE
  • COLOR.CURRENT
  • COLOR.CYAN
  • COLOR.DARK_GRAY
  • COLOR.DARK_GREEN
  • COLOR.DARK_ORANGE
  • COLOR.DARK_RED
  • COLOR.DOWNTICK
  • COLOR.GRAY
  • COLOR.GREEN
  • COLOR.LIGHT_GRAY
  • COLOR.LIGHT_GREEN
  • COLOR.LIGHT_ORANGE
  • COLOR.LIGHT_RED
  • COLOR.LIME
  • COLOR.MAGENTA
  • COLOR.ORANGE
  • COLOR.PINK
  • COLOR.PLUM
  • COLOR.RED
  • COLOR.UPTICK
  • COLOR.VIOLET
  • COLOR.WHITE
  • COLOR.YELLOW

Usage

Code:
Color.[insert color]

Examples

Ruby:
AddLabel(yes, "Custom Label Text", color.yellow);

The code above sets the color of your AddLabel to yellow.

Here's another example of changing the 20 SMA line. When the closing price is higher than the 20 period moving average, the line is green, else red.

Ruby:
#
# TD Ameritrade IP Company, Inc. (c) 2017-2020
#

input price = close;
input length = 20;
input displace = 0;
input showBreakoutSignals = no;

plot SMA = Average(price[-displace], length);
SMA.AssignValueColor(if close > SMA then color.green else color.red);

Additional scripts related to thinkScript Colors

Useful Notes from the thinkScript Lounge

You can use different methods, like global color, or this is one method I use [source]

Code:
plot  trend = 0;
Trend.DefineColor("UpTrend", Color.UPTICK);
Trend.DefineColor("DownTrend", Color.DOWNTICK);
Trend.DefineColor("NeutralUp", Color.LIGHT_GRAY);
Trend.DefineColor("NeutralDn", Color.DARK_GRAY);
Trend.DefineColor(" Default", Color.CYAN);
Trend.Hide();

input PaintBars = yes; #hint PaintBars: Whether or not to paint price bars. Only one script on your chart can paint price candles.
AssignPriceColor(
     if PaintBars then
        if U and D OR NB then
            if c<o then Trend.Color("NeutralDn")
                else Trend.Color("NeutralUp")
            else if U then Trend.Color("UpTrend")
            else if D then Trend.color("DownTrend")
        else  Color.CURRENT
     else Color.CURRENT);

Example of using current value of variable to control color of entire plot [source]

Code:
# Example of using current value of variable to control color of entire plot

def c = close;
def bn = BarNumber();
def na = Double.NaN;
def cb = HighestAll(if !IsNaN(c) then bn else na);
def green = c > open;
def greenLine = HighestAll(if bn == cb then green else na);
def currentClose = HighestAll(if bn == cb then c else na);

plot
priceLine = currentClose;
priceLine.AssignValueColor(if   greenLine
                           then Color.UpTick
                           else color.DownTick);

15:20 Mobius©: 15m... You can add as many colors to the AssignBackgroundColor() expression as you can dream up conditions for want. [source]

Code:
AssignBackgroundColor( if cond1 then color.blue
                  else if cond2 then color.green
                  else if cond3 then color.red
                  else if cond4 then color.yellow
                  else color.white);
  • Like
Reactions: ark.analyst
Author
BenTen
Views
24,830
First release
Last update
Rating
5.00 star(s) 1 ratings

More resources from BenTen

Latest reviews

Informative & easy to understand.

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