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
------------------------ Yahoo! Groups Sponsor --------------------~-->
Yahoo! Groups gets a make over. See the new email design.
http://us.click.yahoo.com/XISQkA/lOaOAA/yQLSAA/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:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/