Bob,
I'm confused. How can you exit the loop early when you are looking for a max high across all time. Just because it hit all all time high 100 days ago doesn't mean it hasn't made three more since then.
BTW: There is a bug in my previous scan. MaxHi and MinLo should be floats not Integers which will yield some incorrect results...
Here's correct version. Now you could use the built in max function to determine the value then exit the loop once that condition had been satisfied.
Sean
// Hi Lo by Sean Smith exchange = nyse, amex, nasdaq; output = "hilo.lst";
// input="vol250.lst"; // ProcessMS = "f:\invest\metadata\hilo\",VMS;
daystoload = 2200; daysrequired =1;
Integer numdays,i,minDate, maxDate; float maxHi, minLo;
numdays:=((DaysLoaded-1)*-1); minLo := 99999999.0; maxHi := 0.0; maxDate := 0; minDate := 0;
for i=numdays to 0 step 1 do if close(i) >= maxHi then maxHi := close(i); maxDate := i;endif;
if close(i) <= minLo then minLo := close(i); minDate := i; endif;
next i;
Print Symbol:-5,",","cl:0",",",close(0):6:2,",","Max",",",close(maxDate),",MaxDate,",Date(maxDate); PrintLn "Min",",",close(MinDate),",MinDate,",Date(MinDate); |