home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / EXAMPLES.ZIP / OVERMA.TAS < prev    next >
Text File  |  1992-08-29  |  1KB  |  38 lines

  1. { OVERMA.TAS 
  2.   This TAS script computes and graphs the percentage number of stocks 
  3.   over their N day simple moving average.
  4.   You can set the number of days in the moving average by specifying
  5.       @Period=xx      
  6.   on the command line, where 'xx' is the number of periods. 
  7.   The default is 30.
  8.   Author : Martin Moore, 8/29/92
  9.   Based on a request by M. Schotter
  10.   
  11. }
  12. #max_quotes 200
  13. NA : array;             { Number Over moving average array }
  14. PR : array;             { Price total array }
  15. MA : array;
  16.  
  17. If Period = 0 Then
  18.    Period = 30;
  19. TickCount = TickCount + 1;
  20.  
  21. MA = Mov(C,Period,'S');
  22.  
  23. For I = Period; I <= Quote_Count ; I = I + 1;
  24. Begin
  25.    If C[I] > MA[I] then    { If Close Greater Than Moving Average }
  26.       NA[I] = NA[I] + 1;   { ...Add one to Number Abover Moving Average}
  27.    PR[I] = PR[i] + C[I];   { Bump Price Array }
  28. End
  29.  
  30. If Last_Ticker then 
  31. Begin
  32.    NA = MulBy(DivBy(NA,TickCount),100.0);
  33.    OpenGraph(2);
  34.    Graph(NA, 'Percent above '+Format(period,'%3.0f')+' Day Moving Average');
  35.    Graph(PR, 'Overal Price Price');
  36.    CloseGraph();
  37. End;
  38.