Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Atr_3v1_4
//+------------------------------------------------------------------+
//| Atr_3v1.mq4 |
//| Copyright © 2006, HexSys Software Corp. |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, HexSys Software Corp."
#property link ""
#property indicator_separate_window
#property indicator_minimum -110
#property indicator_maximum 110
#property indicator_buffers 5
#property indicator_color1 Yellow
#property indicator_color2 Red
#property indicator_color3 Blue
#property indicator_color4 Yellow
#property indicator_color5 Red
//---- input parameters
extern int AtrMAX=480;
extern int Percent=50;
extern int mBars=480;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
double ExtMapBuffer5[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM,EMPTY, 2);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexEmptyValue(0,0.0);
SetIndexStyle(1,DRAW_HISTOGRAM,EMPTY, 2);
//SetIndexArrow(1,241);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexEmptyValue(1,0.0);
SetIndexStyle(2,DRAW_HISTOGRAM,EMPTY, 2);
//SetIndexArrow(2,242);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexEmptyValue(2,0.0);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer4);
SetIndexStyle(4,DRAW_LINE);
SetIndexBuffer(4,ExtMapBuffer5);
//*
IndicatorDigits(2);
SetLevelStyle(STYLE_DOT,1,Yellow);
SetLevelValue(0,Percent);
SetLevelValue(1,-Percent);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//----
//for(int i=0;i<counted_bars;i++)
double s=0; int j=0;
double Ext1=0,Ext4=0;
for(j=1;j<=AtrMAX;j++) s=s+Volume[j];
s=s/(AtrMAX);
//for zero bar
Ext1=(iATR(NULL,0,1,0)*100) / iATR(NULL,0,AtrMAX,0);
Ext4=(Volume[0]*100) / s;
ExtMapBuffer1[0]=Ext4-Ext1;
//if (Ext4-Ext1>=0) {ExtMapBuffer2[0]=Ext4-Ext1; ExtMapBuffer3[0]=0;}
//if (Ext4-Ext1<0) {ExtMapBuffer3[0]=Ext4-Ext1; ExtMapBuffer2[0]=0;}
//for All bars...
for(int i=1;i<mBars;i++)
{
Ext1=(iATR(NULL,0,1,i)*100) / iATR(NULL,0,AtrMAX,i);
Ext4=(Volume[i]*100) / s;
if (Ext4-Ext1>=0) {ExtMapBuffer2[i]=Ext4-Ext1; ExtMapBuffer3[i]=0;}
if (Ext4-Ext1<0) {ExtMapBuffer3[i]=Ext4-Ext1; ExtMapBuffer2[i]=0;}
}
//----
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
---