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

Reply via email to