Indicators Used
Miscellaneous
1
Views
0
Downloads
1
Favorites
BB_channels_mikko_sw
//+------------------------------------------------------------------+
//| BB Channel indicator sw |
//| (C) Mikkom |
//| |
//+------------------------------------------------------------------+
#property copyright "Mikko"
#property link "noneOfYOurBusiness"
#property indicator_separate_window
//#property indicator_chart_window
#property indicator_buffers 7
#property indicator_color1 DarkGreen
#property indicator_color2 ForestGreen
#property indicator_color3 C'255,83,17' //OrangeRed
#property indicator_color4 Red
#property indicator_color5 Aqua
#property indicator_color6 DodgerBlue
#property indicator_color7 Yellow
#property indicator_width1 3
#property indicator_width2 2
#property indicator_width3 2
#property indicator_width4 3
#property indicator_style5 2
#property indicator_style6 4
double highup[];
double lowup[];
double highdown[];
double lowdown[];
double highmiddle[];
double lowmiddle[];
double priceBuffer[];
// Hourly settings
extern int begin = 20; //24
extern int end = 200; //720
extern int step = 5; //12
extern int deviation = 2;
extern int MaxBarsToCount = 1200;
int init() {
IndicatorBuffers(7);
SetIndexBuffer(0, highup);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(1, lowup);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(2, highdown);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(3, lowdown);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(4, highmiddle);
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(5, lowmiddle);
SetIndexStyle(5,DRAW_LINE);
SetIndexBuffer(6, priceBuffer);
SetIndexStyle(7,DRAW_LINE);
IndicatorShortName(" BBchannelsMikko "+begin+"-"+end+"("+step+")");
// SetIndexDrawBegin(0, 0);
return(0);
}
int deinit() {
return(0);
}
int start() {
int counted_bars=IndicatorCounted();
if(counted_bars < 0)
return(-1);
if(counted_bars > 0)
counted_bars--;
int limit = Bars - counted_bars;
limit= MathMin(limit,MaxBarsToCount);
for(int i = limit; i >= 0; i--) {
highup[i] = 0;
lowup[i] = 100000;
highdown[i] = 0;
lowdown[i] = 100000;
highmiddle[i] = 0;
lowmiddle[i] = 100000;
for(int j=begin; j<=end; j+=step) {
double bbup = iBands(Symbol(),0,j,deviation,0,PRICE_OPEN,MODE_UPPER,i);
double bbdown = iBands(Symbol(),0,j,deviation,0,PRICE_OPEN,MODE_LOWER,i);
double bbmiddle= iBands(Symbol(),0,j,deviation,0,PRICE_OPEN,MODE_MAIN,i);
if(bbup == 0 || bbdown == 0 || bbmiddle == 0) {
highup[i] = 0;
lowup[i] = 0;
highdown[i] = 0;
lowdown[i] = 0;
highmiddle[i] = 0;
lowmiddle[i] = 0;
break;
}
if(bbup > highup[i])
highup[i] = bbup;
if(bbup < lowup[i])
lowup[i] = bbup;
if(bbdown > highdown[i])
highdown[i] = bbdown;
if(bbdown < lowdown[i])
lowdown[i] = bbdown;
if(bbmiddle > highmiddle[i])
highmiddle[i] = bbmiddle;
if(bbmiddle < lowmiddle[i])
lowmiddle[i] = bbmiddle;
}
}
i=Bars-1;
if(counted_bars>1) i=Bars-counted_bars-1;
while(i>=0) { priceBuffer[i]=Close[i]; 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
---