Here's the whole thing with the changes. The number of hits has dropped dramatically with the changes and that must be because the low has to remain within 15% of the 52-week high at the time. Market corrections would eliminate a lot of hits.
I'm curious to know why you made maup equal to maup + 2, instead of maup +1.
if movavg(i,10,Cl)> ma50 and ma50 > movavg(i-5,50,Cl) then maup:=maup + 2; //need 24 to pass
I suppose you wanted 24 weeks because you had two conditions (10-day MA > 50-day MA and 50-day MA rising weekly for the past 3 months), so it would meet one condition for 12 weeks and the other condition for 12 weeks. Am I right, or missing the point? In any case, you are an elegant coder, to be sure. I sit here and marvel at your changes. I even broke the scan down into separate little scans to help me see your reasoning.
Here's the whole scan, as it now stands:
output ="canslim.lst"; input="commplus.lst"; //issuetype=common; exchange nyse,nasdaq,amex; //set these in input
daystoload=320; //Guard for less days? integer i; float low15, ma50, maup, max260, pwh, vi;
max260:= Max(-1,-260,hi);
//10-day MA > 50-day MA and 50-day MA rising weekly for the past 3 months maup:=0; for i = 0 to -60 step -5 do ma50:=movavg(i,50,Cl); //use it twice if movavg(i,10,Cl)> ma50 and ma50 > movavg(i-5,50,Cl) then maup:=maup + 2; //need 24 to pass endif; next i;
//Low within 15% of 52 week high every day for 3 months //To match Mike A., test for close(0) >= .85*max(-1,-260,hi) 1st low15:= -999; //Guard for fail if close(0) >= .85*max(-1,-260,hi) then low15:=0; for i = 0 to -59 step -1 do if low(i)>=.85*max(i,i - 260,hi) then low15:=low15 + 1; //need 60 to pass endif; next i; endif;
pwh:= 100*(Close(0)- max260)/max260; // % within 52 week high
//Calculate percent of volume change compared to 50 average daily volume vi:= -999; //Guard for println if AvgVol(0,-50) !=0 then //Prevents division by 0 vi := 100*(Vol(0) - AvgVol(0,-50)) / AvgVol(0,-50); endif;
if close(0)>=10 and eps>0 and qrs(0)>=80 and avgvol(0,-29)>30000 and maup = 24 and low15 = 60 then println symbol, ", ","EPS: ",EPS:4:3, ", ","QRS ", QRS(0),", ", "Close: ",Close(0):6:3, ", ", "52 HIGH: ", Max(-1,-260,hi):5:3,", ", "PWH: ",pwh:3:0, ", ","VOL: ",vol(0):7:0, ", ", "AVG VOL: ",avgvol(0,-50 ):7:0, ", ","VOL PCT CHANGE: ",vi:4:0; endif; |