Hello, You just need to write a loop as in the example here: http://www.amibroker.com/kb/2007/03/24/how-to-plot-a-trailing-stop-in-the-price-chart/
Best regards, Tomasz Janeczko amibroker.com ----- Original Message ----- From: "jeffarcherjr" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Friday, April 04, 2008 1:02 AM Subject: [amibroker] How to code BarsSince(Bought) > 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 > > >
