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

[amibroker] help---day counter (intraday avg vol) question



PureBytes Links

Trading Reference Links

Hello,

  I have some intraday data. Try to get the avg vol from 9;30-9:35am 
over one month.


my code :

m=22; // 22 trading days are aound 30 calendar days

for (j = 2; j <m; j++)
{Totalvol=Totalvol+ValueWhen(((TimeNum()==093000) ),V,j);
 FirstDate=ValueWhen(((TimeNum()==093000) ),DateNum(),j);
 Firstdate2=ValueWhen(DateNum()!= Ref(DateNum(),-1),DateNum(),j);
}

AddColumn(Firstdate,"Firstdate",1.0);
AddColumn(FirstDate2,"Firstdate2",1.0);


If firstdate2>firstdate, it means there are days there are no trades 
between 9;30-9;35am.


i like to know how many trading days there are from the fristdate to 
current date.
 

So i wrote

Timefromset(indaily);
n=0;
n=barssince(datenum()==fristdate);

TimeFrameRestore ();

TimeFrameSet (in5Minute);


However, it doesn't work. if i replace the fristdate with the value 
of first date (eg 1051111), it will work. Although the value of 
firstdate is a number at each point(I can see it by AddColumn
(Firstdate,"Firstdate",1.0);) , the AFL treats firstdate as an array. 
I guess that's the reason why it doesn't work.


Lots of functions of AFL (like if, for, barssince...) don't accept 
arrays as parameters. It's really painful for me to write codes.

Any one can help? Thanks a lot.


william 








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Try Online Currency Trading with GFT. Free 50K Demo. Trade 
24 Hours. Commission-Free. 
http://us.click.yahoo.com/RvFikB/9M2KAA/U1CZAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

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 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/

<*> 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/