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

[amibroker] How to code BarsSince(Bought)



PureBytes Links

Trading Reference Links

Can anyone tell me a way to code BarsSince(Bought) in afl?  (Or script
if needed). 


I'm wanting to do some backtests on scenarios like:

If Stock has been owned < 15 days have one exit strategy..
If Stock has been owned > 15 days and < 30 days do another strategy ..
... and so on


I'd been under the mistaken impression that the number of bars a stock
has been "owned" was the same thing as BarsSince(Buy), but of course
its not since their may be a buy signal that the backtester skips
because we're already fully invested. So the first buy signal is not
necesarily the bar on which the backtester enters a position.

I've done a search here and the other board, but haven't found
anything that appears to do what I'm looking for, but of course if
I've missed a previous answer to this question please could someone
point me to it!

Thank you.

Jeff


------------------------------------

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/