[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: Referencing a point in time



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "gp_sydney" <gp.investment@xxx> 
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



Please note that this group is for discussion between users only.

To get support from AmiBroker please send an e-mail directly to 
SUPPORT {at} amibroker.com

For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/