I'll give you a little more flexibility by letting you alter the starting date so you can back test. You'll, of course, get a bunch of junk stocks, since it is scanning all listed stocks, so you may want to apply more filtering, or better yet, use your own list of quality stocks. ;)
Results are comma delimited. There is a chance that a stock will meet both up and down criteria. In that case, the stock will be printed twice with both up and down results.
_________________________________________________________________
Exchange = NYSE , AMEX , NASDAQ; //or preferably input your own list of symbols with - >>Input="your.lst";<<
Output="gainersandlosers.lst";
Integer S,L,P,X; Float HighA, LowA; //will be assigned the high and low price of the range
// Here are the variables you can change
S:=0; // Start Day, in this example current date 0 (must be 0 or negative) L:=5; // Days to go back from start day, in this example back 5 days (positive number going back) - include 6 days P:=10; //Percentage Points To Gain, in this example 10% up and down
//Here we'll find the high and low for the date range
HighA:=-1; LowA:=9999999;
for x=-S to -S+L do If high(0-x)>HighA then HighA:=high(0-x);endif; If low(0-x)<LowA then LowA:=low(0-x);endif; next x;
// Prints Symbol, Name, Date Range, and Percentage Return for the date range for stocks that meet your criteria
if close(S)/LowA >= 1+(P*.01) then println Symbol,",",Description,",",Date(S-L),",","TO",",",Date(S),",", "UP",",",((close(S)/LowA)-1)*100,",","Percent"; endif;
if close(S)/HighA <= 1-(P*.01) then println Symbol,",",Description,",",Date(S-L),",","TO",",",Date(S),",", "DOWN",",",((close(S)/HighA)-1)*100,",","Percent"; endif;
Buddy nuttybuddy.net |