And here's the new short-sell version with the new loop. The scans have picked up speed.
//Shark-32, Short-Sell Version, by Walter T. Downs, //translated for QP2
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;
if shark=1 then if sharklow>0 then for j = i to 0 step 1 do if close(j)<sharklow then if close(j-1)>sharklow then println symbol,",", "Close: ", close(0):6:2,", ", "Change: ", Close(0)-Close(-1):5:2, ", ", "Date: ", date(j),", ", "Sharklow: ", sharklow; //date of buy signal j:=0; endif; endif; next j; endif; endif;
else shark:=0; endif; else fin:=0; endif; next i; |