Extended Hours/After Hours Percent Change?


New member
I found one thread that was related to this topic, but both of the 2 scripts don't function in a way that displays percentage change... The first script in the thread just displays zeros for me and the other displays value change not %. I was wondering if there was a way to code it in a way that would make it look just like %change and Mark%change built in columns, but displays the difference in percentage therefore showing aftermarket % change this way? I was just thinking maybe it could be simpler than people were making it out to be. Maybe not.


New member
This is what i've come up with so far after editing what i found in that post. I go the column to look how i wanted appearance wise, but i'm for some reason getting all zeros in the data fields.
#Hint: Displays After Hours & Pre Market change as a  percentage in custom column.

#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 Percent = round(((close - DayClose)/DayClose)*100);
plot change = percent;

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

Similar threads