home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1993 #2 / Image.iso / finance / tas515dm.zip / TAS514.EXE / lha / MA2.TAS < prev    next >
Text File  |  1993-03-31  |  1KB  |  56 lines

  1. #Output_File ma2.lst
  2. DumpPoints : String;
  3. GraphRequest : String;
  4. ShortMA : Array;
  5. LongMA  : Array;
  6.  
  7. {  
  8.    This prologue section asks for the short and long moving average
  9.    periods. It also asks if you want to display all data points
  10.    and whether you want to graph the results
  11. }
  12. Prolog Begin
  13.    DumpPoints = 'Y';
  14.    GraphRequest = 'Y';
  15.    Points = 100;
  16.    If Not Defined(SPeriod) Then
  17.    Begin
  18.       SPeriod =5;
  19.       LPeriod =10;
  20.       Ask('Enter the shorter moving average period', SPeriod,
  21.           'Enter the longer moving average period ', LPeriod,
  22.           'Do you want to display each day?',DumpPoints,
  23.           'Do you want to graph each security?',GraphRequest,
  24.           'Data points to load for each?      ',Points);
  25.    End;
  26.    MaxQuotes(Points);
  27. End;
  28.  
  29. ShortMA = Mov(C,SPeriod,'E');
  30. LongMA  = Mov(C,LPeriod,'E');
  31. If DumpPoints = 'Y' then
  32. Begin
  33.    Heading = 'Date        Open    High    Low   Close    ' 
  34.              + 'Mavg1   Mavg2 Mavg1/Mavg2';
  35.    WriteLn(Heading);
  36.    For Each Point Starting at 1 Begin
  37.       Writeln(DateStr(Dates[0]),
  38.             Open,
  39.             High,
  40.             Low,
  41.             Close,
  42.             ShortMA,
  43.             LongMA,
  44.             ShortMA/LongMA);
  45.    End;
  46. End;
  47.  
  48. If GraphRequest = 'Y' Then
  49. Begin
  50.    OpenGraph(1);
  51.    Graph(1,
  52.       ShortMA,Expand('%d bar EMA',SPeriod),
  53.       LongMA,Expand('%d bar EMA',LPeriod));
  54.    CloseGraph();
  55. End;
  56.