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

Re: Trailing Stop Indicator Dilemma



PureBytes Links

Trading Reference Links

Hi Barry,
Try this:

     If(cum(1)=1,
     {then} Close,
     {else} If((C*1.1) <= PREV,
              {then}(C*1.1),
              {else} PREV));

This will always use the value of the close on the first bar of the chart.

  Best wishes,
      Adam Hefner.
VonHef@xxxxxxxxxxxxx

---------------------------------------
----- Original Message -----
From: Barry Marx <bmarx@xxxxxxxxx>
To: <metastock@xxxxxxxxxxxxx>
Sent: Wednesday, May 05, 1999 12:26 AM
Subject: Trailing Stop Indicator Dilemma


> I am trying to write an indicator that displays a trailing stop as a fixed
> percentage of the closing price, but never goes lower, only higher (for
long
> positions).
>
> The following seems to do the job for long positions, giving a 10% fixed
> stop:
>
>              If((C*0.9) >= PREV, (C*0.9), PREV);
>
> Next, I tried to apply the same idea to short positions with:
>
>              If((C*1.1) <= PREV, (C*1.1), PREV);
>
> The intention was to plot a stop value that was 10% above the close, but
> never to be raised higher than the previous day's value.
>
> The second formula plots a line with a constant value of zero, presumably
> because the initial value of PREV is zero, and the value of C*1.1 is never
> less than that.  I've tried several alternate approaches, but seem to keep
> coming back to the same problem of needing to use PREV.
>
> I'm stuck, so any ideas would be appreciated.  Is this simply another
> limitation of the language?
>
> Thanks,
>   Barry
>
>
>
>
>