• Get $40 off VIP by signing up for a free account! Sign Up

Scan for Stock Trading near High / Low within a Price Range

RuleOneTrading

New member
I'm currently trying to scan for stocks near highs/lows of the last 3 day period. However, a stock that is $200 would need to be within 2% of the high/low whereas a stock that costs $2 could have a valid setup trading within 15% of its highs/lows.

Does anyone know of a study I could make to scan for stocks within a 15% from high/low for stocks trading between $2-$5 and 10% between $5-$10, and 5% between $10 and $15, etc.

Currently, I have to have 4 different scanners running to capture this data. I'd use the default Near_High_Lows code as a reference, but it doesn't list a percentage in the code and I'm struggling to rewrite a working code from it.

Thank you!
 
Solution
I'm currently trying to scan for stocks near highs/lows of the last 3 day period. However, a stock that is $200 would need to be within 2% of the high/low whereas a stock that costs $2 could have a valid setup trading within 15% of its highs/lows.

Does anyone know of a study I could make to scan for stocks within a 15% from high/low for stocks trading between $2-$5 and 10% between $5-$10, and 5% between $10 and $15, etc.

Currently, I have to have 4 different scanners running to capture this data. I'd use the default Near_High_Lows code as a reference, but it doesn't list a percentage in the code and I'm struggling to rewrite a working code from it.

Thank you!

This should get you what you're looking for. Modify as necessary...
I'm currently trying to scan for stocks near highs/lows of the last 3 day period. However, a stock that is $200 would need to be within 2% of the high/low whereas a stock that costs $2 could have a valid setup trading within 15% of its highs/lows.

Does anyone know of a study I could make to scan for stocks within a 15% from high/low for stocks trading between $2-$5 and 10% between $5-$10, and 5% between $10 and $15, etc.

Currently, I have to have 4 different scanners running to capture this data. I'd use the default Near_High_Lows code as a reference, but it doesn't list a percentage in the code and I'm struggling to rewrite a working code from it.

Thank you!

This should get you what you're looking for. Modify as necessary.

Code:
input daysback = 3;
input percent1 = .15; #15 percent
input begin1 = 2.0; #2 dollars
input end1 = 5.0;
input percent2 = .10;
input begin2 = 5.01;
input end2 = 10.0;
input percent3 = .05;
input begin3 = 10.01;
input end3 = 15.0;

def lowday = lowest(low, daysback);
def highday = highest(high, daysback);
def range = highday - lowday;

def prices1 = close >= begin1 and close <= end1;
def prices2 = close >= begin2 and close <= end2;
def prices3 = close >= begin3 and close <= end3;

def top1 = close >= (highday - (range * percent1));
def bottom1 = close <= (lowday + (range * percent1));
def top2 = close >= (highday - (range * percent2));
def bottom2 = close <= (lowday + (range * percent2));
def top3 = close >= (highday - (range * percent3));
def bottom3 = close <= (lowday + (range * percent3));

plot scan = 
        prices1 && top1
    or prices1 && bottom1
    or prices2 && top2
    or prices2 && bottom2
    or prices3 && top3
    or prices3 && bottom3;
 
Solution

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