Scan for stocks with lowest RSI and MACD


New member
Hi, Need to create a scanner for stocks with the following condition.

Find stock with the lowest RSI and MACD values. These lowest values should be in the range of +/-x bars from each other.

Following diagram is sample representation of aforementioned condition. Can someone please help with it? I tried to set it up using predefined option in ThinkOrSwim but couldn't get it right.


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

since the macd/rsi follow price you are doing the same thing as looking up the lowest price of the past year

TOS has a built in scan to find the lowest low (lowest price) of the past 52 weeks (bars).
You can confirm what I said @ZilluZim with the scan below. here is one of the 2 you requested since they do the same thing i just made it for your satisfaction.

MACD is at the lowest data point of the past 252 Days (set aggregation to day)
declare lower;
input fastLength = 12;
input slowLength = 26;
input MACDLength = 9;
input averageType = AverageType.EXPONENTIAL;
def Value = MovingAverage(averageType, close, fastLength) - MovingAverage(averageType, close, slowLength);
plot scan= getminValueOffset(value,252) <1;
Use this in conjunction with range for Stock Last Price and Volume etc., else script times out.

declare lower;

input howFarBack = 200;

def MACDValue = reference MACD().VALUE;

def rsiValue = reference RSI()."RSI";
def rsiOverS = rsiValue <=30;

plot scan = macdValue < Lowest(macdValue[1], howFarBack) and rsiValue < Lowest(rsiValue[1], howFarBack) and rsiOverS;

Similar threads

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

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