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

Stocks within 75% of Todays ATR range

Chiku83

New member
I need to build scanner to find stock which close above 75% of its range. Suppose stocked yesterday moved 100$ and was close above 75$ than i want to find that stock. Can someone help with TOS logic.
 
75% of its range... you didnt specify what range compared to what? what range?

100$ and was close above 75$ ... you will have to clarify this.
 

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

no suppose stock did move 100$ in a day ....at the start of the day opening was 200$ and close was 300$ ...so stock moved 100$ ...hence if it closes above 275$ ,,,that is 75% range.
 
no suppose stock did move 100$ in a day ....at the start of the day opening was 200$ and close was 300$ ...so stock moved 100$ ...hence if it closes above 275$ ,,,that is 75% range.

you want the low to be calculated as well? lets say the stock went below the open for a few dollars and it hit 190... according to your example now the range is 110? you want the low calculated in the range as well?
 
Can you grab a stock from today an plug in the numbers of how you want it to calculate and post back so that way i can see how you came up with the numbers.
 
Ticker: Baba
Open 231.99
Low: 230
High 239.19
Close 236.26

Range is High-Low = 239.19-230 = 9.19$

Close delta from low = 236.26-230(low) = 6.26

Hence 100% =9.19

So baba close > 68% of range. I can adjust threshold of 60 % instead of 75%.
 
The range you are talking about for future reference is called the ATR in trading.
ATR is above or below X Percentage
Price is at XYZ Percent of Todays ATR

remember to hit that like button if you found my post useful

n40NJeD.png



Code:
# ATR is above or below X Percentage
# Price is at XYZ Percent of Todays ATR
# By XeoNoX via usethinkscript.com

input threshold = 60;

def high1 = (high(period = AggregationPeriod.DAY));
def low1 = (low(period = AggregationPeriod.DAY));
def range = (high1 -  low1);

def x = high1 - low1;
def x2= close-low1;

def percentage= (x2/x)*100;

def  scan=  percentage > threshold;

AddLabel (yes, "Price is at " +  round(percentage,2) + "% of Today's ATR" );

For the scan u change:

Code:
def  scan=  percentage > threshold;

to

Code:
plot scan=  percentage > threshold;

and remove or comment out the "addlabel"

Code:
#AddLabel (yes, "Price is at " +  round(percentage,2) + "% of Today's ATR" );
 
Last edited:
Also want to do another script similar to short stock..it would be similar to above but instead greater than 60%....close of stock should be less than 25% of the range.

Eg Roku previous day (12/28) is perfect example
Open
High: 360.99
Open 359.50
Low 339.13
Close:340.33

Range: 360.99-339.13 =21.86

Close from low = 340.33-339.13=1.20 $

So 21.86 $ = 100%

1.20 = 58.29 =5.48%

Hence it should be part of scanner for today and can sort on price action..today would be perfect day for ROKU to get sort.

The range you are talking about for future reference is called the ATR in trading.
OK thanks got it. Appreciate it. Hear about it but didn't knew about it..let me try for couple of days and see if it matches my requirements. Thank you once again for all your time and responding to it....tons of thanks
 
Last edited by a moderator:
I have no clue where you got 58.29 from.... however if you want it below 5% you just change:

input threshold = 5;
plot scan= percentage < threshold;

NOTE: for simplicity sake i kept the aspercent out of the label so you could scan against easier.
 
Last edited:
Ok...thanks and if I have to plot ATR for previous day i have to add [1]?

Code:
# ATR is above or below X Percentage
# Price is at XYZ Percent of Todays ATR
# By XeoNoX via usethinkscript.com

input threshold = 60;

def high1 = (high(period = AggregationPeriod.DAY[B][1])[/B]);
def low1 = (low(period = AggregationPeriod.DAY[B][1][/B]));
def range = (high1 -  low1);

def x = high1 - low1;
def x2= close-low1;

def percentage= (x2/x)*100;

def  scan=  percentage > threshold;

AddLabel (yes, "Price is at " +  round(percentage,2) + "% of Yesterday's ATR" );
 
To get the previous days you would at [1] so that it looks like this:

Code:
def high1 = (high(period = AggregationPeriod.DAY)[1]);
def low1 = (low(period = AggregationPeriod.DAY)[1]);
 

Not the exact question you're looking for?

Start a new thread and receive assistance from our community.

87k+ Posts
273 Online
Create Post

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