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" );