% Change through After Hours

Tomahawk6117

Member
Plus
Hi Everyone,

I like the % change column that is already available for the scanner, however I do not believe this continues to update after hours. Is there anyway to provide a script that continues to update through 8:00 p.m.? I have attached a picture of the % change information I am referencing and highlighted it in yellow. Thank you very much for your time and your help.

ZKoOO2x.jpeg
 
Solution
here you go
EXTENDED HOURS PERCENT CHANGE COLUMN (PreMarket and AfterMarket)
Code:
#EXTENDED HOURS PERCENT CHANGE COLUMN (PreMarket and AfterMarket)
#ENABLE EXTENDED HOURS and SET TO ONE MINUTE AGGREGATION
#As requested via usethinkscript.com
#By XeoNoX
def aggregationPeriod = AggregationPeriod.DAY;
def day_close = close(period = aggregationPeriod);
def dif = close  - day_close;
def percent = (1 * ((dif / day_close)));
def openPrice = if SecondsTillTime(1559) == 0 then close else openPrice[1];
def pctChangeFromOpen = (close - openPrice) / openPrice;
def bestclose = (if isnan(percent) then pctChangeFromOpen else percent);
def aftermarket = (bestclose);
def prev_day_close = close(period = aggregationPeriod)[1];
def prev_day_dif = close...
here you go
EXTENDED HOURS PERCENT CHANGE COLUMN (PreMarket and AfterMarket)
Code:
#EXTENDED HOURS PERCENT CHANGE COLUMN (PreMarket and AfterMarket)
#ENABLE EXTENDED HOURS and SET TO ONE MINUTE AGGREGATION
#As requested via usethinkscript.com
#By XeoNoX
def aggregationPeriod = AggregationPeriod.DAY;
def day_close = close(period = aggregationPeriod);
def dif = close  - day_close;
def percent = (1 * ((dif / day_close)));
def openPrice = if SecondsTillTime(1559) == 0 then close else openPrice[1];
def pctChangeFromOpen = (close - openPrice) / openPrice;
def bestclose = (if isnan(percent) then pctChangeFromOpen else percent);
def aftermarket = (bestclose);
def prev_day_close = close(period = aggregationPeriod)[1];
def prev_day_dif = close  - prev_day_close;
def PCTChangeFromPrevDayClose = ((close - prev_day_close) / prev_day_close);
def premarket = PCTChangeFromPrevDayClose;
def AMorPM = (if isnan(dif) then premarket else aftermarket);
AddLabel(yes, aspercent(AMorPM), if AMorPM >= 0 then color.green else color.red);
 
Solution
here you go
EXTENDED HOURS PERCENT CHANGE COLUMN (PreMarket and AfterMarket)
Code:
#EXTENDED HOURS PERCENT CHANGE COLUMN (PreMarket and AfterMarket)
#ENABLE EXTENDED HOURS and SET TO ONE MINUTE AGGREGATION
#As requested via usethinkscript.com
#By XeoNoX
def aggregationPeriod = AggregationPeriod.DAY;
def day_close = close(period = aggregationPeriod);
def dif = close  - day_close;
def percent = (1 * ((dif / day_close)));
def openPrice = if SecondsTillTime(1559) == 0 then close else openPrice[1];
def pctChangeFromOpen = (close - openPrice) / openPrice;
def bestclose = (if isnan(percent) then pctChangeFromOpen else percent);
def aftermarket = (bestclose);
def prev_day_close = close(period = aggregationPeriod)[1];
def prev_day_dif = close  - prev_day_close;
def PCTChangeFromPrevDayClose = ((close - prev_day_close) / prev_day_close);
def premarket = PCTChangeFromPrevDayClose;
def AMorPM = (if isnan(dif) then premarket else aftermarket);
AddLabel(yes, aspercent(AMorPM), if AMorPM >= 0 then color.green else color.red);
Thank you so much for your help @XeoNoX, I really appreciate it. Is this intended to only work after hours? Right now I am only showing 0% for all stocks. Also, does it matter which aggregation period I select? Thank you again for your help, I really appreciate it.

Based on your formula, you are trying to do exactly what I was requesting through subtracting the close of the current candle from the previous day's closing price. Thank you again for your help.
 
Last edited:
Thank you so much for your help @XeoNoX, I really appreciate it. Is this intended to only work after hours? Right now I am only showing 0% for all stocks. Also, does it matter which aggregation period I select? Thank you again for your help, I really appreciate it.

Based on your formula, you are trying to do exactly what I was requesting through subtracting the close of the current candle from the previous day's closing price. Thank you again for your help.
it shows the difference in percent from the close of regular trading hours to the current close. if its showing 0 then its either 0 or you didnt follow the instructions.
#ENABLE EXTENDED HOURS and SET TO ONE MINUTE AGGREGATION
 
it shows the difference in percent from the close of regular trading hours to the current close. if its showing 0 then its either 0 or you didnt follow the instructions.
#ENABLE EXTENDED HOURS and SET TO ONE MINUTE AGGREGATION
Thank you very much @XeoNoX, is there any to calculate the %change from the previous day's close through 8:00 p.m. on the current day? For example, when I ran the scan for the stock, CREV, the script you provided says -3.31%, but from yesterday's close, the stock gained 41.82%. Is there anyway to calculate the 41.82%. Thank you very much for all of your time and your help.
 
Thank you very much @XeoNoX, is there any to calculate the %change from the previous day's close through 8:00 p.m. on the current day? For example, when I ran the scan for the stock, CREV, the script you provided says -3.31%, but from yesterday's close, the stock gained 41.82%. Is there anyway to calculate the 41.82%. Thank you very much for all of your time and your help.
if you want from yesterdays close, why didn't you say that in post #1?
 
if you want from yesterdays close, why didn't you say that in post #1?
I apologize, I should have been more specific. The current %change column in thinkorswim that is pre-built in calculates from yesterday's close. I just wanted to change the %change column so that it continues to run through 8:00 p.m. instead of stopping at 4:00 p.m. So overall, I would like a % change column to calculate from yesterday's closing price though today at 8:00 p.m. please. Thank you very much for all of your help.
 
Thank you very much @XeoNoX, is there any to calculate the %change from the previous day's close through 8:00 p.m. on the current day? For example, when I ran the scan for the stock, CREV, the script you provided says -3.31%, but from yesterday's close, the stock gained 41.82%. Is there anyway to calculate the 41.82%. Thank you very much for all of your time and your help.

correct, its shows -3.31% ... my script works as originally requested and as the title of the thread suggests (percent change after hours as a column), it shows the same on Google search, screenshot attached. if you are looking for something else maybe someone else can assist you.
 

Attachments

  • capture..png
    capture..png
    83.3 KB · Views: 91
correct, its shows -3.31% ... my script works as originally requested and as the title of the thread suggests (percent change after hours as a column), it shows the same on Google search, screenshot attached. if you are looking for something else maybe someone else can assist you.
I understand, thank you very much for your help @XeoNoX.
 
I am new to ToS and to ThinkScript..
I am trying to learn but still need lots of help!
I was trying to create a Scan for Nasdaq Stocks less than 10 Usd PreMarket..
I used XeoNox Script as basis for PreMarket percent change..
I cannot get it to work..
I would attach the Script if I knew how to do it..
Any Help would be appreciated
Thanks
Jose
 

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