home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / t / tas501.zip / NHNL.TAS < prev    next >
Text File  |  1993-02-25  |  1KB  |  33 lines

  1. #TITLE Check for New Highs and New Lows                               
  2. #output_file 'nhnl.lst'
  3. { NHNL.TAS-
  4.    This script example will show the 52 week high and low for each
  5.    ticker. If the current day's high is equal to the highest high
  6.    or the current low is equal to the lowest low, then we have a
  7.    probable new high or new low. It might also be the case that today's
  8.    high or low is just equal to the previous high or low.
  9.  
  10.    Just to make the script slightly more interesting, we will also
  11.    compute the "percentage off from high", a frequently used metric
  12.    seen in financial tables.
  13. }
  14. if first_ticker then 
  15. begin
  16.    writeln('              - CURRENT -       - 52 WEEK -     OFF');
  17.    writeln('TICKER       HIGH      LOW     HIGH      LOW    HIGH');
  18. end;
  19. high_value := HHV(h,52*5);        { compute high over 52 weeks }
  20. low_value  := LLV(L,52*5);        { compute low over 52 weeks }
  21.  
  22. off_high_value := ((high_value - c[0]) / high_value) * 100;
  23. write(TICKER,' ',h[0],' ',l[0],' ',high_value,' ',low_value,
  24.       '\t',INT(off_high_value),'%');
  25.  
  26. if high_value <= h then       { today's high is new high  }
  27.     write(' New High ');
  28.  
  29. if low_value >= l then        { today's low is new low }
  30.     write(' New Low  ');
  31.  
  32. writeln();             { end the line with a 'newline'}
  33.