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

 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext  
To: Bob Jagow who wrote (6841)9/27/1998 10:04:00 AM
From: Sean W. Smith  Read Replies (1) of 11149
 
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);
Report TOU ViolationShare This Post
 Public ReplyPrvt ReplyMark as Last ReadFilePrevious 10Next 10PreviousNext