Premarket After-market For ThinkOrSwim

@snappy33 Not a scan expert but seems you will need to use the PMhigh study in your scan then add an additional scan condition to find close over PMhigh probably within a few bars.

close crosses PreMarket_High() within 3 bars

Something like the above with the bold text being the name of your premarket high study. Also can make 2 scans one for cross above and one for cross below if preferred. Should be able to make these easily in scan condition wizard. Start with price ,close then cross, then study.
 
I have use my mobile to check charts due to work and most custom indicators don't show up. However, I am using the PM high/low and it shows up on my mobile which is great!

Is there anyway to add Previous Day Close into this algorithm so I can use this same script?
 
@h10 Add this to your script:

Code:
def Today = if GetDay() == GetLastDay() then 1 else 0;

plot ystdClose = close(period = "day" )[1];

ystdClose.SetPaintingStrategy(PaintingStrategy.HORIZONTAL);
ystdClose.SetDefaultColor(Color.UPTICK);
ystdClose.SetLineWeight(1);
 
Unfortunately the previous day close doesn't show up on the mobile app. However, thanks for the reply!
 
@horserider Not to bug you, but I think you'd be able to help me pretty quickly with a variation of the above script that would paint each day.

I am looking for:
  • 4 lines: Pre-market High, Pre-market Low, Previous Day High, Previous Day Low
  • Would paint all lines at market open and maintain extension right, (through the day)
  • With a "cloud" between the top two and a cloud between the bottom two
  • Ability to adjust the color of the clouds

-- PM High --
(cloud color 1)
-- PD High --


-- PM Low --
(cloud color 2)
-- PD Low --

Can you help a total newbie get going on this?
 
Ok just threw together Kory's study above with a PD study. Not interested in spending time making it pretty or exactly to your wants but should function.
 
Hello I am hoping someone can help out.

I am looking for an intraday scan that looks for stocks above its premarket highs. Can someone help? Thank you!
 
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.
 
Image won't load to this site. The link is below.

g4bmvZt.png
 
Last edited by a moderator:
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.
 
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.
 
Hi Ben, thanks for this! I'm getting an N/A in the globex variable. I've tried using both the commented and original code
# If you want to include the extended session in Globex, then use globex def below
#def globex = if time crosses above rte
# then bn else globex[1];

I haven't seen any feedback here of anyone else having this problem and it appears to be happening only on selective charts, i.e. today with AMRH. Any idea why this would be happening? Thanks!
 
Hi,

I want to submit the following code as a chart study that shows the premarket high as a chart label. Please pass it on!

Thanks,
Sonny

Code:
def h = high;
def bar = BarNumber();
def GlobeX = GetTime() < RegularTradingStart(GetYYYYMMDD());
def ONhigh = if GlobeX and !GlobeX[1] then h else if GlobeX and h > ONhigh[1] then h else ONhigh[1];
def ONhighBar = if GlobeX and h == ONhigh then bar else Double.NaN;
def OverNightHigh = if BarNumber() == HighestAll(ONhighBar) then ONhigh else OverNightHigh[1];
AddLabel(1, "PMH: " + OverNightHigh, Color.CYAN);
 
Hi, I'm looking for a scanner to show me all the stocks that are moving up after the market close. I couldn't find any and I have a scan for Pre-market and works fine. Any help would be appreciated.
 
Try using the same condition that you use to find movers from pre-market and apply that to after-hours.
 
Hi, I'm looking for a scanner to show me all the stocks that are moving up after the market close. I couldn't find any and I have a scan for Pre-market and works fine. Any help would be appreciated.
would you mind sharing before market scan? at least how do you determine that a stock is going to be moving throughout the day?
 
I'm using the below one for premarket scan with 5% or more but not sure how can I use the same one for After hours. I want to stocks that are 5% or up after hours since the market close. I'm not sure how can I add a watchlist column to show the price change since the market close. All the columns are showing price change from the previous day close. @cherif
JOXlho8.jpg
 
It's actually already a built in study. In Study, under "Price Performance" choose "After hours percent change"

For a watchlist column, I recently made this. It shows the percent change from from the most recent market close. It works during after hours, premarket (gap), and continues during market hours.

edit 6/21/20: 1hr aggregation seems to load the fastest while still being accurate, though 1 min works too.

Code:
# Gap From Market Close watchlist by Len20
# Set to 1hr or lower aggregation
# Works afterhours, premarket, and regular hours

def marketClose = 1559;
def c =  close;
def today  = GetDay() == GetLastDay();
def dayHours = SecondsTillTime(marketClose) >= 0 ;

def PrevClose = if (dayHours[1] and !dayHours) or (dayHours[1] and !today[1] and today)
                #in case there was no afterhours trading
                then c[1]
                else PrevClose[1];

def gapChange = round((c - PrevClose) / PrevClose * 100, 1);

plot GapPlot = if today then gapChange else double.NaN;
GapPlot.assignValueColor( if gapChange < 0 then color.RED else color.GREEN);
 
Last edited:

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