After Hours & Pre Market Change Watchlist Column

J007RMC

J007RMC

Active member
VIP
Warehouse
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

Member
VIP
Warehouse
Sounds great! I'll be trying this out tomorrow morning.
 
Townsend

Townsend

Member
VIP
Warehouse
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
Warehouse
@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

Active member
VIP
Warehouse
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

Active member
VIP
Warehouse
Well some etfs show on hourly well nothing is loading now not even my hull
 
Townsend

Townsend

Member
VIP
Warehouse
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
Warehouse
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

Active member
VIP
Warehouse
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:

Top