Author: Seavo
wick0.3

The Wick indicator is a specialized visual tool designed for the MetaTrader platform to help traders analyze price action by isolating and highlighting "wicks" (the thin lines on a candlestick that represent the highest and lowest prices reached during a specific time period). By focusing on these extremes rather than just the bodies of the candles, the tool provides a clearer picture of market volatility and price rejection.

Core Logic and Functionality

The script operates by measuring the distance between the candle's opening/closing prices and its high/low points. It breaks this down into two distinct components:

  • Upper Wick Analysis: The script calculates the length of the upper "tail" by comparing the highest price reached to either the open or the close (depending on whether the candle was bullish or bearish).
  • Lower Wick Analysis: Similarly, it measures the lower "tail" by calculating the distance between the lowest price and the respective open or close.

Key Display Modes

Depending on how the user configures the settings, the indicator displays this data in different ways:

1. Net Wick Mode (Default) When enabled, the script combines the upper and lower wicks into a single measurement. It calculates the total "net" wick length for each candle. This is useful for identifying the total range of price movement that occurred outside of the actual candle body, highlighting areas of high volatility or exhaustion.

2. Individual Wick Mode If the net calculation is disabled, the indicator separates the data, showing the upper and lower wicks as independent values. This allows traders to see exactly which side of the price action is seeing more pressure—whether sellers are pushing prices down or buyers are pushing them up.

3. ATR Integration (Optional) The script includes an optional overlay based on the Average True Range (ATR). When activated, it provides a visual reference line based on a multiplier. This allows traders to compare the actual size of the wicks against a standardized measure of recent market volatility, helping to determine if a specific wick is unusually large or significant relative to the current environment.

Summary for Traders

In essence, this tool filters out the "noise" of the candle bodies and directs your attention to where the price actually touched and retreated from. It serves as a visual barometer for market sentiment, helping you identify potential reversal zones or areas where the market is struggling to maintain its momentum.

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
10 Views
0 Downloads
0 Favorites
wick0.3
//+------------------------------------------------------------------+

//| 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;
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 = "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)*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