For the life of me, I don't know why this is eluding me...

I'm trying to add a variable into a time series (have quote data added via
quantmod).  I've added technical indicators, but now want a column that will
reflect the trailing stop value for that day, given a starting date and
trade value, and a given trailing stop.

Is there a more sensible way than using a FOR loop to march through the
rows, lagging to compare prior highs/lows to current stop value?  I don't
want the canned Parabolic SAR, but a custom user-specifiable trailing stop
(for example, 5% below the high since position entry for long, 5% above low
since short entry)

Google searches have come up dry, and this seemingly simple task has eluded
me.

	[[alternative HTML version deleted]]

