Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
BBwithFractdev
//+------------------------------------------------------------------+
//| BBwithFractdev.mq4 |
//| Êèì Èãîðü Â. aka KimIV |
//| http://www.kimiv.ru |
//| |
//| Ïîëîñû Áîëëèíäæåðà ñ äðîáíûì êîýôôèöèåíòîì îòêëîíåíèÿ |
//+------------------------------------------------------------------+
#property copyright "Êèì Èãîðü Â. aka KimIV"
#property link "http://www.kimiv.ru"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Green
#property indicator_color2 Blue
#property indicator_color3 Green
//---- input parameters
extern int BB_Period = 13; // Ïåðèîä ñðåäíåé è îòêëîíåíèÿ
extern double Deviation = 2.618; // Êîýôôèöèåíò îòêëîíåíèÿ
//---- indicator buffers
double buf1[];
double buf2[];
double buf3[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
void init() {
SetIndexStyle(0, DRAW_LINE);
SetIndexStyle(1, DRAW_LINE);
SetIndexStyle(2, DRAW_LINE);
IndicatorDigits(MarketInfo(Symbol(), MODE_DIGITS));
SetIndexBuffer(0, buf1);
SetIndexBuffer(1, buf2);
SetIndexBuffer(2, buf3);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
void start() {
int i, j;
double ave, sko, sum;
if (Bars<=BB_Period) return;
for (i=Bars-BB_Period; i>=0; i--) {
buf2[i] = iMA(NULL,0,BB_Period,0,MODE_SMA,PRICE_CLOSE,i);
sum = 0;
for (j=0; j<BB_Period; j++) sum+=Close[i+j];
ave = sum / BB_Period;
sum = 0;
for (j=0; j<BB_Period; j++) sum+=(Close[i+j]-ave)*(Close[i+j]-ave);
sko = MathSqrt(sum / BB_Period);
buf1[i] = buf2[i]+(Deviation*sko);
buf3[i] = buf2[i]-(Deviation*sko);
}
}
//+------------------------------------------------------------------+
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
---