• LIMITED TIME ONLY: Take $40 off VIP with code: BTD40.

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

nickivan63

New member
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?

 

tomsk

Well-known member
VIP
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.
 

Townsend

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

twelvester

New member
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
 

Townsend

Active member
VIP
@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.
 

Prison Mike

Member
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);
 

rlohmeyer

Active member
VIP
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);
 

Slydog482

New member
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?
 

rlohmeyer

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

Top