Problem reading intraday volume

ptcman

Junior member
Messages
15
Likes
0
Hi.

I'm having problems reading intraday volume.

First, I tried this formula:

Code:
if time > 1430 and time < 2100 then 
plot1(cum(volume));

It cumulates the volume of each time period, but from the begining of the chart until today. The reading don't reset at the end of the time period. How to make it reset itself, starting the count from zero in the begining of each time period?

But then I tried this formula:

Code:
if lastcalcdate = date then begin	
if time > 1430 and time < 2100 then 
plot1(cum(volume));
end;

And I noticed that the cumulative volume is not being made correctly.

The volume of the bar that starts the time period indicates 42158 contracts but the cumulative volume indicates 6076335 for that same bar :eek:

Where is he going to find that number? It should show the same number as the volume of that first bar.

Where is the problem?

Regards,
ptcman
 
Hi.

I resolved part of the problem but apparently, created another :(

I wrote this study that plots the last session volume correctly:

Code:
var: counter(0);  
if LastCalcDate > date then 
counter = cum(volume);
plot1(cum(volume)-counter);

Then decided to specify a time period and here is where the problem was created:
Code:
var: counter(0); 
if time > 1430 and time < 1530 then
counter = cum(volume);
plot1(cum(volume) - counter);

Strangely enought, this last formula cumulates the volume outside the time period and not inside :-0 :eek:

For the past 2 hours I'm trying to discover the problem but no such luck :confused:

How can I cumulate the volume inside the time period as specified?

Regards,
ptcman
 
Top