Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
Atr_3v1_3
//+------------------------------------------------------------------+
//| Atr_3v1.mq4 |
//| Copyright © 2006, HexSys Software Corp. |
//| |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, HexSys Software Corp."
#property link ""
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_buffers 5
#property indicator_color1 LightSteelBlue
#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=90;
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, 1);
SetIndexBuffer(0,ExtMapBuffer1);
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*2);
//----
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;
for(j=1;j<=AtrMAX;j++) s=s+Volume[j];
s=s/(AtrMAX);
//for zero bar
ExtMapBuffer1[0]=(iATR(NULL,0,1,0)*100) / iATR(NULL,0,AtrMAX,0);
ExtMapBuffer4[0]=(Volume[0]*100) / s;
//for All bars...
for(int i=1;i<mBars;i++)
{
//ExtMapBuffer2[i]=iATR(NULL,0,AtrMAX,i);
ExtMapBuffer1[i]=(iATR(NULL,0,1,i)*100) / iATR(NULL,0,AtrMAX,i);
if (s==0) s=1;
ExtMapBuffer4[i]=(Volume[i]*100) / s;
if(ExtMapBuffer4[i]>Percent && ExtMapBuffer1[i]>Percent &&
ExtMapBuffer4[i]<Percent*2 && ExtMapBuffer1[i]<Percent*2 &&
ExtMapBuffer1[i]>ExtMapBuffer4[i])
{
if (Open[i]<Close[i]) ExtMapBuffer2[i]=ExtMapBuffer1[i];
if (Open[i]>Close[i]) ExtMapBuffer3[i]=ExtMapBuffer1[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
---