NOT have the Percentage Label truncate

IHopeToLearn

New member
Is there any way to NOT have the Percentage Label truncate?
ex: 0.01% looks alot like 0.1% and in a scalping rush I have at times got out of a trade thinking 0.01% is not big deal but it was more than I thought. *Not sure if this is where I am supposed to post this.

Here is the current code:

# Profit or Loss Current Candle
#Base Code provided by Pensar
#Modified by Therival and DoubleJinx

#THIS CODE FOUND HERE:
plot entryPrice;

input showDetails = yes;

# Entry Price
entryPrice = GetAveragePrice();
#entryPrice.AssignValueColor(if close < entryPrice then Color.DOWNTICK else Color.UPTICK);
#entryPrice.SetLineWeight(2);
#entryPrice.SetStyle(Curve.SHORT_DASH);

#END OF CODE

# Start of PENSAR Code
# defs
def PL = GetOpenPL();
def Entry = if IsNaN(GetAveragePrice()) then Entry[1] else GetAveragePrice();
def LastEntryBar = if Entry != Entry[1] then BarNumber() else LastEntryBar[1];
def PercentChg = if Entry then (close - Entry) / Entry else 0;
def qty = GetQuantity();

# label
AddLabel(showDetails, qty + "@" + AsDollars(entryPrice),
if PL == 0 then Color.WHITE
else if PL > 0.01 then Color.GREEN
else Color.DARK_ORANGE);

AddLabel(1, "" + AsDollars(PL) +
" | " + AsPercent(PercentChg) ,
if PL == 0 then Color.WHITE
else if PL > 0.01 then Color.GREEN
else Color.DARK_ORANGE);
 
Last edited by a moderator:
Is there any way to NOT have the Percentage Label truncate?
ex: 0.01% looks alot like 0.1% and in a scalping rush I have at times got out of a trade thinking 0.01% is not big deal but it was more than I thought. *Not sure if this is where I am supposed to post this.

Here is the current code:

# Profit or Loss Current Candle
#Base Code provided by Pensar
#Modified by Therival and DoubleJinx

#THIS CODE FOUND HERE:
plot entryPrice;

input showDetails = yes;

# Entry Price
entryPrice = GetAveragePrice();
#entryPrice.AssignValueColor(if close < entryPrice then Color.DOWNTICK else Color.UPTICK);
#entryPrice.SetLineWeight(2);
#entryPrice.SetStyle(Curve.SHORT_DASH);

#END OF CODE

# Start of PENSAR Code
# defs
def PL = GetOpenPL();
def Entry = if IsNaN(GetAveragePrice()) then Entry[1] else GetAveragePrice();
def LastEntryBar = if Entry != Entry[1] then BarNumber() else LastEntryBar[1];
def PercentChg = if Entry then (close - Entry) / Entry else 0;
def qty = GetQuantity();

# label
AddLabel(showDetails, qty + "@" + AsDollars(entryPrice),
if PL == 0 then Color.WHITE
else if PL > 0.01 then Color.GREEN
else Color.DARK_ORANGE);

AddLabel(1, "" + AsDollars(PL) +
" | " + AsPercent(PercentChg) ,
if PL == 0 then Color.WHITE
else if PL > 0.01 then Color.GREEN
else Color.DARK_ORANGE);

trailing digits with addlabel()
addlabel displays text
to keep trailing 0's, need to check the number and add a "0" if it is needed

example that adds characters as needed
https://usethinkscript.com/threads/...tion-from-addlabel-function.10456/#post-92584
 

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