Bollinger Band Width

Author: Copyright � 2006, Akuma99.
Bollinger Band Width
Indicators Used
Bollinger bands indicator
Miscellaneous
Implements a curve of type %1
0 Views
0 Downloads
0 Favorites
Bollinger Band Width
//+------------------------------------------------------------------+
//|                                                      BB_Diff.mq4 |
//|                                       Copyright © 2006, Akuma99. |
//|                                    http://www.beginnertrader.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Akuma99."
#property link      "http://www.beginnertrader.com"

#property indicator_separate_window
#property indicator_color1 Red

extern double bbPeriod=20;
extern double bbDev=2.0;
extern string displayText="Bollinger Band Difference:";

double bbw[];

int init() {

   SetIndexStyle(0,DRAW_LINE,EMPTY,1,Red);
   SetIndexBuffer(0,bbw);
   
   return(0);

}

int start() {

   int    counted_bars=IndicatorCounted();
   
   double upperBand,lowerBand,bandDifference;

   int   limit = Bars-counted_bars;
   int   i;
   
   for (i=limit; i>=0; i--) {
   
      upperBand = iBands(NULL,0,bbPeriod,bbDev,0,PRICE_CLOSE,MODE_UPPER,i);
      lowerBand = iBands(NULL,0,bbPeriod,bbDev,0,PRICE_CLOSE,MODE_LOWER,i);
      
      bandDifference = upperBand-lowerBand;
   
      bbw[i] = bandDifference;
      
   }
   
   Comment("\n",displayText," ", bandDifference, " (", bandDifference/Point," Pips)");
   
   return(0);

}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---