I would look for volume = zero (probably null is better) for a day (perhaps two days) as an indication it has been delisted. Just add another Sell criteria to look for this case and use last available price.
Since it is a backtest, and you would presumably know ahead of time of any delisitng for a stock you own, it is probably valid to look ahead a few days to see if the zero/null volume condition exists. --- In [email protected], "Paul" <onerestingn...@...> wrote: > > Have you found a solution? > > Regards, > > Paul > > > > --- In [email protected], "woodshedder_blogspot" > <woodshedder_blogspot@> wrote: > > > > When using delisted data, it is possible to buy a stock, and then never get > > an exit signal due to the stock not trading anymore and getting delisted. > > > > I have worked around this issue by manually going through 1000s of trades > > and filtering out the few delisted stocks that cause this problem using > > code like this: > > Filter = StrFind(Name(),"VMSI") == 0 AND StrFind(Name(),"CCSC") == 0; > > > > However, this workaround requires a lot of maintenance as different tests > > and different systems will cause different stocks to get caught long. > > > > Then, I tried this code: > > bi = BarIndex(); > > Sell=MA5>MA10 OR bi == LastValue( bi ); > > > > I'm still getting backtests where the system gets stuck long a delisted > > position. > > > > I'm sure there is a correct way to solve this problem, but I can't figure > > it out. > > > > Thanks for any help! > > Wood > > >
