Hourly relative volume over 60-day period


Category:
0
0

Hello Pete,

I need to determine the hourly relative volume over 60-day period of particular ticker.  Can it be done in TOS?

This is what I have so far:

def agg = AggregationPeriod.DAY;
input length = 61;
input offset = 1;

plot RVol = Volume (period = agg) / Average (Volume (period = agg), length)[offset];

 

Thank you very much in advance.

Marked as spam
Posted by (Questions: 2, Answers: 2)
Asked on April 2, 2020 5:22 am
222 views
0
Private answer

What you have there is a chart study. So I moved this post out of the "Stock Scanners" topic and into the "Chart Studies" topic.

There is nothing here at all that fits your question title. This is not an hourly "relative volume". And it's not over a 60 day period. The input you are using is 61 bars. So this is computed for a period of 61 "trading days". The average number of "trading days" in a given month is 21. So you have 90 calendar days worth of value being computed.

The code you have will compute a ratio of volume divided by average volume from the DAILY time frame. If you wanted to compute this value over a period of 60 trading days then you will change the input named agg to 42.

 

 

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 2, 2020 7:09 am
0
Thanks Pete. I've taken the number of trading days into consideration hence the 60 periods (trading days) but I failed to to mention that in the description. All I need at this point is to have the code calculate the hourly (hour by hour) average volume of the 60 trading-day period. Can you please help?
( at April 2, 2020 8:15 am)
0
Sorry, this is nearly impossible to do using Thinkorswim. This is only a basic scripting language. We don't have an ability to work with custom arrays in this language. Others have attempted to do this. With limited success. Search the forum to find previous posts on this topic. (actually I hope you searched before posting this question)
( at April 2, 2020 9:24 am)