Remove "," from Futures Price in Chart Label.

Mike

Member
VIP
I'd like to remove the "," from futures prices in a chart label. Example: ES futures current price is 4436.00. My label displays 4,436.00.

Here's my script:

def iv = close() * (imp_volatility() / 19.10);
AddLabel(yes, Concat("EM: ", round(iv,2)), Color.Dark_Orange);

def up = close() * (imp_volatility() / 19.10) + close();
AddLabel(yes, Concat("", round(up,2)), Color.Dark_Green);

def down = close()- (close() * (imp_volatility() / 19.10));
AddLabel(yes, Concat("", round (down,2)), Color.Red);

Any help with this is much appreciated....
 
Solution
@Mike
You would have to do something like:
Def var1=rounddn(round(up,2)/1000,0);
Def var2=round(up,2)-(var1*1000);
AddLabel(yes, concat("",var1,var2,color.dark_green);

That should work as far as visually removing the comma.
I'm typing this on my phone, so I have no idea if it has any errors.
@Mike
You would have to do something like:
Def var1=rounddn(round(up,2)/1000,0);
Def var2=round(up,2)-(var1*1000);
AddLabel(yes, concat("",var1,var2,color.dark_green);

That should work as far as visually removing the comma.
I'm typing this on my phone, so I have no idea if it has any errors.
 
Solution
@Svanoy
Thank you for your response. I've attempted to integrate your suggestion into my code numerous times but have been unsuccessful. I'm still learning to code...slowly getting better with time. Can you help please.
 
@Svanoy
Thank you for your response. I've attempted to integrate your suggestion into my code numerous times but have been unsuccessful. I'm still learning to code...slowly getting better with time. Can you help please.

See if using the asprice function provides what you wanted

Capture.jpg
Code:
def iv = close() * (imp_volatility() / 19.10);
AddLabel(yes, Concat("EM: ", asprice(round(iv,2))), Color.Dark_Orange);

def up = close() * (imp_volatility() / 19.10) + close();
AddLabel(yes, Concat("", asprice(round(up,2))), Color.Dark_Green);

def down = close()- (close() * (imp_volatility() / 19.10));
AddLabel(yes, Concat("", asprice(round (down,2))), Color.Red);
 
See if using the asprice function provides what you wanted
@SleepyZ

Thank you very much!! I attempted to use the AsPrice function, yesterday before posting my question. Obviously, I used it incorrectly
i.e. added " + AsPrice" to my code. As you have shown me, used and placed correctly, this will help me going forward e.g. using functions AsDollars, AsPercent, AsPrice, and AsText.

Again...Thank you very much!!
 
#22/01/20 @Mike...Expected Move ES Futures...IV/√365.
#22/01/22 Thanks to @SleepyZ for assistance and adding “asprice” function to remove “,” from label display.
#22/01/23 @Mike...changed def up and def down AddLabel “rounddown” and “roundup” function input from 2 to 0.25 as ES Futures trade in 0.25 point increments.

def iv = close() * (imp_volatility() / 19.10);
AddLabel(yes, Concat("EM: ", asprice(round(iv,2))), Color.Dark_Orange);

def up = close() * (imp_volatility() / 19.10) + close();
AddLabel(yes, Concat("", asprice(rounddown(up,0.25))), Color.Dark_Green);

def down = close()- (close() * (imp_volatility() / 19.10));
AddLabel(yes, Concat("", asprice(roundup (down,0.25))), Color.Red);

#EOC Expected Move ES/MES Futures
 

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