Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
VolATR
//+------------------------------------------------------------------+
//| VolAtr.mq4 |
//| MetaQuotes |
//| http://www.alpari-idc.ru/ru/experts/articles/ |
//+------------------------------------------------------------------+
#property copyright "MetaQuotes"
#property link "http://www.alpari-idc.ru/ru/experts/articles/"
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Navy
//---- input parameters
extern int ATRper=8;
extern int SmoothPer=5;
extern int SmoothType=0;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
string type;
switch(SmoothType)
{
case MODE_EMA: type="EMA";break;
case MODE_SMMA: type="SMMA";break;
case MODE_LWMA: type="LWMA";break;
default: type="SMA";SmoothType=0;break; // åñëè íè îäèí âàðèàíò íå ïîäîøåë
}
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexLabel(0,"ATR("+ATRper+")");
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexLabel(1,"Sm("+"ATR("+ATRper+"),"+SmoothPer+")"+type);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
int limit,cnt;
if (counted_bars==0)
{
limit=Bars-ATRper-1;
for(cnt=limit;cnt>=0;cnt--)
{
ExtMapBuffer1[cnt]=iATR(NULL,0,ATRper,cnt);
}
for(cnt=limit-SmoothPer;cnt>=0;cnt--)
{
ExtMapBuffer2[cnt]=iMAOnArray(ExtMapBuffer1,0,SmoothPer,0,SmoothType,cnt);
}
}
//----
//----
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
---