Price Data Components
Indicators Used
Miscellaneous
0
Views
0
Downloads
0
Favorites
wick0.2
//+------------------------------------------------------------------+
//| Wick.mq4 |
//| Seavo |
//| http://www.forexfactory.com/member.php?u=17692 |
//+------------------------------------------------------------------+
#property copyright "Seavo"
#property link "http://www.forexfactory.com/member.php?u=17692"
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_color1 Red
#property indicator_color2 Blue
#property indicator_color3 White
#property indicator_color4 White
//---- external variables
extern bool ShowAtr = false;
extern int AtrPeriod = 14;
//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
double ExtMapBuffer3[];
double ExtMapBuffer4[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_HISTOGRAM);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_HISTOGRAM);
SetIndexBuffer(1,ExtMapBuffer2);
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);
SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer4);
string short_name = "Wick";
IndicatorShortName(short_name);
//----
return(1);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars=IndicatorCounted();
//---- check for possible errors
if (counted_bars<0) return(-1);
//---- last counted bar will be recounted
if (counted_bars>0) counted_bars--;
int pos=Bars-counted_bars;
//---- main calculation loop
double dResult1;
double dResult2;
double dResult3;
double dResult4;
while(pos>=0)
{
if (iOpen(NULL, 0, pos) > iClose(NULL, 0, pos)){
dResult1 = iHigh(NULL, 0, pos) - iOpen(NULL, 0, pos);
}
if (iOpen(NULL, 0, pos) <= iClose(NULL, 0, pos)){
dResult1 = iHigh(NULL, 0, pos) - iClose(NULL, 0, pos);
}
if (iOpen(NULL, 0, pos) > iClose(NULL, 0, pos)){
dResult2 = iLow(NULL, 0, pos) - iClose(NULL, 0, pos);
}
if (iOpen(NULL, 0, pos) <= iClose(NULL, 0, pos)){
dResult2 = iLow(NULL, 0, pos) - iOpen(NULL, 0, pos);
}
if (ShowAtr){
dResult3 = iATR(NULL,0,AtrPeriod, pos);
dResult4 = (0 - iATR(NULL,0,AtrPeriod, pos));
}
ExtMapBuffer1[pos]= dResult1 ;
ExtMapBuffer2[pos]= dResult2 ;
ExtMapBuffer3[pos]= dResult3 ;
ExtMapBuffer4[pos]= dResult4 ;
pos--;
}
//----
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
---