Percent above 10 day Avg Daily Range


Hi Pete,

Thanks for maintaining this excellent resource! Just contributed to support.

I want to create a custom WL for the below study I use. It plots the 10 day avg daily range and adds / deducts the range (divided by 2) to/from the daily open price.

For eg. if avg high – low range for the last 10 days is $5 and the stock opens today at $10, it adds / deducts $2.5 to / from $10.

So, $7.5 and $12.5, form the lower and upper range for the day.

Trying to determine which stocks in my watchlist have broken through either the high or low of that range ($7.5 and $12.5 above). This can then be shown in watchlist as %. If current price is higher, be great to have a dark green background and red background if vice-versa. Only need this for regular trading hours because range for day is defined on basis of the daily open price at 9.30am NY time.

Appreciate your time Pete, thank you.

Code for the study attached in txt format. Screen grab attachment shows eg. for AAPL over the past 20 days.

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on June 24, 2021 6:20 am
Private answer

Sorry but your code uses secondary aggregations and these are not supported in custom watchlist columns using the current version of Thinkorswim. There does not appear any way to reconfigure the code to comply with this limitation.

Marked as spam
Posted by (Questions: 39, Answers: 3752)
Answered on June 24, 2021 7:14 am
Thanks for the prompt response Pete. Understand the restriction here, thanks for pointing out. I guess I'll have to load up the upper and lower daily range as values (two columns) with daily open as a separate column, export to excel and then compare that manually. Probably the only workaround as I see it?
( at June 26, 2021 5:07 am)
Actually if you study your code carefully you will find that everything can be computed from the daily time frame. The only reason to use secondary aggregation periods is because you have applied this to a chart set to 15 min. If you remove the secondary aggregation periods and apply this to a daily time frame the computations will be the same result. Which means you can convert this code to a form that will compute these values in a custom watchlist column that is set to the daily time frame.
( at June 26, 2021 8:12 am)