[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to code a time based trailing stop?



PureBytes Links

Trading Reference Links

> I was trying to code a time based trailing stop and 
> need some help. for example after initial a long
> position i place a 10 tick stop immidiately and then i
> want to move the stop 1 tick up every say, 1 minutes.
> is there an easy way to do this in EL? 

Record the time when you set your initial 10tick stop.

(place initial 10tick stop)
InitTime = Time;

Then on later bars:

MinsInTrade = TimeToMinutes(Time) - TimeToMinutes(InitTime);
StopTicks = 10 - MinsInTrade;
(use StopTicks to set your stop price)

Gary