Adding Multiple Labels

rbark3r

New member
Using the comparison script in TOS, I've created a chart that compares mutilple ETF's using (different colored lines) and showing their return for that period on the right axis.

However I was wondering if I could have labels on the chart in the color of the respective ETF and the ETF's name in the label as I sometimes forget which line corresponds to which ETF.

I would appreciate any help as I've been trying to write the script on my own but having difficulty (complete newbie).
 
Last edited:
@rbark3r Yes, but you will need to post your existing code using the </> icon so we can set and evaluate your existing code and present potential modifications... We can't do much based on an idea alone...
 
@rbark3r Yes, but you will need to post your existing code using the </> icon so we can set and evaluate your existing code and present potential modifications... We can't do much based on an idea alone...

Sorry, please see below.


input comparisonStyle = {"BAR", "CANDLE", default "LINE"};
input secondarySecurity = "";
addLabel(secondarySecurity, secondarySecurity.TakeValueColor());


Not sure what I'm doing wrong
 
Got this error message

"Can not call TakeValueColor on secondarySecurity at 3:32"

maybe TakeValueColor isn't allowed in a label.
if things don't work,
copy the problem code line,
comment out the original with #,
and experiment with the copy.
make it as simple as possible, to get it to work. put in a constant color, like
color.yellow.
you could use getcolor( 2) for a plot line color, then use the same number in the label. could define a global color, and reuse it in label.
 
@rbark3r You have the error "Can not call TakeValueColor on secondarySecurity"
Because your variable secondarysecurity HAS NO COLOR
you need to provide color to your variable base on criteria and then you can pass that color using the the takecolor function.

If you search this forum for takecolor, you will find many examples which perhaps you can modifiy to do what you are trying to do.

I feel your pain o_O But I learn more from my failures than my successes so stick with it. TOS becomes more intuitive the more you read the examples in this forum and implement them in your scripts.
 

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
315 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