VSA-wick0[1].3

Author: Seavo
VSA-wick0[1].3
Price Data Components
Series array that contains the highest prices of each barSeries array that contains close prices for 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
VSA-wick0[1].3
//+------------------------------------------------------------------+

//| Wick.mq4 |

//| Seavo |

//| http://www.forexfactory.com/member.php?u=17692 |

// Simple mod by DRT 5/30/2009 to show hi-lo-close wick, without open.

//+------------------------------------------------------------------+

#property copyright "Seavo"

#property link "http://www.forexfactory.com/member.php?u=17692"

#property indicator_separate_window

#property indicator_buffers 4

#property indicator_color1 GreenYellow
#property indicator_color2 Black
#property indicator_color3 Silver
#property indicator_color4 Silver

//---- external variables
extern bool ShowAtr = false;
extern int AtrPeriod = 14;
extern double  kAtr = 0.62;

extern bool ShowNetWick = true;


//---- 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);
if (ShowAtr)
{
SetIndexStyle(2,DRAW_LINE);
SetIndexBuffer(2,ExtMapBuffer3);

SetIndexStyle(3,DRAW_LINE);
SetIndexBuffer(3,ExtMapBuffer4);
}
string short_name = "DRT VSAWick";

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);
//   }  //downbar
// if (iOpen(NULL, 0, pos) <= iClose(NULL, 0, pos)){   
   dResult1 = iHigh(NULL, 0, pos) - iClose(NULL, 0, pos);
//    }  //upbar
// if (iOpen(NULL, 0, pos) > iClose(NULL, 0, pos)){
   dResult2 = iLow(NULL, 0, pos) - iClose(NULL, 0, pos);
//    }  //downbar
// if (iOpen(NULL, 0, pos) <= iClose(NULL, 0, pos)){
//    dResult2 = iLow(NULL, 0, pos) - iOpen(NULL, 0, pos);
//   }  //upbar
if (ShowAtr){
   dResult3 = iATR(NULL,0,AtrPeriod, pos)*kAtr ;
   dResult4 = (0 - iATR(NULL,0,AtrPeriod, pos)*kAtr );

   ExtMapBuffer3[pos]= dResult3 ;
   ExtMapBuffer4[pos]= dResult4 ;

   }

 if (ShowNetWick)
   {
      double dResultNet =  dResult1 +dResult2;
      if (dResultNet>0) {  //dResult1= dResultNet;
                           ExtMapBuffer1[pos]= dResultNet ;
                         }
      else                 ExtMapBuffer2[pos]= dResultNet ;
   }
  else
   {
   ExtMapBuffer1[pos]= dResult1 ;
   ExtMapBuffer2[pos]= dResult2 ;
   }
   

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 ---