Hi Roy,
 
i am not sure if i understood you correctly.
 
Don't you mean:  bars = barssince(buy); 
 
Maybe it is that simple :-)
 
Best regards
 
Thomas
 
 


From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Roy Ewing
Sent: Tuesday, July 18, 2006 12:27 PM
To: [email protected]
Subject: [amibroker] How to COUNT BARS since trade buy in EXPLORATION?

I must be overlooking something, but am having trouble with counting
the number of bars since a trade was opened.

Example:

I would like to run exploration and have one of the columns simply
have a number telling me how many bars (trading days) I have held the
stock. I don't need to go back a long way, my "system" is based
shorter term swing-trading, 7-15 days.

I have manually built in arrays for each stock purchased, as in
BDATE[1-20] = DATENUM (20 stocks, with buy date cvtd to valid DATENUM).
BBOOK[1-20] = Purchase price of those 20 stocks
BSYMB1-20 = The text of the SYM. Still can't use strings in
arrays, so have to do it the long way.

Hurdle one is getting how many bars has it been between today (I use
"DATENUM()" to get last bar datenum) , and the "BDATE[n]"?

I can do this:
BDATE[13] = Date_To_Num("13072006") ; BSYMB13 = "XYZ" ; BBOOK[13] =
30.78 ;
Diff = DateNum() - BDATE[13];

That gives me the total (calendar) days, but NOT the # of bars. I
have to manually subtract out weekends, trading holidays, etc.
("Date_To_Num" is a function call. It is in the AFL library)

I have tried:

BS = BARSSINCE(DateNum() = BDATE[13]);

But that only produces a syntax error at the "=" sign.

I don't know enough coding yet to do it, but a function call would be
nice where the "buy" date is sent to it and the # of bars "in trade"
is returned.

Is there something simple I am overlooking?

Thanks.

Roy

__._,_.___

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




__,_._,___

Reply via email to