# Volume on Open

Hi,

I have access to intraday data through IQ Feed and have been trying to write something that shows both volume and price movement for the first 5 minutes of trading but have so far been spectacularly unsuccessful.

Any ideas would be gratefully accepted!

Cheers

Kim

Hi Kim,

The script you would use would have to be custom made for a specific time frame. You then need to identify the first bar of the day, then the final part of the script needs to make the calculation you are after from that point.

Here is an example using IQFeed data of AAPL on a 1 minute time frame displaying the volume of the first 5 bars:

```//Measure first 5 Bars of Volume
V1 = ACC(VOL(), RANGE=Look Back Period, BARS=6) ;
//Identify First Bar of the Day
V2 = BARDATE() - OFFSET(BARDATE(), OFFSET=1);
V3 = V2 > 0.3;
//Once first bar is found, offset by 5 bars to allow accumulation measurement
V4 = OFFSET(V3, OFFSET=5) ;
//Result
IF(V4 == 1,V1,0)```

I have included some comment lines so you can see what each step is doing.

Here is what the result would look like on a chart:

Using a different time frame, or a market that runs 24 hours would require the script to be modified, but this will give you a general idea of how to go about finding the trigger point you’re after.

Matthew, just want to say you guys are super smart and always super responsive, so thank you for that.

That goes for me too, that is exactly what I need to get going. Truly outstanding support and customer service!!

Hi again,

I’ve used the script to create a list of companies that had sufficient liquidity for setting my buy/sell at “market”. I recently ran the script again to see if the list was still valid and noticed that IQ Feeds generates minute bars for pre-market trading, which means that the market open bar (9:30 AM) isn’t always the first bar of the day.

I discovered that BARDATE on a minute chart includes the fraction of the day that the time represents, and that fraction for the minute bar relating to 9:30AM is ~0.3958, so I tried to use that but I’m still not getting the result I expect from the script below (only finding about 15 companies from my list of 2,000).

No doubt it’s a case of “spot the obvious error”, but I can’t!!

Cheers

Kim

The script I’ve written is:

MinLiquidity = 60,000 ;

v1 = BARDATE(MINUTE()) ;
v2 = BARDATE(DAY()) ;
v3 = v1 - v2 ;

// In BARDATE, Midnight is 0.000 and 9:30AM is 0.3958

FirstBar = v3 >= 0.3957 and v3 <= 0.3959 ;
liq1 = VOLUME(MINUTE()) ;
liq2 = OPEN(MINUTE()) ;
Liquidity = liq1 * liq2 ;
FirstLiq = IF(FirstBar== 1,Liquidity,0) ;
LiqChk = FirstLiq > MinLiquidity ;

LiqChk and FirstBar

Hi Kim,

We have completely rebuilt the IQFeed interface in v1.6 which is currently in beta testing, and this allows you to ignore out of market ticks. If you don’t see the beta banner on start up, send support a ticket requesting access.

However, to scan on 2000 stocks may breach IQFeed’s data limit, so the scan may not work for such a big list. Try it first on the Dow 30 and see how you go.

Have you seen this tool? It shows average intraday volume on a chart which may be useful:

https://help.optuma.com/kb/faq.php?id=548

Hi,

I’ve installed v1.6 and reloaded the charts and have ignored out of market ticks by changing the session times (as per Mathew suggestion), so visually the charts look perfect, but I’m still not getting the expected results from either my code or Matthew’s.

I’ve run both scripts with Scanning Manager against a csv file of 500 companies, but I’m not getting companies that I have manually verified meet my criteria.

As an FYI, I’m able to open a watchlist with over 2,000 companies using IQ Feeds.

Thanks again

Kim

Hi,

You can use a variation of the script i posted last week regarding the colouring of our of session bars to mark the volume of the first bar, then run a calc based on that value.

This is Open x Volume of the 9.30am bar, set to be used on a 1 min AAPL chart:

```//Find the full bar date with intraday decimals
V1 = BARDATE() ;
//Find the daily bar date, without decimals
V2 = ROUND(V1, DECIMALTYPE=0) ;
//Reduce bar date to intraday range only
V3 = V1 - V2;
//First Session Bar
V4 = (V3 > 0.3955) and (V3 < 0.3965);
//Calc at Open
V5 = OPEN() * VOL() ;
V6 = IF(V4 == 1,V5,0) ;
V6```

This is how it looks on a Show View…

Each bar is the 9.30am bars open multiplied by the same bars volume value.

Perfect!! That’s exactly what I was trying to achieve!!

Very much appreciated; fantastic service as usual