Plot Bar color in Watchlist

dxk

Member
I've searched thru the forum and couldn't find how to do this.

I am using a bar charts and would like to show the bar color in the watchlist for the current bar, a new column for the prior bar and a new column for the 3rd bar back

I'll assign the background color so I can see if the stock is moving up or down, thanks ahead
 
Solution
Within assignBackgroundColor();

for the first bar:

if close > open then color.green else if close < open then color.red else color.yellow

for the second bar:

if close[1] > open[1] then color.green else if close[1] < open[1] then color.red else color.yellow

for the third bar change [1] to [2]
Within assignBackgroundColor();

for the first bar:

if close > open then color.green else if close < open then color.red else color.yellow

for the second bar:

if close[1] > open[1] then color.green else if close[1] < open[1] then color.red else color.yellow

for the third bar change [1] to [2]
 
  • Like
Reactions: dxk
Solution

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

Within assignBackgroundColor();

for the first bar:

if close > open then color.green else if close < open then color.red else color.yellow

for the second bar:

if close[1] > open[1] then color.green else if close[1] < open[1] then color.red else color.yellow

for the third bar change [1] to [2]
That works great

got a question for you

I am using range bars instead of candles

do plots and assignbackgroundcolor reference the candle or the chart I am working on with range bars?

if so is there a way to plot and assign colors to range bars? My range bars are 2 so the max plot I should get is 2 to -2 and I am seeing values up to 8 in the plots
 
Last edited:
plot change = close from 0 bars ago - close from 1 bar ago;

change.AssignValueColor(Color.BLACK);

AssignBackgroundColor(if close > open then color.green else if close < open then color.red else color.yellow);
 
If this is for a custom watchlist column, the column will be independent of any chart, and will be limited to the available time based aggregations.

Prm68qz.png
 
If this is for a custom watchlist column, the column will be independent of any chart, and will be limited to the available time based aggregations.

Prm68qz.png
I wish this was the case, my range bars are 2 so the max value I should see is +2 -2, but I am seeing 5, 9 etc....

Range Bars are not time base they are price base is the reason it does not work, candles are time base

I called TD and ask if the values are candle related and we verified it to be so.

I was also told a script needs to be written so TOS understands it, it can be done from what they told me, some one needs to write new script for Range Bars
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
541 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