{ NHNL_V.TAS revised 3/9/91 by H.K.Barnett * NOTE: For this script to give accurate results, the 'QUOTES PER SYMBOL" setting in the CONFIG screen *MUST* be set to 260 ! * This script example shows the 52-week high and low for each ticker, and the current day's data. If the current day's high is equal to the 52-week high, or the current low is equal to the lowest low, then we have a probable new high or new low. It might also be the case that today's high or low is just equal to the previous high or low. In either case, the NEW HIGH or NEW LOW is 'flagged' for your attention. Just to make the script slightly more interesting, we will also compute the "percentage off from high", a frequently used metric seen in financial tables. In addition, the current day's volume is compared with the 52-week average volume, and the percentage difference is displayed. A 'V+' or 'V-' flag is shown if the volume difference exceeds the preset percentage which you can assign to the variable 'vol_flag'. } #OUTPUT_FILE 'LPT1' { send results to the printer } if first_ticker then begin write(' -- 52 WEEK -- ------- CURRENT ----- '); writeln(' %OFF CURR %AVG'); write('TICKER HIGH LOW HIGH LOW CLOSE'); writeln(' HI $ VOL(h) VOL FLAGS'); write('-------------------------------------------------------'); writeln('---------------------------------'); end; vol_flag := 30; { % variation required to show volume flag } high_value := HHV(h,52*5); { compute high over 52 weeks } low_value := LLV(L,52*5); { compute low over 52 weeks } ttl_vol := CUM(v); { total volume for the year } avg_vol := ttl_vol/QUOTE_COUNT; { compute average volume } off_avg_vol := INT(((V[0] / avg_vol)-1) * 100); { compute diff in vol.} off_high_value := INT(((C[0] / high_value) -1) *100); write(TICKER,' ',high_value,' ',low_value,' ',H[0],' ',L[0],' ',C[0], ' ',off_high_value,'% ',INT(V[0]),' ',off_avg_vol,'% '); if off_avg_vol >= vol_flag then write(' V+ '); if off_avg_vol <= -vol_flag then write(' V- '); if high_value <= h then { today's high is new high } write(' New HI '); if low_value >= l then { today's low is new low } write(' New LO '); writeln(); { end the line with a 'newline'}