Author: Seavo
wick0.2
Price Data Components
Series array that contains open prices of each barSeries array that contains close prices for each barSeries array that contains the highest prices of each barSeries array that contains the lowest prices of each bar
Indicators Used
Indicator of the average true range
Miscellaneous
Implements a curve of type %1
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 supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---