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

Re: trailing stop language help pls



PureBytes Links

Trading Reference Links

Do them in the reverse order to get them all to execute. Pseudo code:

if close < lowest_level then buytocover at lowest_exit stop else
   if close < next_lowest_level then buytocover at next_lowest_exit stop else
   etc....

-- 
  Dennis

ChasW wrote:
> 
> I am trying to step down to different std dev bands as stops.
> 
> N's are the outside top and bottom bands and the M's are the middle bands.
> 
> so in this case i short at the N+1 (top band)
> and as the price comes down to the middle upper band (M+1), i lower the stop
> to this N+1 band.
> as the price contiues down thru the next middle band  (M-1), i then lower
> the stop to the prvoius band (M+1)
> and so on...
> 
> my exit code look like this
> {Buy to cover}
>  If MP<= 0
>   then begin
>  If Close < Mplus1 then buy to cover ("SXN+1") next bar Nplus1 stop else
>  If Close < Mminus1 then buy to cover ("SXM+1") next bar Mplus1 stop else
>  If Close < Nminus1 then buy to cover ("SXM-1") next bar Mminus1 stop; end;
> 
> the problem is that the only stop that seems to be in force is the first
> one.(n+1), i can see that it stays 'true' so no reason to go past the 'else'
> any help would be appreciated
> 
> chasw