Is it possible to create a scanner when a stock make HH and retrace back at least 50%?View attachment 18732
# 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.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;
# 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.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;
Join useThinkScript to post your question to a community of 21,000+ developers and traders.
Start a new thread and receive assistance from our community.
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.
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.