my condition is simple - buy on today's close, exit tomorrow if price goes above say 0.5% above yesterday's close or exit even if the price doesn't reach that price level, no holding beyond tomorrow
my problem is how to exit even if the price doesn't hit the target price, may be at a loss
And I suggest: don't look at tomorrow as "tomorrow", as in the future.
Instead refer to exit as Bars Since entry, this will be in the present.
So it would sound better, if you entered yesterday based on some condition(s) and exited today based on some condition(s).