home *** CD-ROM | disk | FTP | other *** search
- { BBAND.TAS - This script computes BOLLINGER BANDS.
- Bollinger bands are lines which are 'n' standard deviations away
- from a 'p' day moving average of the close.
- To change the value of 'n', change 'bband_devs' below. To
- change the value of 'p', change 'bband_period' below.
- }
- #output_file 'bband.lst' n
- #max_quotes 200
- GRAPH_SWITCH = 1; {<--------- SET THIS TO 1 TO SEE GRAPHS}
- bband_period = 20; { number of days in BBAND period }
- bband_devs = 2; { number of STD DEVIATIONS about close}
- bband_top : array; { top band }
- bband_bot : array; { bottom band }
- {
- Top Bollinger Band
- }
- bband_top = bbandt(20,2);
- {
- Bottom Bollinger Band
- }
- bband_bot = bbandb(20,2);
-
- { Now, the rest is up to you. I have suppied a simple check to see
- if the current close is over the top band or below the bottom band.
- You can use these BBAND arrays to check for the narrowing of the
- bands, tops or bottoms outside the bands, and bouncing off the
- bands.
- }
-
- if over(c,bband_top) >= 0 then
- begin
- gosub dograph;
- writeln(ticker,' BBAND upward breakout occurred');
- end;
- if over(bband_bot,c) >= 0 then
- begin
- gosub dograph;
- writeln(ticker,' BBAND downward breakout occurred');
- end;
- return;
- :dograph
- if graph_switch = 0 then return;
- opengraph(3,0,0);
- sizegraph(2,1,1); { size the graphs 50%, 25%, 25%}
- graph(bband_top,bband_bot,1);
- graph(macd(),'Macd',macdtrigger(),'Trigger');
- graph(cci(14),'CCI 14');
- closegraph();
- return;
-