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

Re: Is my Clayburg adaptive stop Interpretation Correct?



PureBytes Links

Trading Reference Links

As I read it, it is a bit more complicated than that (but I may be
interpreting it incorrectly as the description is not precise). See
notes below with my code.

Bob Fulks

----

>I am not sure whether I've interpreted ClayBurgs Adaptive stop.  Here
>is what he wrote in the Active Trader Feb 2002 issue, page 76:
>
>"Our next stop routine makes use of the average range of recent bars to
>set trailing stops.  This calculation is performed by subtracting a
>multiple of the average range of the last several bars from the low of
>the bar on which a long position was established.

"the bar on which a long position was established" could mean the bar
on which the order was established or the bar of entry, which are
different bars if you entered on a market, stop, or limit order - not
totally clear. If you set the stop at the bar of entry for the next
bar, there is no stop on the bar of entry, which probably is not
correct.

>   For reference, we will use the average range of the last 21 bars
>multiplied by 3 as a stop level.  Therefore, the value subtracted from
>the initial low will be 3 times the average range of the last 21 bars.
>The resulting value is the initial stop to be used for the new long
>position.

This says "range" and your code used TrueRange. Either will work
(differently) but I kept it at "range".

>  On each successive bar the calculations are repeated, using the new
>value for the 21 -bar average range.  If the market has not made a new
>higher low since the last bar, the new value is subtracted from the old
>highest  low.  If, on the other hand, a new higher low was established
>on the previous bar, three times the 21-bar average range is
>subtracted from the new higher low. "
>
>So, here is my EL code.  I just don't know whether I've interpreted the
>above correctly.

Your code has no stop on the bar of entry if you entered on a stop. I
added a stop for the bar of entry referencing the low of the bar
prior to the bar of entry. I reset the stop to the low of the bar of
entry and then reset it only on higher lows, as he described. My code
is listed below. I also made the two values inputs so that they can be
easily modified.

{ *******************************************************************

   Signal        : Clayburg Adaptive Stop
  
   Last Edit     : 1/8/2002

   Provided By   : Bob Fulks

   Description   : This is the stop described in Active Trader,
      February 2002, page 76. Based upon code suggested by
      Ernie Bonugi.

   Inputs:
      Mult     - Multiple of average range - default = 3
  
      Length   - The length for averaging range.
     
********************************************************************}

Input: Mult(3), Length(21);

Vars: xLow(Low), xHigh(High), AR(0), MP(0);

AR = Average(Range, Length);
MP = MarketPosition;

{Set stops for bar of entry}
if MP <> +1 then begin
   xLow = Low;
   ExitLong next bar at xLow - Mult * AR stop;
end;
if MP <> -1 then begin
   xHigh = High;
   ExitShort next bar at xHigh + Mult * AR stop;
end;

{Set stops for other bars}
if MP = +1 then begin
   if MP[1] <> +1 then xLow = Low;     {Reset on bar of entry}
   xLow = iff(Low > xLow, Low, xLow);
   ExitLong next bar at xLow - AR * Mult stop;
end;
if MP = -1 then begin
   if MP[1] <> -1 then xHigh = High;   {Reset on bar of entry}
   xHigh = iff(High < xHigh, High, xHigh);
   ExitShort next bar at xHigh + AR * Mult stop;
end;