Three Weeks Tight Scan for ThinkorSwim

TheRaptor22

New member
Looking for a scan for a three week tight scan , each weekly closing price within about 1% of prior weeks (3) close. Thanks in advance
 
@rll131 I think this is what you want:

Ruby:
#UpTrending by @rll131

input PCT = 1.05 ;

plot UpTrending = low > hl2[1]*PCT and low[1] > hl2[2]*PCT  and low[2] > hl2[3]*PCT;

On a Weekly scan this returns all stocks whose:
  • current low is greater than one week ago multiplied by a percent AND
  • one week ago is greater than two weeks ago multiplied by a percent AND
  • two weeks ago is greater than three weeks ago multiplied by a percent...
If you want a longer trend just replicate the above code and change the number in the brackets.

CuFMO1C.png
 
Last edited:
@rll131 I think this is what you want:

Ruby:
#UpTrending by @rll131

input PCT = 1.05 ;

plot UpTrending = low > hl2[1]*PCT and low[1] > hl2[2]*PCT  and low[2] > hl2[3]*PCT;

On a Weekly scan this returns all stocks whose:
  • current low is greater than one week ago multiplied by a percent AND
  • one week ago is greater than two weeks ago multiplied by a percent AND
  • two weeks ago is greater than three weeks ago multiplied by a percent...
If you want a longer trend just replicate the above code and change the number in the brackets.

CuFMO1C.png
wouldn't this just scan for a down trend? im looking for something that will scan for a very steady price for at least a month to up to a year so I can add a volume scan alert to it so I can hopefully catch stocks that are going to spike from there steady price. if im wrong just let me know Im sort of new to custom scans
 
There's two studies that came to mind that don't do exactly what you want but would give you a big head start in writing the code.

The first is Darvas Box 2.0 by Simpler Trading which is free. They've submitted it to be added to TOS but it hasn't happened yet. You can get it here https://app.box.com/v/raghee/folder/47327142549. This link is from Raghee Horner directly, one of the traders/teachers at Simple Trading, which she shared in a YouTube video. No piracy.

It already finds support/resistance and detects breakouts. You would need to scan for the breakout signal and check how long the box is (how many periods) to meet your criteria. Unfortunately, it has no inputs to tweak. I haven't looked at how it determines the highs and lows it cares about.

The other is one I played with a few years ago. I liked the concept but never did anything with it.
https://usethinkscript.com/threads/...kout-breakdown-indicator-for-thinkorswim.103/

I'd recommend adding those studies on charts to visualize what they are finding and you can decide if putting effort into a scan based on one of those is worthwhile.
 
@rll131 Did you run the scan? Every stock on this scan trended up on the weekly scan for 3weeks. As I stated before if you want more candles up on a lower aggregation just continue the formula.

N91o00K.png


HTH
 
@MerryDay Could I just write something like this ? how would I add days to after close if I even can do that.

Code:
close is less than (close * 1)

Crap that what I meant up not down lol. I'm looking for scan that doesn't really go up or down more so just level lets say within a 1-5% change for the last few months or so. then I want to add unusual volume alert to hopefully catch a steady stock that is getting ready to spike.

Nevermind found this one, also since im here lol do you know how to do a rsi scan for when it breaks the 20 30 ect. I've heard this one is easy but again I don't think I know how to word it correctly to find it. I appreciate your responses
 
I've been scratching my head trying to create a scan that shows stocks over a 6 or even 10 or 15 day period that don't move much in price. Read an article recently that a 1.5% range is good to find before a big move up, and I've seen this time and time again.
The best bet is maybe to scan for flags on the weekly? I've tried using all the price tools built in to tos I can think of.
@surfmang did you figure something out? I am trying to do the same but all these scanners here don't show me that
 
I can think of a few ways to scan for 4 weeks of range bound action. The good news is the ones I think are most likely to work are also the least effort. In order of how well I think they'd work...

TTM_Squeeze (or a SqueezePro clone from this site if you want to scan for varying levels of compression).
That's the whole point of this indicator. Run on a daily chart and require that it's been in the squeeze for x number of trading days. Note that if you want 20 trading days of low volatility you need to look for fewer days in the squeeze. Price has to have slowed down for some time already before it will be in a squeeze.

CCI, Momentum and/or other indicators
Count the buy and sell signals on CCI, Momentum, moving average crossover or other studies. More signals means more choppy, sideways price action. Check that there's a relatively high number in each of the weeks not just a high total count for the entire period.

4 week range divided by ATR(20)
Find the high and low for the 4 weeks and calculate the range. Get the ATR for the 4 weeks (set ATR length to 20 instead of default 14). Divide the total range by the ATR. The lower the result the fewer average sized candle lengths price moved up and down.

Inside Bars
Find an inside bar on the monthly chart. If the range it was bound in was too wide you can add criteria that the inside bar range has to be below a certain % of the mother bar's range. A bad thing about this is one wick going one cent out of range disqualifies. This ties the range to the calendar instead of being a rolling 4 weeks. The good thing about that is many people are using inside bar strategies so more people will jump in on the breakout. If you don't like it being tied to the calendar you can take the same concept and build the date math yourself, finding the highest highs and lowest lows within whatever periods. You can also scan for consecutive inside bars.
 
looking to build a scanner I could not find one here and can't figure it out on my own. I pretty much want to scan for stocks that have stayed for lets say 1-5% for the past 20-50 days. I can only find a scan that will find stocks greater then ect.. id like to put my own percent change. just want to look for a stock that has stayed steady for awhile and then add a volume change as well so I can find a steady priced stock that might be ready to rise due to volume change. appreciate any help and if there is already a post for this please post a link and sorry I couldn't find it.

Price XYZ Bars ago has been within X% and Y% within last XYZ bars

Code:
#Price XYZ Bars ago has been within X% and Y% within last XYZ bars
#By XeoNoX Via usethinkscript.com
input barsago = 10;
#Percent as Decimal example .05 = 5%
input  MAX_Percent = .05;
input  Min_Percent = .01;
def priceback = close[barsago];
def MAXPercent = priceback * MAX_Percent;
def MinPercent = priceback * Min_Percent;
def scan1 = AbsValue(low - priceback) and AbsValue(high - priceback) is less than or equal to MAXPercent;
def scan2 = AbsValue(low - priceback) and AbsValue(high - priceback) is greater than or equal to MinPercent;
def var = scan1 and scan2;
def count = Sum(var, barsago);
Plot Finalscan = count >= 10;
#AddLabel (yes, "COUNT" +  (count)  );
 
You can also use the TTM_squeeze study in a scan, set the time to weeks. That's price and volatility compressing, not just the price.
 

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