Relative Volume by Time


Category:
0
0

I came across a relative volume indicator based on time. However, I cannot turn this script into a scan because “The complexity of the expression suggests that it may not be reliable with real-time data”. The relative volume scan in TOS, unusual volume, only checks to see when volume is above its moving average. I am trying to construct a time-based (intraday) relative volume scan, which will see what the average volume is for a given bar at a specific time of day, and then compare the current volume to that bars average, giving me the relative volume of that bar.

I will put a link below of the study because it is way too long to post on here. The way the study works is that in order to get the average volume of the current bar, the aggregation period be greater than 1 day. A 20 day, 5 minute chart will give the average volume of each 5 minute bar over the last 19 days. The reason it is 19 days is because it does not factor in the volume of the current bar for the average volume.

I am looking to build a scan for the relative volume of the current bar, on a 5 minute chart, over the last 30 (if we can do 60 I’d prefer that) days. I only want the scanner to pick up a stock when the relative volume is over 2.00, so the stocks volume is trading on 2x its average volume of the past 30 (or 60) days. I tried my best to explain this script, let me know if I need to clarify something. Many thanks in advance, Pete.

Link: http://tos.mx/3CvTfI

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on April 24, 2017 10:03 am
4872 views
0

I opened the link you provided and the workspace loaded a single chart and there was no study file assigned to the chart. Try sharing just the chart grid. Not the entire workspace. And be sure you have added the study to the chart before sharing. Then you will be prompted if you want to include the custom study along with share. Only do this if you are comfortable sharing your code with the general public.

As to your question about covering 30-60 days, that is not going to be possible. The data limit for scans is set to 15 days when using the 5 minute aggregation period. There is no way to work around this limitation. You can read more here: http://toslc.thinkorswim.com/center/howToTos/thinkManual/Scan/Stock-Hacker/studyfilters.html
This limitation applies to Conditional Orders, Custom Quotes, Study Alerts and Study Filters in addition to Scan. Some of these are more restrictive than others.

( at April 24, 2017 12:28 pm)
0

http://tos.mx/974wTC

That should work.

( at April 24, 2017 2:42 pm)
0
Private answer

Ok, that link worked. First rule in trouble shooting is to start with the smallest scope that functions correctly and add to it until it breaks. Here is where it breaks:

else if barcounter == 13 then avgbar13

It works fine until you add the thirteenth nested IF statement. That’s where it breaks. We hit the block wall right there. See if you can find a way to accomplish your goals while limiting your nested IF statement to 12 levels. I have no idea if there is a path to do so. It would probably take me hours to find out if it’s even possible.

Keep in mind you will still be limited to 15 days of 5 min bars. That is the other block wall. There is nothing you can do about that, except to move this project to another platform.

I have one suggestion. It seems to me that there is absolutely no reason to build the scan code so that it loads every single volume bar when you are only evaluating the current bar, comparing it to it’s average volume. Obviously you need that for the chart. And it is quite possible you don’t even need it for the chart version either. So why not see if you can work out a solution that loads only the current bar of volume? Identify the current bar by index number of some sort. Whatever is the current bar’s index, go and calculate the average volume for that same bar in the past 15 days.

Best of luck to you!

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on April 24, 2017 4:16 pm