Adding Daily Relative Range & Average Day Range


Category:
0
0

Hi Pete,

TOS has Daily Relative Range under “Available” in “Customize” but I don’t see this as an option under Condition Wizard? Is there a way to add this formula and have me enter my own desired threshold % to the scan below? Ex: Daily Relative Range > 80%. Also, I’d like the scans to only pick up stocks that move at least .50% over the previous X days. This way it can avoid stocks that barely move.

Thank you

close crosses above PriceChannel().”UpperBand” and close is greater than high from 1 bars ago > .10 and MovingAverage(“averageType” = AverageType.EXPONENTIAL, “data” = CLOSE, “length” = 8) is greater than MovingAverage(“averageType” = AverageType.EXPONENTIAL, “data” = CLOSE, “length” = 21) and close is greater than MovingAverage(“data” = CLOSE, “length” = 200)

#close crosses below PriceChannel().”LowerBand” and close is less than low from 1 bars ago > .10

Marked as spam
Posted by (Questions: 8, Answers: 18)
Asked on August 19, 2019 10:48 am
1585 views
0
Private answer

The "DailyRelativeRange" is listed when customizing a watchlist. Let's make sure that is clear so we don't confuse a bunch of viewers. This question is listed in the "Stock Scanners" topic and unless we explicitly state that "DailyRelativeRange" is a column you can add to a watchlist nobody else will be able to figure this out.

When you find "DailyRelativeRange" listed in the available columns to add to your watchlist, simply click the script icon to open that column in the thinkScript Editor view. Then you can copy that code and use it for your scan. (after making the required modifications).

input price = close;
def RPR = round((price – low) / (high – low) *100);
plot scan = RPR > 80.0;

As for stocks that have moved at least 0.5% in previous x days:

input numberOfDays = 10;
plot scan = close > Highest(close[1], numberOfDays) * 1.005;

You can add these as separate study filters on your scan so you don't have to figure out how to get them all to work together in one section of code.

Marked as spam
Posted by (Questions: 37, Answers: 4084)
Answered on August 19, 2019 1:02 pm
0
How would these two criteria added to the price channel breakout/breakdown scan rather having them as separate studies?
( at August 19, 2019 1:36 pm)
0
There is no need to do that. Don't try to overcomplicate things. Go for the simplest solution.
( at August 19, 2019 2:08 pm)
0
I can't believe I didn't think of having separate studies before. You're a genius Pete! This is how Average Day Range is calculated: The day range returns the difference between the high and low prices of the day, represented as a percent of the closing value. For example, suppose a stock closed at 10, the high was 11 and the low was 9. The difference between the high and low is 2. Represented as a percent, the day range is: 20%. The average day range computes a simple average of the day range over a given number of days. This value is also represented as a percent of the closing price. Would you know why this isn't returning the correct calculation? input numberofdays = 21; def diff = high - low; def daypos = diff * close; plot avgdayrange = daypos / numberofdays;
( at August 20, 2019 9:23 am)
0

This is how I compute that value. I keep this formula in a spreadsheet on my Google drive so I don't have to remember it:

def percentOfRange = (close - low) / (high - low);

( at August 20, 2019 10:12 am)
0
I still can’t figure out the formula for avgdayrange over the past 21 days. Also, what aggregate time frame should be used for the scan?
( at August 20, 2019 11:57 am)
0
Oh, well if you want the average daily range averaged over a number of bars, just use the code from the ATR study. Aggregation period is up to you. But seems to me from the code we are implying a daily time frame. Especially if you plan to use the ATR code.
( at August 20, 2019 1:29 pm)