home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / t / tas501.zip / BBAND.TAS next >
Text File  |  1993-03-02  |  2KB  |  68 lines

  1. #TITLE Compute and graph Bollinger Bands..gives basic Buy/Sell signal 
  2. { BBAND.TAS - This script computes BOLLINGER BANDS.
  3.   Bollinger bands are lines which are 'n' standard deviations away
  4.   from a 'p' day moving average of the close.
  5.   To change the value of 'n', change 'bband_devs' below. To
  6.   change the value of 'p', change 'bband_period' below.
  7.   NOTE- This script will use the optional GRAPH feature of TAS.
  8.   If it is not registered to run GRAPH's then it will terminate
  9.   on the SECOND graph.
  10.   If you wish to continue viewing graphs, see the REGISTER.DOC
  11.   file included with the TAS system. That file contains the
  12.   pricing and ordering information for the GRAPH feature.
  13. }
  14. #output_file 'bband.lst' n
  15. #max_quotes 200 
  16. prolog begin
  17.     printing : string;
  18.     graphing : string;
  19.     printing = 'N';
  20.     graphing = 'Y';
  21.     ask('Printing? (Y/N) ',printing,'Graphing? (Y/N)', graphing);
  22.     if printing = 'Y' then printing = 'y';
  23.     if graphing = 'Y' then graphing = 'y';
  24. end;
  25. if graphing = 'y' then
  26.     GRAPH_SWITCH = 1; {<--------- SET THIS TO 1 TO SEE GRAPHS}
  27. bband_period = 20;              { number of days in BBAND period }
  28. bband_devs   = 2;               { number of STD DEVIATIONS about close}
  29. bband_top : array;              { top band }
  30. bband_bot : array;              { bottom band }
  31. {
  32.   Top Bollinger Band
  33. }
  34. bband_top = bbandt(20,2);
  35. {
  36.   Bottom Bollinger Band
  37. }
  38. bband_bot = bbandb(20,2);
  39. { Now, the rest is up to you. I have suppied a simple check to see
  40.   if the current close is over the top band or below the bottom band.
  41.   You can use these BBAND arrays to check for the narrowing of the
  42.   bands, tops or bottoms outside the bands, and bouncing off the
  43.   bands.
  44. }
  45. if over(c,bband_top) <= 0 then
  46. begin
  47.   gosub dograph;
  48.   writeln(ticker,' BBAND upward breakout occurred');
  49. end;
  50. if over(bband_bot,c) <= 0 then
  51. begin
  52.   gosub dograph;
  53.   writeln(ticker,' BBAND downward breakout occurred');
  54. end;
  55. return;
  56. :dograph
  57. if graph_switch = 0 then return;
  58. opengraph(3,0,0);
  59. sizegraph(2,1,1);       { size the graphs 50%, 25%, 25%}
  60. graph(bband_top,bband_bot,1);
  61. graph(macd(),'Macd',macdtrigger(),'Trigger');
  62. graph(adx(14),'ADX 14',PDI(14),'PDI 14',MDI(14),'MDI 14');
  63. if printing = 'y' then
  64.     printgraph();
  65. else
  66.     closegraph();
  67. return;
  68.