Watchlist Column Percentage Change after Specific Time

Manfrom1968

New member
For the Watchlist column I really like the Percentage Change from the Open but I was wondering is it possible be able to have this script modified so I could specify "Percentage Change after a specific time like 11:00 am NY time" for example? Any help is appreciated, Thank you! This is the %change from open script.
#this show percentage change from the open

def openPrice = if SecondsTillTime(930) == 0 then open else openPrice[1];
def pctChangeFromOpen = (close - openPrice) / openPrice;

AddLabel(yes, AsPercent(pctChangeFromOpen), color.white);
AssignBackgroundColor(if pctChangeFromOpen > 0 then color.dark_green else color.dark_RED);
 
Solution
You just have to change 930 to 1100. The only other thing you might have to do is determine what it's supposed to say between 9:30 and 11:00. That code, as it is, if you were to just change the time, would still be showing you the percent change from yesterday at 11:00 until it actually resets at 11:00 today. That might be ok with you, maybe not. Perhaps you want it to just be blank before 11:00? Anyway, let me know what you decide. It's an easy fix that will only take about ten seconds to write.
You just have to change 930 to 1100. The only other thing you might have to do is determine what it's supposed to say between 9:30 and 11:00. That code, as it is, if you were to just change the time, would still be showing you the percent change from yesterday at 11:00 until it actually resets at 11:00 today. That might be ok with you, maybe not. Perhaps you want it to just be blank before 11:00? Anyway, let me know what you decide. It's an easy fix that will only take about ten seconds to write.
 
Solution
You just have to change 930 to 1100. The only other thing you might have to do is determine what it's supposed to say between 9:30 and 11:00. That code, as it is, if you were to just change the time, would still be showing you the percent change from yesterday at 11:00 until it actually resets at 11:00 today. That might be ok with you, maybe not. Perhaps you want it to just be blank before 11:00? Anyway, let me know what you decide. It's an easy fix that will only take about ten seconds to write.
Hi Joshua, that would be great if you could make that change so that it will show as blank before the start time. Thank you.
 
Code:
def tm = 1100;
def openPrice = if SecondsTillTime(tm) == 0 then open else openPrice[1];
def pctChangeFromOpen = (close - openPrice) / openPrice;
def Blank = secondsFromTime(tm) < 0;
AddLabel(yes, if !Blank then AsPercent(pctChangeFromOpen) else "", color.white);
AssignBackgroundColor(if pctChangeFromOpen > 0 then color.dark_green else color.dark_RED);
 

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