alert once daily volume crosses above 5% of average daily volume within the 1st hour


0
0

Hi Pete,

I’m trying to set up a scan to alert me when the daily volume for a stock (from my watchlist) crosses above 5% of the daily average volume only within the first hour of the trading day.  I was able to make the below scans from your previous forum answers.  So far I was not able to get any alerts.  I know the volume has been low the last couple of weeks but I would think that I would at least get 1 alert since it’s only 5%.  I just wanted to ask you if you could take a look at it and see if I’m doing this correctly?  Thank you.

Attachments:
Marked as spam
Posted by (Questions: 7, Answers: 9)
Asked on February 28, 2018 10:33 am
182 views
0
Private answer

What I do when I run into an issue I can’t explain is I split things out into the smallest possible pieces. So for example I took out the first hour filter and left only the test for volume. Running that at the end of the day, I only got 3 stocks in the results. Obviously there is the problem. So I changed it from “crosses above” to “is greater than”. That one returns 3,592 results, running against a list of “All Optionable”.

So here is why. When you use the phrase “crosses above”. This requires the previous data point to be less than the value and the current data point to be greater than the value. So when you say the today’s volume “crosses above” five percent of average daily volume. You must first have a previous day that is less than 5% of daily average volume. Make sense?

Marked as spam
Posted by (Questions: 37, Answers: 4087)
Answered on February 28, 2018 1:37 pm
0

Hi Pete,
Thank you for your information. Yes, it definitely makes sense. And it worked this morning when I tested it. However could you take a look at the timeframe filter? It seemed to have starting sending alerts about 1/2 hour before the market opened. Thank you.

( at March 1, 2018 3:46 pm)
0

That makes sense actually. Because for the Scan data we don’t have a way to start the aggregation period at market open. So the first hourly bar does indeed span the 30 minutes before and 30 minutes after the market open. You will need to modify that time filter. Setting it to 30 min time frame to start with. Then use this modified code:
def newDay = GetDay() GetDay()[1];
plot scan = newDay or newDay[1];

This new time filter will pick up the first two bars of the trading day. So to capture the first hour of regular trading, you will need to use it with a 30 min time frame.

( at March 1, 2018 4:29 pm)