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

transforming Bob Fulks Clayburg stop



PureBytes Links

Trading Reference Links

Hello,

some days ago Bob provided the code of Clayburgs Adaptive stop (Activetrader
Feb02). I tried to do some modifications but failed miserably.
This code is based on a system but I want to change it to an indicator. What
I like would be just a plotting on the screen to compare the indicator with
the parabolic by eyeballing.

any code transformation is appreciate
thanks Jim


ps Bob, I hope you don't mind that I posted your code

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

   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;