ApplyStop() - ValidFrom parameter usage

I'm new AB 6.2 and I would like to experiment with Applystop's Validfrom parameter.
As I understand it, it is expecting a number, which in effect is the number of bars since the Buy signal.
I would like to try having the Stop become effective after a condition is met. For example let's say when Cross(StochasticD, StochasticK). So in this case I would need the number of bars between the Buy and the Cross. Or, bar number of Cross minus bar number of Buy.
I've been trying some ways of using BarsSince but the results are an array not a number.
So I suppose the real question may be how to get the bar number at an event.

Can anyone supply a suggestion or pointer to what I should be reading.
TIA,
mark