Color Coded Gap Watchlist Columns for ThinkorSwim

Sonny what is the right time or right color to get in by watching rv1 AND C1 ON MY WATCH LIST NO NUMERICAL JUST A WORD NAN

New symbols show up on the momentum scan shortly after 9:30. Have the Message Center pulled up and set alerts when new symbols show up on the Momentum scan. There is no magic RV1 number but look for stocks on the scan before 10am that are trading above VWAP and have bullish stock patterns like rounding bottom, double bottom, and bull flag. The good stocks usually have a RV1 in top 3 for the day. Good entry would be pullback to 9EMA or bounce off VWAP. Good examples are ANTE on 7/13, GENE on 7/15, BOXL on 7/16, and VRNA on 7/17.
 

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

This thread has been extremely useful in developing watchlist columns to filter candidates for trading based on bullish signs. I have columns related to percent change from close and relative volume for both premarket and the regular trading session. Picture is below.

6iWRZ84.png


I am having trouble with one column I would like to use as a final filter for chosing candidates after the market opens. Presently it is based on just the close price being above the open. It is the first column in the watchlist and it gives me a green go or red no.
The coding for this watchlist plot is:

Code:
#Close above Open:
def AP = AggregationPeriod.DAY;
input cl = close;
input op = open;
plot co = cl>op;
co.assignValueColor(if cl>op then color.green else color.red);

However I would like to plot 2 conditions within the column indicator but cannot figure out the coding for the plot. I would also like it to give me binary response, say 0 for no and 1 for yes, like the above code. Here is what I have thus far. Anyone help I could get would be appreciated. I have learned a lot about coding recently and been able to cobble together quite a bit. But am stumped here yet again.

Code:
#Open above Yesterday Close and Close Above Open:
def ap = AggregationPeriod.DAY;
def op = open(period = ap);
def ycl = close(period = ap)[1];
def cl = close;
def cond = op > ycl[1] and cl>op;
 
Found script in here that @Sonny posted to get Relative Volume during Premarket.

Some results are NaN. Is there a way to fix that?
Also, there script only works during premarket and does not make sense during regular hours. Any way to fix that?

Code:
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else Double.NaN;

def PMVol = if IsNaN(vol) then PMVol[1] else vol;
def Agg = AggregationPeriod.DAY;
def AvgVol = average(Volume(period=Agg),60)[1];

def RV = Round((PMVol/AvgVol),2);
#def L = Lg(RV);
#def p = if L>=1 then 0 else if L>=0 then 1 else 2;
#def y2 = Round(RV,p);

plot z = RV;

Third question; there's a part of the code I do not use. Can anyone explain what it does and why it's in there?
Code:
#def L = Lg(RV);
#def p = if L>=1 then 0 else if L>=0 then 1 else 2;
#def y2 = Round(RV,p);
 
No, this was a column for Premarket Relative Volume but did not work. You can get the PM relative volume as a chart label in my other thread.
So after reading through everything slightly confused.

I have 2 scripts for RV1

This one referring to this post https://usethinkscript.com/threads/color-coded-watchlist-columns-for-thinkorswim.2977/post-28578

Code:
def isRollover = GetYYYYMMDD() != GetYYYYMMDD()[1];
def beforeStart = GetTime() < RegularTradingStart(GetYYYYMMDD());
def vol = if isRollover and beforeStart then volume else if beforeStart then vol[1] + volume else Double.NaN;
def PMV = if IsNaN(vol) then PMV[1] else vol;
def AV = AggregationPeriod.DAY;
def x = Average(Volume(period=AV)[1],60);
def y1 = Round((PMV/x),2);
def L = Lg(y1);
def p = if L>=1 then 0 else if L>=0 then 1 else 2;
def y2 = Round(y1,p);
plot z = y2;
z.assignValueColor(if z>=10 then color.CYAN else if z>=1 then createcolor(255,153,153) else createcolor(0,215,0));

The the original code on page 1

Code:
def x = Average(volume, 60)[1];
def v = volume;
plot r = Round((v/x),1);
r.assignValueColor(if r >= 20 then color.CYAN else if r>=5 then createcolor(255,153,153) else createcolor(0,215,0));

Which one do I use? Or Do i use both and one called Pre Market RV1 and the other RV1 ?

Thank you very much also the other columns you posted on page 1 I set all to 1d time is that correct? @sunny
 
Last edited:
Using the RV1 is incredibly helpful. Thanks so much Sonny. Is there any way one can make a scan that only accepts stocks with an RV1 over a certain amount? Be amazing to just have ones over 20 RV or so.
 
@bss05 This may help: https://usethinkscript.com/threads/...egy-and-momentum-scanner-for-thinkorswim.3002

I've never created a watchlist before. Can someone share a tutorial on how to add the info in post #1 to my scan section in TOS?

@Sonny If I'm setting this put and I plan to look at the 1-minute chart on gapped stocks should I change this to 1-minute (see picture) for all of the entries in post #1 or should I keep it as the default D?

hhjj.jpg


The RV calculation is (today's volume) / (60 day average daily volume). When you put in the column code, make sure you mark D for day for next to Column Name.
EDIT: after reading through the pages I found this. So I'm going to set all of them to D even though ill be looking at the 1-minute chart.
 
Last edited:
@Sonny everytime try to add this to my watchlist under Custom I get invalid statements specifically concerning the parts of the code I highlighted, the following is the errors that show as well, any help you can give would be much appreciated.

Invalid statement: Cyan at 1:1
Invalid statement: CO at 37:1
Invalid statement: L1 at 47:1
Invalid statement: RV1 at 59:1
 
Last edited:
@Sonny Hey I saw that someone had something similar to this, but with the scan results it would bring up strong ut (for strong uptrend), neutral ut and such. Would you know how to build something like that?
 
I have developed color coded watchlist columns which can be very helpful, especially when looking at a gap scan on the left while tracking charts on the right. These are color coded based on values. The columns eliminate all those extra zeros at the end and make it easy to spot big values. The codes are listed below. Please pass it on!

Cyan - highest
Red - 2nd highest
Green - 3rd highest
Yellow - lowest

C1 – <20, 20-40, >40
CO – <0, 0-20, 20-40, >40
L1 – 1-5, 5-10, >10
RV1 – 0-5, 5-20, >20

C1
Code:
#Pct Change from Yesterday Close
def AP = AggregationPeriod.DAY;
def y = close(period = AP)[1];
def x = Round(100*((close/y)-1),1);
plot z=x;
z.assignValueColor(if z>=40 then color.CYAN else if z>=20 then createcolor(255,153,153) else createcolor(0,215,0));

CO
Code:
#Percent change from open
plot x = Round(100*((close/open)-1),1);
x.assignValueColor( if x >=40 then color.CYAN else if x>=20 then createcolor(255,153,153) else if x>=0 then createcolor(0,215,0) else color.YELLOW);

L1
Code:
#Rounded Last
def L = Round(close,2);
plot x = L;
x.assignValueColor(if x>=10 then color.CYAN else if x>=5 then createcolor(255,153,153) else createcolor(0,215,0));

RV1
Code:
#Relative Volume
def x = Average(volume, 60)[1];
def v = volume;
plot r = Round((v/x),1);
r.assignValueColor(if r >= 20 then color.CYAN else if r>=5 then createcolor(255,153,153) else createcolor(0,215,0));
Hi Everyone,

I have few conserns, I have set up the watch list columns and set up the scan, I was trying to run the scan from 9:30 AM EST to 10:15 AM EST but It is not giving any results.


aRDd5tX.png
 
Is there a way to have the first 15 minutes of volume as a column?

I can do it with a lower study like this:


input startTime15 = 0930;
input endTime15 = 0944;

def Active = SecondsFromTime(startTime15) >= 0 and SecondsTillTime(endTime15) >= 0;
def Vol15Mins = if Active and !Active[1] then volume
else if Active then (Vol15Mins[1] + volume)
else (Vol15Mins[1]);

plot vol15 = Vol15mins;


But when I try this as a column it gives a totally different value and it doesn't stop growing after 15 minutes
 
its all good. The script I posted actually works for what I was trying to do, you just have to change the custom column time frame from daily to an intraday time frame. Thanks for circling back
 
Last edited by a moderator:
@DudeDastic The video appears to be the standard RVOL indicator w/ painted bars?
The last script in post#1 paints the RVOL bars. You will need to adjust what volume levels are associated with what colors.
 
@bss05

You could have bought FRAN at less than $4.50 this morning. If you track your premarket scanner on TOS, it spiked at 7:30 when the news came out. You just wait for the pullback and then buy it. Then just hold it as long as it stays above VWAP and you can make 100% return in premarket.

Here is what I use for Premarket Scan:
Last: 0.2 to 15
Volume: 5000 to No Max
Custom Study Filter: After Hours Change, the close is greater then 10% (under Price Performance); check the Ext box and select 1m on the right.

As soon as you see FRAN pop up in the scan, just check the news in TOS, and buy it once it has the small pullback at 7:31.
Brilliant- I cant wait to try it out. I have the columns loaded- edit i see how to add the scan now!!! pasting here for others... "These codes are only for watchlist columns. To use these, go to a scan and click Customize at top right. Then add each code separately to Custom column. Once you do that, there should not be any errors. These values only work after 9:30am."

TY!!
 
Last edited:
Brilliant- I cant wait to try it out. I have the columns loaded- I cannot get the settings on the scan. I have the custom study filter open, have added a condition, I chose "close" in the price drop down on the left and then in the center chose "is greater than" I cannot find a way to choose 10% for the right side of the condition wizard... Can you please help?
@bss05

You could have bought FRAN at less than $4.50 this morning. If you track your premarket scanner on TOS, it spiked at 7:30 when the news came out. You just wait for the pullback and then buy it. Then just hold it as long as it stays above VWAP and you can make 100% return in premarket.

Here is what I use for Premarket Scan:
Last: 0.2 to 15
Volume: 5000 to No Max
Custom Study Filter: After Hours Change, the close is greater then 10% (under Price Performance); check the Ext box and select 1m on the right.

As soon as you see FRAN pop up in the scan, just check the news in TOS, and buy it once it has the small pullback at 7:31.
Which “custom study” do you use?!
 
Which “custom study” do you use?!
I thought that meant add a filter in scan called "study" prom the dropdown in scanning. then dropdown to the bottom of the study choices to the one at the bottom that is called custom. and from there you get to the thinkscript editor or the condition wizard which I described in detail what I am doing there- but I canot get it to load...
 

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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