Show Bar Count when Volume > 1000


Category:
0
0

Pete, 

Thanks for all the help. 

I know we cannot get timestamp, but this there a way to show the bar count in watchlist when a Volume of more than 1000 was recorded on the minute chart on an option. I get alerts when new alerts come in and I can visually see it on the chart as shown in the attached image but not able to sort by this. If there is a way to see the bar count then I can sort by when the most recent order was placed. 

 

Thanks 

B

Attachments:
Marked as spam
Posted by (Questions: 6, Answers: 10)
Asked on May 29, 2020 8:32 am
192 views
0
Private answer

I read through your request a few times and still end up with two different ways to interpret your request. I believe you asking for one of these two:

  1. For each trading session, display the number of bars since the first 1 minute bar recorded volume greater than 1,000
  2. For each trading session, display the exact bar number at which the first 1 minute bar recorded volume greater than 1,000

Let me know which one it is. Or if you actually need something entirely different.

Since you are requesting a custom watchlist column and not a scan I have moved this out of the "Stock Scanners" topic and into the "Watch List" topic.

Edit: I can provide a solution now that we have clarification on this request in the comments section below.

The code will need to be run on a custom column that does NOT included extended trading hours. However it will also work if you included extended hours but it will begin the bar count after midnight Eastern.

input volumeThreshold = 1000;
def newDay = GetDay() <> GetDay()[1];
rec trackHighestVolume = if newDay then volume else if trackHighestVolume[1] < volumeThreshold and volume > trackHighestVolume[1] then volume else trackHighestVolume[1];
rec countBars = if newDay then 1 else if trackHighestVolume < volumeThreshold then countBars[1] + 1 else countBars[1];
plot data = if trackHighestVolume > volumeThreshold then countBars else 0;
data.AssignValueColor(if data <> 0 then Color.BLACK else Color.CURRENT);
AssignBackgroundColor(if data > 0 then Color.GRAY else Color.CURRENT);

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 29, 2020 1:20 pm
0
Hi Pete, My bad, I was posting in the Solution section. I am looking for point # 2: For each trading session, display the exact bar number at which the first 1 minute bar recorded volume greater than 1,000. So hopefully, it may look something like this or you may have simpler and better idea: If the first Volume of 1000 or greater is at 10.30 am, the count would show 60 - since from the start of the trading session at 9.30 am, 10.30 would be the 60th bar. Thanks.
( at June 3, 2020 10:14 pm)
0
I have updated my answer to provide the solution you specified.
( at June 4, 2020 7:35 am)
0
Thanks Pete! I'm donating for the time you spend in helping us. This is immensely helpful. So in the watch list I'm only seeing "1" when there has been a bar that has volume > 1000 and NaN when no bar has volume > 1000, it is not showing the barcount at which the volume was greater than 1000. Like the first bar at which volume was greater than 1000 is at 11.30, but the column is showing "1" and not 120. Is it possible to see the barcount instead of "1"? I had taken a screenshot but not attach it to the comment section.
( at June 4, 2020 9:11 am)
0
Hi Pete - on second look the code does not seem to work. It's displaying 1 for all options. Help will be appreciated.
( at June 6, 2020 4:37 am)
0
Need more details. It works fine when I tested it using futures contracts. Individual options contracts have very low trading activity and all kinds of things can go wrong when you don't have sufficient data to work with. What time frame have yo set the column to and what are some of the OPRA codes you are using? (not more than 6 please).
( at June 6, 2020 7:53 am)
0
Hi Pete, I wish I could show this to you in a screenshot but I'm unable to attach am image to the Comment. If you accept, I'm attaching a screenshot to the Solutions Only. But the problem is that the new watchlist column displays "1" all the the time. It does not display a number other than 1. It displays "1" even when the Option does not have a single volume bar greater than 1000. I looking for the column to display the first Bar Number which had volume > 1000. And the Options that I'm looking at have large volume and very liquid. Is that possible and am I doing something wrong?
( at June 8, 2020 10:48 pm)
0
I reviewed you screenshot. In the future you will need to upload your screenshot to a cloud drive and post a link to it in the comment section. Your screenshot did not show the time frame you applied to your watchlist. When I added some of those OPRA codes to my own watchlist they all displayed zero, because the new trading day had already started. So I reduced the volumeThreshold down to 300 and got mixed values that indicate this code is working CORRECTLY. The only explanation for the results on your screenshot is that you have the time frame set to the daily time frame. That is the only way this code can produce a value of 1 for all of those OPRA codes. But I have already explained this in a previous comment. I have already spent 3 times as much time as I permit for providing solutions while responding to your follow up questions. This is the end of my support for this thread. If it does not do what you requested then delete the post and move on to something else.
( at June 9, 2020 7:37 am)
0
Private answer

Hi Pete, I wish I could show this to you in a screenshot but I'm unable to attach am image to the Comment. If you accept, I'm attaching a screenshot to the Solutions Only. 

But the problem is that the new watchlist column displays "1" all the the time. It does not display a number other than 1. It displays "1" even when the Option does not have a single volume bar greater than 1000. I looking for the column to display the first Bar Number which had volume > 1000. And the Options that I'm looking at have large volume and very liquid. Is that possible and am I doing something wrong? 

Attachments:
Marked as spam
Posted by (Questions: 6, Answers: 10)
Answered on June 8, 2020 10:48 pm