Addlabel coding question

Vorlauf

Member
I have the two following Labels, I'm hoping to find a code that would take the 2 values provided from these two labels and return a new AddLabel that would return the stop loss percentage. Like 1-(stop/buy) as a percentage

Code:
AddLabel(yes, "Stop: " + AsText(stopLoss), Color.RED);
AddLabel(yes, "Buy: " + AsText(Close), Color.MAGENTA);
 

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

@CapitaineFlam88 Are you sure? It worked for me. Check out the AddLabel() thread to learn more.

Mu6nDD9.png
 
How do I add a condition that makes the statements below false after 2-3 seconds? I would like the labels to switch back to "NO SIGNAL" after 2-3 seconds.

Code:
#Labels
AddLabel(yes, if UpSignal[1] then "BUY BUY BUY" else "NO SIGNAL", Color.YELLOW);
AddLabel(yes, if DownSignal[1] then "SELL SELL SELL" else "NO SIGNAL", Color.WHITE);
 
Last edited:
@Marvin187 You really can't unless you could monitor when the signal fires and base the yes/no off of current time minus trigger time... Whether a few seconds timespan would work or not is subjective... Personally, if I were to try this I would do the calculation prior to the AddLabel() statement itself and place the resulting variable in place of yes...
 
@rad14733 Can you help me make the code? I’m aware we will have to make another condition and add to label statement. Sample -> AddLabel(yes, if UpSignal[1] then "BUY BUY BUY" else if <NEW CONDITION> then “NO SIGNAL” else "NO SIGNAL", Color.YELLOW);

The NEW CONDITION has to work based on what you mentioned.
 
@Marvin187 It might be a while before I can get to it with the other coding work I am working on in addition to trying to help keep questions answered here in the forums... I know @XeoNoX is seemingly the resident wizard for time-related solutions and perhaps he could squeeze it in sooner, unless someone else has the desire to jump in... If too much time passes, give another reminder...
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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