SI
SI
discoversearch

We've detected that you're using an ad content blocking browser plug-in or feature. Ads provide a critical source of revenue to the continued operation of Silicon Investor.  We ask that you disable ad blocking while on Silicon Investor in the best interests of our community.  If you are not using an ad blocker but are still receiving this message, make sure your browser's tracking protection is set to the 'standard' level.
Strategies & Market Trends : TA-Quotes Plus -- Ignore unavailable to you. Want to Upgrade?


To: Mike Hagerty who wrote (6705)9/20/1998 10:08:00 PM
From: TechTrader42  Respond to of 11149
 
I'm still chewing on the symmetry and wb variables.

Speaking of the "WB" variable, we can shorten it to:

WB:=range(i-2)

because high(i-2)-low(i-2) is the same as range(i-2).

So the scan is:

output = "sharka.lst";
//input="volvol.lst";
//ProcessMS = "d:\meta\macdup\",VMS;

integer i, j;
float shark, apex, WB, fin, sharkhigh, symmetry;

for i = -24 to 0 step 1 do

symmetry:=.28;
apex:=(high(i)+low(i))/2;
WB:=range(i-2);

if apex<=(high(i-2)-(WB*Symmetry)) and
apex>=(low(i-2)+(WB*Symmetry)) then
fin:=1;
sharkhigh:=0;
if high(i)<high(i-1) and
low(i)>low(i-1) and
high(i-1)<high(i-2) and
low(i-1)>low(i-2) then
shark:=fin;
if shark=1 then
sharkhigh:=high(-2+i);
endif;

for j = 24 to 0 step -1 do

if i+j <=0 then
if close(i+j)>sharkhigh and
close((i+j)-1)<sharkhigh and
sharkhigh>0 and
shark =1 then
println symbol,",", "Close: ", close(0):6:2,", ", "Change: ",
Close(0)-Close(-1):5:2, ", ", "Date: ", date(i+j),", ", "Sharkhigh: ",
sharkhigh; //date of buy signal
endif;
endif;
next j;

else
shark:=0;
endif;
else
fin:=0;
endif;

next i;



To: Mike Hagerty who wrote (6705)9/20/1998 10:33:00 PM
From: TechTrader42  Read Replies (2) | Respond to of 11149
 
Adding some ifs speeds the scans up, too:

Longs:

//Shark-32, by Walter T. Downs,
//translated for QP2 by Brooke
output = "sharklong.lst";
input="volvol.lst";
//ProcessMS = "d:\meta\macdup\",VMS;

integer i, j;
float shark, apex, WB, fin, sharkhigh, symmetry;

for i = -24 to 0 step 1 do

symmetry:=.28;
apex:=(high(i)+low(i))/2;
WB:=range(i-2);

if apex<=(high(i-2)-(WB*Symmetry)) and
apex>=(low(i-2)+(WB*Symmetry)) then
fin:=1;
sharkhigh:=0;
if high(i)<high(i-1)and
low(i)>low(i-1) and
high(i-1)<high(i-2) and
low(i-1)>low(i-2) then
shark:=fin;
if shark=1 then
sharkhigh:=high(-2+i);
endif;

for j = 24 to 0 step -1 do

if shark=1 then
if sharkhigh>0 then
if i+j <=0 then
if close(i+j)>sharkhigh then
if close((i+j)-1)<sharkhigh then
println symbol,",", "Close: ", close(0):6:2,", ", "Change: ",
Close(0)-Close(-1):5:2, ", ", "Date: ", date(i+j),", ", "Sharkhigh: ",
sharkhigh; //date of buy signal
endif; endif; endif; endif; endif;
next j;

else
shark:=0;
endif;
else
fin:=0;
endif;

next i;

********************

Shorts:

//Shark-32, Short-Sell Version by Walter T. Downs,
//translated for QP2 by Brooke


output = "sharkshort.lst";
//input="volvol.lst";
//ProcessMS = "d:\meta\macdup\",VMS;

integer i, j;
float shark, apex, WB, fin, sharkhigh, sharklow, symmetry;

for i = -24 to 0 step 1 do

symmetry:=.28;
apex:=(high(i)+low(i))/2;
WB:=range(i-2);

if apex<=(high(i-2)-(WB*Symmetry)) and
apex>=(low(i-2)+(WB*Symmetry)) then
fin:=1;
sharkhigh:=0;
sharklow:=0;
if high(i)<high(i-1) and
low(i)>low(i-1) and
high(i-1)<high(i-2) and
low(i-1)>low(i-2) then
shark:=fin;
if shark=1 then
sharkhigh:=high(-2+i);
sharklow:=low(-2+i);
endif;

for j = 24 to 0 step -1 do

if shark=1 then
if sharklow>0 then
if i+j <=0 then
if close(i+j)<sharklow then
if close((i+j)-1)>sharklow then
println symbol,",", "Close: ", close(0):6:2,", ", "Change: ",
Close(0)-Close(-1):5:2, ", ", "Date: ", date(i+j),", ", "Sharklow: ",
sharklow; //date of buy signal
endif; endif; endif; endif; endif;
next j;

else
shark:=0;
endif;
else
fin:=0;
endif;

next i;