Thanks for that, GP. I should explain that I'm trying to build my 
first system here :)

Using 1-minute bars, I'm trying to calculate the volume for the first 
30 minutes. Using the DateNum function as a starting point, this is 
what it looks like so far:

dn = DateNum();
StartDay = dn != Ref (dn, -1);

if (Ref (StartDay, 0))
    OpeningVolume = 0;
else
;

if (Ref (StartDay, -29))
    OpeningVolume = Sum (V,29);
else
;

VolumeOK = IIf (OpeningVolume > (AvgVol30Days * 0.25)), 1, 0);

This use of if-else looks very crude to me, but I'm not familiar 
enough with AFL to make something elegant (and haven't really 
programmed for 10-15 years - a bit rusty). But I want to set the 
OpeningVolume to 0 until I have the OpeningVolume (after 30 minutes), 
at which point I'm comparing it to the average daily volume. Will 
this work?


--- In [email protected], "gp_sydney" <[EMAIL PROTECTED]> 
wrote:
>
> You could first create a start-of-day signal array by checking for 
the
> date not being equal to the date of the previous bar. That would be
> something like this:
> 
> dn = DateNum();
> StartDay = dn != Ref(dn, -1);
> 
> That should give a one at the first bar of each new day.
> 
> Once you have that, you could sum the volume a few ways, depending 
on
> exactly where you want the resulting numbers to be. Say you want 
them
> just on the last bar of those periods, then you could use something 
like:
> 
> volSum = IIf(Ref(StartDay,-25), Sum(V, 25), 0);
> 
> That says when the first bar of the day was 25 bars ago, store the
> value of the 25-bar sum of volume, otherwise store zero. So the 
volSum
> array would end up full of zeroes except for the 25th bar of each 
day
> which would have the sum of the previous 25 bars' volume.
> 
> I don't have intra-day data so can't check this, but I think it 
should
> work.
> 
> Regards,
> GP

Reply via email to