Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
rcjctz9mlrt2_1bf2l3ljt81rhh6hzj9n
//+------------------------------------------------------------------+
//| Bands.mq4 |
//| Copyright © 2005, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2005, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Red
#property indicator_color2 Red
#property indicator_color3 LightSeaGreen
//---- indicator parameters
extern int Ïåðèîä_ATR=20;
extern double Êîýôôèöèåíò=2;
extern int Êîëè÷åñòâî_Áàðîâ=20;
//---- buffers
double Ëþñòðà_Íèç[];
double Ëþñòðà_Âåðõ[];
double ATR[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_NONE);
SetIndexBuffer(0,ATR);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,Ëþñòðà_Íèç);
SetIndexLabel(1,"Ëþñòðà_Íèç");
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,Ëþñòðà_Âåðõ);
SetIndexLabel(2,"Ëþñòðà_Âåðõ");
//----
SetIndexDrawBegin(0,Ïåðèîä_ATR);
SetIndexDrawBegin(1,Ïåðèîä_ATR);
SetIndexDrawBegin(2,Ïåðèîä_ATR);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Bollinger Bands |
//+------------------------------------------------------------------+
int start()
{
int i,k,counted_bars=IndicatorCounted();
double deviation;
double sum,oldval,newres;
//----
if(Bars<=Ïåðèîä_ATR) return(0);
//---- initial zero
if(counted_bars<1)
for(i=1;i<=Ïåðèîä_ATR;i++)
{
ATR[Bars-i]=EMPTY_VALUE;
Ëþñòðà_Íèç[Bars-i]=EMPTY_VALUE;
Ëþñòðà_Âåðõ[Bars-i]=EMPTY_VALUE;
}
//----
int limit=Bars-counted_bars;
if(counted_bars>0) limit++;
for(i=0; i<limit; i++)
ATR[i]=iATR(NULL,0,Ïåðèîä_ATR,i);
//----
i=Bars-Ïåðèîä_ATR+1;
if(counted_bars>Ïåðèîä_ATR-1) i=Bars-counted_bars-1;
while(i>=0)
{
Ëþñòðà_Íèç[i]=High[iHighest(NULL,0,MODE_HIGH,Êîëè÷åñòâî_Áàðîâ,i)]-Êîýôôèöèåíò*ATR[i];
Ëþñòðà_Âåðõ[i]=Low[iLowest(NULL,0,MODE_LOW,Êîëè÷åñòâî_Áàðîâ,i)]+Êîýôôèöèåíò*ATR[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
---