Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Percent Bollinger Bands_v1
/*-----------------------------+
| |
| Shared by www.Aptrafx.com |
| |
+------------------------------*/
//+------------------------------------------------------------------+
//| Percent Bollinger Bands.mq4 |
//| Êèì Èãîðü Â. aka KimIV |
//| http://www.kimiv.ru |
//+------------------------------------------------------------------+
#property copyright "Êèì Èãîðü Â. aka KimIV"
#property link "http://www.kimiv.ru"
#property indicator_separate_window
//---- input parameters
extern int MA_Period=20;
extern int Deviation=2;
//---- indicator buffers
double ExtMapBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
SetIndexStyle(0, DRAW_LINE);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
SetIndexBuffer(0, ExtMapBuffer);
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start() {
int i, counted_bars = IndicatorCounted();
double dn, up;
if(Bars<=MA_Period) return(0);
//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;
//----
i = Bars - MA_Period - 1;
if(counted_bars>=MA_Period) i = Bars - counted_bars - 1;
while(i>=0) {
dn = iBands(NULL,0,MA_Period,Deviation,0,PRICE_LOW,MODE_LOWER,i);
up = iBands(NULL,0,MA_Period,Deviation,0,PRICE_HIGH,MODE_UPPER,i);
ExtMapBuffer[i] = (Close[i] - dn) / (up - dn);
i--;
}
//----
return(0);
}
//+------------------------------------------------------------------+
Comments
Markdown Formatting Guide
# H1
## H2
### H3
**bold text**
*italicized text*
[title](https://www.example.com)

`code`
```
code block
```
> blockquote
- Item 1
- Item 2
1. First item
2. Second item
---