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.
Low calculate as wellyou 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?
# 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" );
def scan= percentage > threshold;
plot scan= percentage > threshold;
#AddLabel (yes, "Price is at " + round(percentage,2) + "% of Today's ATR" );
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 thanksThe range you are talking about for future reference is called the ATR in trading.
Yes Ben@Chiku83 So you want to calculate the range of the previous day and use that for the current trading day?
# 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" );
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.