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

RT_Re: [RT] Titanic Syndrome



PureBytes Links

Trading Reference Links

Hello  Doyle,



Input: Ad2x(2), ad4x(5), adfx(1.75), adv9x(9), tenpct(0.09),
          lookbk(252), ai(Close of data2), di(Close of data3),
          nnh(Close of data4), nnl(Close of data5), av(Volume of data2),
          dv(Volume of data3);

Vars: Sum1(0), adr(0), djnh(0), djhevent(0), tendrop(0), djnhstop(h), 
         djnhprc(h), djnhx(0), position(0), hhv(h), b1(0), b2(0),b3(0),
         b4(0), b5(0), s1(0), s2(0), s3(0), s4(0), s5(0);

b1=0;
b2=0;
b3=0;
b4=0;
b5=0;
hhv=highest(high,lookbk);
position=position[1];
tendrop=tendrop[1];

If Close < hhv - (tenpct*hhv) then tendrop = 1;
djnh=0;

If High > hhv[1] then begin
        djnh=1; {dj 52 new high occurred today index}
        djnhprc=h;
        s2=0;
        s3=0;
        s4=0;
        s5=0;
end;
djnhstop= djnhstop[1];
if position=1 then djnhstop=djnhprc*1.02;
djnhx=djnhx[1];
if djnh=1 then djnhx=1; {dj 52wk new high occurred in past index}

{------------------------------Buy Conditions---------------------------------------------}

if tendrop=1 then begin
       b1=1;
{B2}
       if (ai >= ad2x * di) and  (ai[1] >= ad2x * di[1]) then begin
               if (ai >= ad4x * di) or (ai[1] >= ad4x*di[1]) then b2=1;
       end; {if ai>thou}
{B3}
{B4}
       sum1=0;
              for value0 = 0 to 3 begin
                    if ai[value0] > adfx*di[value0] then sum1=sum1+1;
              end; {for loop}
        if sum1 >=3 then b4=1;
{B5}
        if av >=adv9x*dv then begin
                if (dv[1] < adv9x * av[1]) and (dv[2] < adv9x[2] * av[2]) then b5=1;
                end;
end; {tendrop=1 if}

{---------------------------------Sell Conditions------------------------------------------}

if djnhx=1 then begin
s1=1;
{S2}
        {testing for nnl > nnh 7 days after DJ new 52week high}
              djhevent = 0;
              for value0 = 0 to 7 begin
                   if djnh[value0] >0 then djhevent=1;
              end; {for loop}
                      if djhevent = 1 then begin
                              for value0 = 0 to 7 begin
                                   if nnl[value0] > nnh[value0] then s2=1;
                              end;  {for loop}
              end; {if djevent}
          {testing for nnl > nnh 7 days before DJ new 52week high}
                       if djnh > 0 then begin
                                  for value0 = 0 to 7 begin
                                        if nnl[value0] > nnh[value0] then s2=1;
                       end; {for loop}
           end; {djnh = 1 if}
 
{if s1=1 and s2=1 then begin}
{S3}
      if (di >=ad2x*ai) and (di[1] > ad2x*ai[1]) then begin
if (di>=ad4x*ai) or (di[1] >= ad4x*ai[1]) then s3=1;
end; {if di>2*ai for 2 days}

{S4}
sum1=0;
for value0=0 to 3 begin
if di[value0] > adfx*ai[value0] then sum1= sum1 + 1;
end; {for loop}

if sum1 >= 3 then s4=1;
{S5}
If dv > adv9x*av then s5=1;
end; {if djnhx=1 if 0}

{----------Buy Signals----------}

If b1 +b2 =2 then begin
position=1;
buy("b1&b2") on close;
end;
if b1 + b3 =2 then begin
position=1;
buy("b1&b3") on close;
end;
if b1 + b4 = 2 then begin
position=1;
buy("b1&b4") on close;
end;
if b1 + b5 = 2 then begin
position=1;
buy("b1&b5") on close;
end;
if h >= djnhstop then begin
position=1;
buy("2%stop") on close;
end;
if b2+b3+b4+b5 >0 then tendrop=0; {resets tendrop for next buy cycle}

{ -----------Sell Signals--------------}

if s1+s2+s3=3 then begin
position= -1;
djnhx=0;
s1=0;
s2=0;
s3=0;
s4=0;
s5=0;
Sell("s1&s2&s3") on close;
end;
if s1+s2+s4=3 then begin
position=-1;
djnhx=0;
s1=0;
s2=0;
s3=0;
s4=0;
s5=0;
sell("s1&s2&s4") on close;
end;
if s1+s2+s5 = 3 then begin
position=-1;
djnhx=0;
s1=0;
s2=0;
s3=0;
s4=0;
s5=0;
sell("s1&s2&s5") on close;
end;


{This code was written by Dennis Meyers, PH.D. and appeared in the May 1995 issue of 
  Stocks and Commodities Magazine}


--
Best regards,
  Mark Brown                        mailto:markbrown@xxxxxxxxxxxxx