Best % Gap Long/Short Plays (Works Pre-Market) for ThinkorSwim

Townsend

Active member
VIP
The first hour or two of every trading day is the BEST time for day-traders. ThinkOrSwim has MANY Public Watchlists.
I use the one listed under Lovers and Losers, Pre-Market Movers, for all the upcoming gap Up/Down plays.
It's a big list, so it's hard to know ahead of time which ones will be best. So... I created this simple Watchlist indicator.

This little bit of code will tell you the best gaps: Long/Short plays BEFORE the market opens.
Code:
plot pop = Round("number" = ((ask + bid) / 2 -close[1]) / close[1] * 100, "numberOfDigits" = 1);
pop.assignvalueColor(if pop >0 then color.green else color.red);
Just paste this into the thinkSscript Editor of any available Custom Quote Column.
Set the time period to D for Daily. It's based on an average of bid and asked.
So... It's never exact, but always close to the usual %Change column, as you cans see.

It works great to find the best pre-market % gaps. (But not for post-market % changes.)
Note: the %Change column listed below is for illustration purposes only.
Once you have this Pop% indicator set up correctly %Change is no longer needed.
Also, for what it's worth I usually stick to the high volume movers.
yI5uDEU.png

PS: The Ask X column includes a code letter, telling me which exchange the stock is traded on.
I only trade commission free US equities and ETFs. Here's the list of Exchange Codes.
 
Last edited by a moderator:

Join useThinkScript to post your question to a community of 21,000+ developers and traders.

I'm getting the following errors after pasting the code....any idea what I might be doing wrong?

No such variable: ask at 1:31
No such variable: bid at 1:37
No such variable: ask at 1:31
No such variable: bid at 1:37
 
Thank you for sharing the script but still not working on my side.. the 2 blank line didn't resolved the error. Any other advice? Is this Study then using as watchlist, right?

 
The code that was posted in post#1 does work in a watchlist. I just tested it in my watchlist and it does populate
If you are attempting to use that in a chart study, that won't work. You will see the error as reported in post #2.
 
Ah yes, there we go. Thank you!
The code that was posted in post#1 does work in a watchlist. I just tested it in my watchlist and it does populate.

It is possible that the code does not work in paper trade mode. Actually you should NOT be using the paper trade mode at all. I've tried it a few times. Problems is: fills are always horrible. Not in the usual sense. Always way better than they would be in real trading. Makes trading for a profit VERY easy. Not realistic at all. If you want to paper trade with realistic fills use TradingView. It's free. Of course, you can still use TOS for charts, which are best. That's what I do.

PS: I'm not going to be making a video. If you're having a problem it's not the code. It probably has something to do with your inexperience creating Custom Quote Columns. If this is the case go over to youTube and do a search for "thinkOrSwim custom quote column". You'll find tutorial videos there.
 
Last edited:
Coolio!! I studied the image and was wondering why the Pop% was required when there is the % Change.. And then i loaded it to ToS and saw that Pop% works in pre-market, while the %change stays at 0. Nice one @Townsend
 
@twelvester I use the Pop% code posted at the top of this thread almost every day. Works fine for me... and also @twelvester. It shows the percent gap, up or down BEFORE the market opens. And.. once the market opens, the values are identical the the built in %change column. That's how you know it is working correctly.
 
There is a small "gear" on the left at the top of the watchlist. Go to customize, then save it in a new watchlist study. Also google is a magical thing if you have problems.
 
I have this working, however, I'd like to color code for gaps in both directions. This may be super simple, but nothing I've tried is working. I tried using an absolute value and also tried adding an OR statement, but Thinkscript won't accept a second > or < in the line. Here's what I have so far, but I'd like to have it do the same for gap ups.

Code:
plot pop = Round("number" = ((ask + bid) / 2 -close[1]) / close[1] * 100, "numberOfDigits" = 1);
pop.assignvalueColor(if pop < -8 then color.white
else if pop < 0 then color.black
else if pop > 0 then color.white
else color.black);
#Gap down
AssignBackgroundColor(if pop < -15 then Color.blue
else if pop < -8 then Color.DARK_GREEN
else if pop < -6 then Color.GREEN
else if pop < -4 then Color.LIGHT_GREEN
else if pop < -2 then Color.yellow
else if pop < -.01 then Color.pink else Color.black);
 
I have appreciated using this code for a watchlist column but wanted to see gap sell as well as gap buy candidates at the top of the watchlist when sorted for the largest gaps. I solved that issue by modifying the code slightly. See image below and code changes. In the image the POP column is sorted to see the largest gaps from my scan list. You can tell if the Gap is up or down by the color. Green up, Red down.


gap-watchlist-column.jpg


Code:
plot pop =  Round(absValue(((ask + bid) / 2 -close[1]) / close[1]) * 100,1);
def con = Round((((ask + bid) / 2 -close[1]) / close[1]) * 100,1);
pop.assignvalueColor(if con > 1 then color.green else color.red);
 
Hey @Townsend. I'm very interested in what this watchlist column does/shows you. I'm just curious how this differs from the %Change column. They look pretty close, if not right on the money. Is there any way you could help explain how you utilize this column as I'm very interested in playing the market at the open if not before?
 
@Slydog482 The difference between the 2 is that the POP column catches premarket since it uses the average between Bid/Ask. During the regular session, it will not be much different than %Change.

It allows you to watch premarket movers.
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
507 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