Create Scanner for stocks that retrace 50% after making HH?

ShoNuff

New member
Is it possible to create a scanner when a stock make HH and retrace back at least 50%?
2023-05-18-TOS_CHARTS.png
 
Solution
Not sure if it worked.

Not sure. DE came up on the scanner. View attachment 18740

I think I better understand what you are looking for. Try the following code. It makes sure a new higher high was made in the last 10 periods compared with the 10 periods prior. The condition is met when the current close is less than 50% of the highest high averaged with the lowest low in the last 10 periods.

Note:

  • I ran this scan, and I found mostly the stocks that seemed to meet your criteria however there were some odd balls. I was able to filter out most of those by making sure I was scanning for stocks above $10 and with High average volume.
  • Play around with the period to get different results. To add more flexibility I added to...
Is it possible to create a scanner when a stock make HH and retrace back at least 50%?View attachment 18732
Code:
# Define the period
def period = 10;

# Identify a higher high over the specified period
def HH = high > highest(high[1], period);

# Identify a 50% retracement from the highest high over the specified period
def retracement = close <= (highest(high, period) + lowest(low, period)) / 2;

# Combine the conditions
plot scan = HH and retracement;
 
Code:
# Define the period
def period = 10;

# Identify a higher high over the specified period
def HH = high > highest(high[1], period);

# Identify a 50% retracement from the highest high over the specified period
def retracement = close <= (highest(high, period) + lowest(low, period)) / 2;

# Combine the conditions
plot scan = HH and retracement;
Not sure if it worked.

Not sure. DE came up on the scanner.
1684727880352.png
 
Last edited by a moderator:
Not sure if it worked.

Not sure. DE came up on the scanner. View attachment 18740

I think I better understand what you are looking for. Try the following code. It makes sure a new higher high was made in the last 10 periods compared with the 10 periods prior. The condition is met when the current close is less than 50% of the highest high averaged with the lowest low in the last 10 periods.

Note:

  • I ran this scan, and I found mostly the stocks that seemed to meet your criteria however there were some odd balls. I was able to filter out most of those by making sure I was scanning for stocks above $10 and with High average volume.
  • Play around with the period to get different results. To add more flexibility I added to adjustable periods
  • Scans are tough because there are a lot of companies that may meet your specific logic but not look great to the human eye. You will have to use your own judgement to filter out the stocks you are not interested in

Code:
# Define the period
def recentPeriod = 10;
def distantPeriod = 10;



# Identify a higher high over the specified period
def HH = highest(high[1], recentPeriod) > highest(high[recentPeriod], distantPeriod);

# Identify a 50% retracement from the highest high over the specified period
def retracement = close <= (highest(high, recentPeriod) + lowest(low, recentPeriod)) / 2;

# Combine the conditions
plot scan = HH and retracement;
 
Last edited:
Solution
I think I better understand what you are looking for. Try the following code. It makes sure a new higher high was made in the last 10 periods compared with the 10 periods prior. The condition is met when the current close is less than 50% of the highest high averaged with the lowest low in the last 10 periods.

Note:

  • I ran this scan, and I found mostly the stocks that seemed to meet your criteria however there were some odd balls. I was able to filter out most of those by making sure I was scanning for stocks above $10 and with High average volume.
  • Play around with the period to get different results. To add more flexibility I added to adjustable periods
  • Scans are tough because there are a lot of companies that may meet your specific logic but not look great to the human eye. You will have to use your own judgement to filter out the stocks you are not interested in

Code:
# Define the period
def recentPeriod = 10;
def distantPeriod = 10;



# Identify a higher high over the specified period
def HH = highest(high[1], recentPeriod) > highest(high[recentPeriod], distantPeriod);

# Identify a 50% retracement from the highest high over the specified period
def retracement = close <= (highest(high, recentPeriod) + lowest(low, recentPeriod)) / 2;

# Combine the conditions
plot scan = HH and retracement;
I love this scan and use the set up a lot. I am so grateful for this simple and important to me thing you created Thank you. I have tried to make the same thing for a lower low... and I just cant think it through (I am using a lookback of 20 periods). This is what I have so far. Can you please check it? I am also really hoping for a watchlist column which will show solid yellow for those on the list that are between the .50 and the .61 retracement. Is there any way you could do this? I would be most grateful indeed.

# Define the period
def recentPeriod = 20;
def distantPeriod = 20;



# Identify a lower low over the specified period
def LL = lowest(low[1], recentPeriod) > lowest(low[recentPeriod], distantPeriod);

# Identify a 50% retracement from the lowest low over the specified period
def retracement = close >= (lowest(low, recentPeriod) + highest(high, recentPeriod)) / 2;

# Combine the conditions
plot scan = LL and retracement;
 
Last edited:

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