• LIMITED TIME OFFER: use coupon code PRIMEDAY at checkout to save $50 off VIP membership (down to $149 / year). Valid through Tuesday 6/22.

After hours scanner for ThinkorSwim


2019 Donor
Looking for a suitable after hours scan that doesn't scan intraday or premarket; mostly post market in the event volume increases under my nose.

#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

#"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);


That's already available in ThinkorSwim. Go to the Scan tab > Add Filter > Study > Price Performance > After Hours Percent Change.


From there, you can adjust the Net change and percentage in after-hours trading.


New member
I can't easily add an image here so I'll write it out. The guts of the above Study are as follows:

AfterHours_Percent_Change, The (Open, High, Low, Close, etc.) has moved (greater than or less than) (X) % in after hours trading (time frame, 1 m, 1 day, 1 year, etc.). Variables are in parens.

The problem is it doesn't work correctly and I've had at least 20 TOS tech support guys on the phone and none of them understand the above, what exactly each variable is intended to represent, etc. In fact most of them either contradict each other or just say something like you can just adjust the variable to whatever you want. The problem is I can't adjust it to whatever I want if I don't know what its designed to do.

First let me be clear on what I'm trying to do. I simply want to scan for drops or increases in AfterMarket activity, e.g. > 4 PM EST to 9:30 AM EST beyond a certain range, e.g. 4% lower than close of last trading session.

So what exactly does the first variable represent? The close of previous session or close of the current candle? If I want to look for drops in the market do I say less than -4% or greater than -4%? If the close above is referring to the current bar close then I assume the Study internally has been hard programmed to look at the last session close? And what about the time frame? What do I set this to? Does this simply aggregate current AfterHours data or does it somehow refer back to the previous session.

Again whenever I call TOS I simply get silence on the other end of the phone. Hopefully someone has already figured this out. Thank you.


I too, have some interest in doing something similar. Would love to be able to scan at a certain time (915am or 10am or whatever time) and look for stocks that are X% higher (or lower) than the closing price from previous day (4pm).

I also wanted to create an indicator that paints a label at 925am:
  • Label 1 - PreMarket Gap Up %
    • Find the highest price between 4pm and 925am, compare to 4pm close
  • Label 2 - PreMarket Gap Dn %
    • Find the lowest price between 4pm and 925am, compare to 4pm close
But I for darn sure have not figured it out yet!

Following the thread to see what might pop up.


New member
If you're looking for % Change anytime after market open then simply use % Change. The fundamental definition of % Change is supposed to be Last Price compared to Close (previous day, not candle close, etc.). Don't reinvent the wheel.

TOS doesn't seem to handle Aftemarket activity very well. Even if the AfterHours_Percent_Change worked there is no corresponding scan results variable to confirm and/or rank the results.

Although it would be elegant to have AfterHours results incorporated into ones market scans its not absolutely necessary. I would just use theStockMarketWatch's PreMarket lists, or Finviz (a little more complex) and avoid TOS scans altogether. I want to stay as focused as I can on the market, not necessarily spending enormous amounts of time programming.

Be extremely cautious of Freelance sites where they all claim to be Thinkscript experts. They'll send you junk and you'll have to pay them, even if what they programmed doesn't work.

Similar threads