After Hours & Pre Market Change Watchlist Column

J007RMC

J007RMC

Well-known member
2019 Donor
VIP
Nick Name: chuck, you can also try this.
Code:
#begin
#Hint: Displays After Hours & Pre Market change as a  percentage in custom column.
#WaterFrontTrader

#07/20/12: Initital Release
#08/13/12: Fixed to include pre-market and extended session

#"Show Extended Session" should be active on your chart

def Post = secondsFromTime(1600);
def Pre = secondsTillTime(930);
def Closed  = Post >=0 or Pre>=0;
def DayClose = if (Post>=0,close(period = "Day"),close(period = "Day")[1]);
#NN note:modified close to use ask
def Change = close(priceType = "ASK") - DayClose;
def Percent = round(((close - DayClose)/DayClose)*100);

plot change1 = percent;
change1.assignValueColor (color.BLACK);
assignBackgroundColor(if close< dayclose then color.red else if close>dayclose then color.green else color.current);
#end
Make sure your column is set to an intraday aggregation and extended hours is checked on.
 
Last edited by a moderator:
Townsend

Townsend

Active member
VIP
Sounds great! I'll be trying this out tomorrow morning.
 
Townsend

Townsend

Active member
VIP
I don't know. I pasted this code into a Custom Quotes column. Set the period for 1 hour and made sure Extended Hours trading was enabled. I got nothing but NAN for two days. Kind of disjointed,. as I think such an indicator would be ideal for knowing which stocks are going to GAP UP or DOWN the most.

Now... on Saturday, I tried setting the Period to Day, and I get all zeros!! I think it's working now. Seems to only work for the Day period. Hopefully I'll get some real numbers on Monday.

PS: Let me know if anybody gets this working on the shorter time frames.
 
BenTen

BenTen

Administrative
Staff
VIP
@Townsend Hmm...That's interesting. I would assume the opposite since the Daily chart doesn't display after-hours and pre-market data. Let us know how it goes for you on Monday.
 
J007RMC

J007RMC

Well-known member
2019 Donor
VIP
Just came across one that works well

Code:
#begin
#Hint: Displays After Hours & Pre Market change as a  percentage in custom column.
#WaterFrontTrader

#07/20/12: Initital Release
#08/13/12: Fixed to include pre-market and extended session

#"Show Extended Session" should be active on your chart

def Post = secondsFromTime(1600);
def Pre = secondsTillTime(930);
def Closed  = Post >=0 or Pre>=0;
def DayClose = if (Post>=0,close(period = "Day"),close(period = "Day")[1]);
#NN note:modified close to use ask
def Change = close(priceType = "ASK") - DayClose;
def Percent = round(((close - DayClose)/DayClose)*100);
 
plot change1 = percent;
change1.assignValueColor (color.BLACK);
assignBackgroundColor(if close< dayclose then color.red else if close>dayclose then color.green else color.current);
#end
#Make sure your column is set to an intraday aggregation and extended hours is checked on.
 
J007RMC

J007RMC

Well-known member
2019 Donor
VIP
Well some etfs show on hourly well nothing is loading now not even my hull
 
Townsend

Townsend

Active member
VIP
Monday morning, pre-market: no numbers. Nothing. But, bid/asked is not showing up on any of my charts, even though I'm looking at highlighted Extended Hours candles. Also, the regular %Change column on my Watchlist shows all zeros as well. So... maybe the problem is not the indicator, but rather some system wide or account problem. Do I have to have my TD account activated for extended hours trading?
 
T

tomsk

Well-known member
VIP
If you are using Bid/ask intraday timeframe, e.g. 1 min depending on how you program the study you should usually see some numbers.
Make sure you test for NaN and you should be okay. All bets are off if you use daily aggregation

Here is an example of a Bid/Ask watchlist that does work fine on a 1 min chart

Code:
# Bid Ask Watchlist
# Mobius
# 2.26.2019

# aggregation must be less than daily

plot data = (((bid()+ask())/2-close from 1 bars ago)*100)/close from 1 bars ago;
def up = data > 0;
def down = data < 0;
data.assignValueColor(if up then color.dark_green else if down then color.red else color.yelloW);
 
Last edited:
J007RMC

J007RMC

Well-known member
2019 Donor
VIP
Code:
#begin
#Hint: Displays After Hours & Pre Market change as a  percentage in custom column.
#WaterFrontTrader

#07/20/12: Initital Release
#08/13/12: Fixed to include pre-market and extended session

#"Show Extended Session" should be active on your chart

def Post = secondsFromTime(1600);
def Pre = secondsTillTime(930);
def Closed  = Post >=0 or Pre>=0;
def DayClose = if (Post>=0,close(period = "Day"),close(period = "Day")[1]);
#NN note:modified close to use ask
def Change = close(priceType = "ASK") - DayClose;
def Percent = round(((close - DayClose)/DayClose)*100);
 
plot change1 = percent;
change1.assignValueColor (color.BLACK);
assignBackgroundColor(if close< dayclose then color.red else if close>dayclose then color.green else color.current);
#end
#Make sure your column is set to an intraday aggregation and extended hours is checked on.
 
Last edited by a moderator:
theelderwand

theelderwand

Member
2019 Donor
VIP
May are reporting issues with this, I took a shot at it and could get it to work,

Below is the code,

Rich (BB code):
#begin
#Hint: Displays After Hours & Pre Market change as a  percentage in custom column.
#WaterFrontTrader

#07/20/12: Initital Release
#08/13/12: Fixed to include pre-market and extended session
#01/29/19: theelderwand: Fixed for latest version.

#"Show Extended Session" should be active on your chart

def Post = secondsFromTime(1600);
def Pre = secondsTillTime(930);
def Closed  = Post >=0 or Pre>=0;
def DayClose = if (Post>=0,close(period = "Day"),close(period = "Day")[1]);


#NN note:modified close to use ask
plot Change = ask() - DayClose;

Change.AssignValueColor (Color.BLACK);
AssignBackgroundColor(if Change < 0 then Color.LIGHT_RED else if Change > 0 then Color.LIGHT_GREEN else color.current);
#end
#Make sure your column is set to Day aggregation

Shareable link: https://tos.mx/Xxl2TSg

Settings


Screenshots


 
S

seregaxyligan

New member
Hey guys, is there any way to change price to percentages? Thank you!
 
C

cv40067

New member
Code:
#begin
#Hint: Displays After Hours & Pre Market change as a  percentage in custom column.
#WaterFrontTrader

#07/20/12: Initital Release
#08/13/12: Fixed to include pre-market and extended session
#01/29/19: theelderwand: Fixed for latest version.

#"Show Extended Session" should be active on your chart

def Post = secondsFromTime(1600);
def Pre = secondsTillTime(930);
def Closed  = Post >=0 or Pre>=0;
def DayClose = if (Post>=0,close(period = "Day"),close(period = "Day")[1]);
def Change = (ask() + bid())/2 - DayClose;
def Percent = round((Change/DayClose)*100);

#NN note:modified close to use ask
plot Percent1 = percent;
 
Percent1.AssignValueColor (Color.BLACK);
AssignBackgroundColor(if Percent < 0 then Color.LIGHT_RED else if Percent > 0 then Color.LIGHT_GREEN else color.current);
#end
#Make sure your column is set to an intraday aggregation and extended hours is checked on.

This displays it in percent. does anyone know how to concatenate the % sign at the end of the display?
 
Last edited:
V

VicD

Member
So this is not elegant. But I figured the closes I can do is this for a search column to see pre market change, I want to see if premarket is rising or falling. And this at least gives me an idea. I was trying to figure out how to set 4 am open and subtract close at 9:30 am and could not get it to work. Then tried to do day open minus 11 30 minute bars, and could not figure out the script. So went with difference of a 4 hour bar close and prior 4 minute bar close. This would have to be looked at like an hour before market open but at least it can easily show trend in a column.

Code:
plot change = Round(((CLOSE("period" = AggregationPeriod.FOUR_HOURS)-close("period" = AggregationPeriod.FOUR_HOURS)[1])/(close("period" = AggregationPeriod.FOUR_HOURS)[1]))*100, 2);

AssignBackgroundColor(if change > 0 then Color.DARK_GREEN else Color.DARK_RED);
 
P

popovv

New member
@J007RMC Hello. What can be changed in the script so that it displays changes in the price of the postmarket. Quite often, strong price changes occur on the postmarket, especially in cheap stacks. Thank you!
 
K

kylexy

New member
@cv40067 Is there someway to pull the last price from after/pre hours to create the percentage? Using the (ask+bid)/2 is not very goof for after/per hours.
 
C

chada456

New member
Does anyone know how to incorporate mark % change into a scan? Mark % change is the only % change that changes during pre-market but there's no way by default to use that in a scan. Any help would be greatly appreciated! Thanks

Edit: Why was my post moved to this thread? I was asking regarding a Scan, this thread is in regards to a column in a watchlist
 
Last edited by a moderator:
BenTen

BenTen

Administrative
Staff
VIP
@chada456 This was the only thread relevant to your question. You may be able to find a solution from the discussions above. If not, check out this post.
 
T

Trader47

New member
Does anyone know how to incorporate mark % change into a scan? Mark % change is the only % change that changes during pre-market but there's no way by default to use that in a scan. Any help would be greatly appreciated! Thanks

Edit: Why was my post moved to this thread? I was asking regarding a Scan, this thread is in regards to a column in a watchlist
Chada456: Any answers? I am also looking for a script or a way to have a filter for maximum Mark% values in a scan filter for the pre-market. Thanks for any suggestions.
 
axlerod

axlerod

Member
Everyone just use this its simple and a lot easier to read.
Here's my code for the 3 columns

Column 1 - PM % Change - 1m Time Frame CHECK "included Extended Hours"
Code:
# Follow @Nick_Peist on Twitter
# 1m Time Frame CHECK "included Extended Hours"
def prevday=if getlastDay()==2 and getday()==365 then 1 else if getDay()<getlastDay() then 1 else 0;
def close1= if secondsfromTime(1200)>0 and secondsFromTime(1600)<0 and prevday then close else close1[1];
def prevclose = if SecondsTillTime(1559) == 0 then close else prevclose[1] ;
def last =if secondsFromTime(0930)<0 then  close else last[1];
plot pvc=close1;
plot last1=last;
def change=if last==0 then 0 else  (last-close1)/close1;
addlabel(yes,round(change,2)*100+" %",color.black);
assignBackgroundColor(if change>0 then color.green else if change<0 then color.red else color.black);

Column 2 - PM High - 1m Time Frame CHECK "included Extended Hours"
Code:
# Follow @Nick_Peist on Twitter
# 1m Time Frame CHECK "included Extended Hours"
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def hi = if isRollover and beforeStart then high else if beforeStart and high>hi[1] then high else hi[1];
addlabel(yes,hi);
#plot PreMarketVolume = vol;;

Column 3 - AH % Change - 1m Time Frame CHECK "included Extended Hours"
Code:
# Follow @Nick_Peist on Twitter
# 1m Time Frame CHECK "included Extended Hours"
def today=getday()==getlastDay();
def close1= if secondsfromTime(1200)>0 and secondsFromTime(1600)<0  then close else close1[1];
def change= (close(pricetype=pricetype.last)/close1)-1;
addlabel(yes,round(change*100,0)+"%",if change>0 then color.green else color.red);
 

Similar threads

Top