Top Menu

Feedburner

Right-Side Top Menu

Candle Wicks Length Display Indicator — MT4/MT5

May 8, 2011 (Last updated on February 8, 2013)

Today, I present an improved version of my CandleWicks indicator. From being a simple alert script it becomes a more or less real indicator with some on-chart display. By the request of one of our forum users, I’ve coded a candle wicks length display feature for this indicator. It will show pip length of wicks (expressed in normal/standard pips) for wicks that are longer than a limit set by the trader via the input parameter. I still don’t want to add this indicator to the list of MetaTrader indicators on the site, because I have no clue how it can be used for trading. As with all other my indicators, it’s available for both MT4 and MT5 and is completely free:

New customizable input parameters:

DisplayWickLimit — minimum wick length in pips (standard/normal) for indicator to display it on chart.
DisplayHighWickColor — color for the top wick length.
DisplayLowWickColor — color for the bottom wick length.
DisplayWickDistance — distance from the candle high to the top wick length display (you will want to adjust it, depending on the chart timeframe and zoom level).

Old parameters description can be found here.

Demo image (EUR/USD H1, DisplayWickLimit = 10):

Indicator displays candle wicks length on chart

Update 2013-02-08: You can also use the Candle Wicks indicator with percentage display if you need one.

If you have any comments or questions about this candlestick wick length display indicator, please reply using the form below.

81 Responses to “Candle Wicks Length Display Indicator — MT4/MT5”

  1. Rob Matysiak

    Your blog is amazing!!! I especially appreciate the candle stick diagrams as reference

    Reply

  2. Jernej

    Hi
    This indicator (candle´s wicks) is great, but what i realy need is the same indicator , just showing the complete lenght of the candle, form hi to low. Is it possible??
    Regards, Jernej

    Reply

    admin Reply:

    Yes, you can easily make this change in the code yourself even if you don’t know much about MQL coding.

    Reply

    Jernej Reply:

    Hi thanks for replay, but can you help me please…. What i need to do?? I am not so good in decoding.
    Thanks and regards
    Jernej

    Reply

    admin Reply:

    Sure, what version do you use – MT4 or MT5?

    Reply

    AK Reply:

    how to setting can let it display candle body pips? open price to close price
    thank you very much~

    Reply

    admin Reply:

    Sorry, there are no settings that would let this indicator to display candle body pips. You’ll have to change its code for that.

    Reply

  3. Jernej

    MT4

    Reply

    admin Reply:

    Find the following expressions in the .mq4 file:

    High[i] - Close[i]
    Open[i] - Low[i]
    High[i] - Open[i]
    Close[i] - Low[i]

    and replace with this expression:

    High[i] - Low[i]

    Reply

  4. Kev

    What a cool indicator. Can it display what percentage % of the candle the wick is, like 50% or something, that would be very useful. I’m no coder by the way but I’d love to see how its done to help me identify candles that are 20% or bigger
    Kev

    Reply

    admin Reply:

    It can with a small modification.

    Reply

  5. Kev

    Could you tell me what this mod is, I’ll have a go at this today.
    I get the math, wick length divided by candle high/low (that is whole candle length incl wick)
    Great indi by the way.
    Kev

    Reply

  6. Kev

    Just done it, was a bit trickier than I thought but maybe you wish to add it to your portfolio. Thank you again for excellent piece of code.

    //+------------------------------------------------------------------+
    //|                                           CandleWicks%Display.mq4 |
    //|                                  Copyright © 2011, Andriy Moraru
    //|      ** modified code to display % of each wick and set limit on number of bars displayed
    //+------------------------------------------------------------------+
    #property copyright "Copyright © 2011, Andriy Moraru"
    #property link      "http://www.earnforex.com"
     
    /*
       Alerts you when the candle's wick (shadow) reaches a certain % length.
       Your e-mail settings are set in Tools -> Options -> Email.
       Also displays the candle wicks' length above and below the candles.
    */
     
    // The indicator uses only objects for display, but the line below is required for it to work.
    #property indicator_chart_window
     
    extern int DisplayWickLimit = 5; // In standard pips
    extern string percent="Set below as the % for candle wicks you want to see so anything over 10% is 10 etc";
    extern int DisplayWickLimitPERCENT = 40; // PERCENTAGE DISPLAY, set to anything over 40%
     
    extern color DisplayHighWickColor = Red;
    extern color DisplayLowWickColor = LimeGreen;
    extern int DisplayWickDistance = 10; // Distance from High to Pip Count
    extern int UpperWickLimit = 10; // In broker pips
    extern int LowerWickLimit = 10; // In broker pips
    extern bool WaitForClose = true; // Wait for a candle to close before checking wicks' length
    extern bool EmailAlert = false;
    extern bool SoundAlert = true;
    extern bool VisualAlert = false;
    extern int how_many_bars = 20;
     
    double length_high=0;
    double length_low=0;
    double rlength_high=0;
    double rlength_low=0;
     
    // Time of the bar of the last alert
    datetime AlertDone;
     
    double Poin;
     
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function                         |
    //+------------------------------------------------------------------+
    int init()
    {
    	Poin = Point;
    	//Checking for unconvetional Point digits number
       if ((Point == 0.00001) || (Point == 0.001)) Poin *= 10;
       return(0);
    }
     
    //+------------------------------------------------------------------+
    //| Custom indicator deinitialization function                       |
    //+------------------------------------------------------------------+
    int deinit()
    {
       for (int i = 0; i  0) counted_bars--;
       int limit = Bars - counted_bars;
       if (limit > how_many_bars) limit = how_many_bars;
     
     
     
       for (int i = 0; i <= limit; i++)
       {
         // need to calculate combinations of how the bar closes +ve or negative
         length_high = ((High[i] - Close[i])/(High[i] - Low[i])*100); 
         length_low =  ((Open[i] - Low[i])/(High[i] - Low[i])*100);
     
         rlength_high = ((High[i] - Open[i])/(High[i] - Low[i])*100); 
         rlength_low = ((Close[i] - Low[i])/(High[i] - Low[i])*100); 
     
          if (Open[i] = DisplayWickLimitPERCENT) // Upper wick length display
             { 
                name = "Red-" + TimeToStr(Time[i], TIME_DATE|TIME_MINUTES);
                length = DoubleToStr(MathRound(length_high), 0) + "%";
                if (ObjectFind(name) != -1) ObjectDelete(name);
                ObjectCreate(name, OBJ_TEXT, 0, Time[i], High[i] + DisplayWickDistance * Poin);
                ObjectSetText(name, length, 10, "Verdana", DisplayHighWickColor);
             }
             if (length_low >= DisplayWickLimitPERCENT) // Lower wick length display
             {
                name = "Green-" + TimeToStr(Time[i], TIME_DATE|TIME_MINUTES);
                length = DoubleToStr(MathRound(length_low), 0) + "%";
                if (ObjectFind(name) != -1) ObjectDelete(name);
                ObjectCreate(name, OBJ_TEXT, 0, Time[i], Low[i]);
                ObjectSetText(name, length, 10, "Verdana", DisplayLowWickColor);
             }
          }//red is on top
          else 
          {
             if (rlength_high >= DisplayWickLimitPERCENT) // Upper wick length display
             {
                name = "Red-" + TimeToStr(Time[i], TIME_DATE|TIME_MINUTES);
                length = DoubleToStr(MathRound(rlength_high), 0) + "%";
                if (ObjectFind(name) != -1) ObjectDelete(name);
                ObjectCreate(name, OBJ_TEXT, 0, Time[i], High[i] + DisplayWickDistance * Poin);
                ObjectSetText(name, length, 10, "Verdana", DisplayHighWickColor);
             }
             if (rlength_low >= DisplayWickLimitPERCENT) // Lower wick length display
             {
                name = "Green-" + TimeToStr(Time[i], TIME_DATE|TIME_MINUTES);
                length = DoubleToStr(MathRound((rlength_low)), 0) + "%";
                if (ObjectFind(name) != -1) ObjectDelete(name);
                ObjectCreate(name, OBJ_TEXT, 0, Time[i], Low[i]);
                ObjectSetText(name, length, 10, "Verdana", DisplayLowWickColor);
             }
          }
       }
     
       if (AlertDone == Time[index]) return(0); // Already sent an alert for this candle
     
       if (Close[index] >= Open[index]) // Bullish candle
       {
          if ((High[index] - Close[index] >= UpperWickLimit * Point) || (Open[index] - Low[index] >= LowerWickLimit * Point)) DoAlert = true;
       }
       else // Bearish candle
       {
          if ((High[index] - Open[index] >= UpperWickLimit * Point) || (Close[index] - Low[index] >= LowerWickLimit * Point)) DoAlert = true;
       }
     
       if (DoAlert)
       {
          datetime tc = TimeCurrent();
          string time = TimeYear(tc) + "-" + TimeMonth(tc) + "-" + TimeDay(tc) + " " + TimeHour(tc) + ":" + TimeMinute(tc);
          if (VisualAlert) Alert(time + " - wick limit reached!");
          if (SoundAlert) PlaySound("alert.wav");
          if (EmailAlert) SendMail("CandleWick Alert", time + " - wick limit reached!");
          AlertDone = Time[index];
       }
     
       return(0);
    }
    //+------------------------------------------------------------------+

    Reply

    admin Reply:

    Big thanks for sharing, but it would be better if you uploaded the file to some file sharing websites and just provided a link here instead of such a long piece of code. Thanks anyway!

    Reply

  7. Kev

    could not code the alert properly though as I am not a coder, sorry

    Reply

  8. Adi

    Hi…. this is wonderful indicator, I have been searching this indicator for a long time, now I’ve found here. However, I modify the indicator for just showing the body length of the candle. The alert notification is so useful for me. Thank you so much. I wish more success for you in this business and ur life.

    Reply

    admin Reply:

    I am glad to help. If you have some time, upload your modification to some file sharing website and post here a link to it. Maybe some other traders will also find it useful. Thanks.

    Reply

    Adi Reply:

    Hi
    I just follow ur instruction above, but to replace with this expression: Open[i] – Close[i] and Close (i) – Open (i). But I‘ve found problem in the visual & sound alert. It doesn’t work properly. The alert still active every start of new candle. Can you improve it? Thanks!

    Reply

    admin Reply:

    Remove lines 117-124 and but the following line of code instead:

    if (MathAbs(Close[index] - Open[index]) >= UpperWickLimit * Point) DoAlert = true;

    Then you will be able to set the minimum candle body size for alert via UpperWickLimit.

    Reply

    Adi Reply:

    Oo yess… I forgot to modify line 117-124. It’s work now. Thank you very much!!
    I like this indicator because the alert will remind me the price movement even in a matter of second. If price move above 7 pips in just 1 minute, that’s a good momentum for scalper to seek opportunity for trade.

    Reply

    admin Reply:

    Interesting usage of the indicator :).

    Reply

    ginola Reply:

    hi Adi, may i request from you to share the indicator. That would help me alot man, thanks in advanced.

    Reply

  9. Sameer

    Thanks a lot for the mq5 code, I’ve basic knowledge with programming,
    and used it to modify the code to alert on specific candle size :)

    Reply

  10. sb

    can this indicator be made to show only candles with open and close within 1/3 or 30% its total lenght? Thanks so very much.

    Reply

    admin Reply:

    Do you mean within only top/bottom 1/3 or any 1/3 (basically the difference between Open and Close to be no more than 1/3 of length)?

    Reply

    sb Reply:

    yes, i mean within only top/bottom 1/3 of candle . thanks very much.

    Reply

    admin Reply:

    Re-download the new version of CandleWicksDisplay. The input parameter is called TopBottomPercent. Set it to 33 to get only lengths for candles with Open&Close inside top/bottom 1/3. You can set it to any percentage value.

    Reply

  11. David

    Thank you very much for the code! It is very close to what I need.
    I changed the code to just calculate the distance of the body in pips,
    however, some candles don’t show a number at all. Couldn’t figure this
    out why some are numbered and some aren’t.

    Can you or another coder help me to make the code show a number for every
    candle and at an attractive distance from the candle?

    Thanks in advance.

    David

    Reply

  12. David

    Oh yeah: I just need the Open and Close Length only or total “body” length in pips.
    Thanks,
    David

    Reply

    jali Reply:

    Oh me too. open -close( body length only). i try to change the coded, but it show no value

    Reply

    admin Reply:

    Try using MathAbs(Close[i] – Open[i])

    Reply

  13. David

    Thank you for the suggested code.

    It still does not count properly. It does on about 80%, but leaves a long trend without any count in some areas.

    Any other ideas would be greatly appreciated.

    Thanks,

    David

    Reply

    admin Reply:

    Did you forget to set DisplayWickLimit to 0?

    Reply

  14. PA Trader

    Hello and thanks for this great indi. I would like to modify it to alert me if 2 conditions: candle body is greater than a number of pips and (in the same time) either one of the wicks is smaller than a number of wicks. Please help and thanks very much!

    Reply

  15. fxNewbie

    i dont understand..how to convert this indicator to show the size of the candle…huhu

    Reply

    chirag Reply:

    I am not understand how to use this indicator. please help me for how to use it.

    Reply

    admin Reply:

    Just attach it to your chart in MetaTrader.

    Reply

  16. john mike kabuye

    This is one mind of a wonderful indicator.My only request is is it posible to code an indicator to show candle counts say i will give an example.

    Assume we are in an uptrend and the close is up for 1st candle then a 2nd candle closes above the close of the 1st candle same with the 3rd candlle closing above thethe close of 2nd etc. my question is now is there a code that can number the close of each candle `s high like 1 2 3 3 4 etc however this code should also be able tovoid the count or start over again if say there are more than 3 lateral candles. and start the count over agin. I want this indicator so much if it can be done.but i want this for mt4 please

    Reply

    admin Reply:

    Interesting idea. You can ask on our forum:
    http://www.earnforex.com/forum/f13/
    Perhaps someone will implement it.

    Reply

  17. cogs

    Hi, Great inidicator.

    As I restart MT4 daily as suggested by metaquotes, when I do the old candle wick numbers are not removed from the chart so I get duplicate numbers and sometime different numbers.

    Is there a way to make this indicator resfresh and clear old objects evry 24hrs?

    Thanks in advance.

    Reply

    admin Reply:

    The indicator is deleting all of its objects on deninitialization. Please make sure you are using the latest version and exit the MetaTrader 4 correctly.

    Reply

  18. cogs

    Terrrific thanks. I discovered your first version some time ago.

    Reply

    admin Reply:

    Glad to help.

    Reply

  19. Jayaprakash

    If i place a cursor on any timeframe candle, it should show the net difference between high and low of that particular candle. Is it possible sir, if yes – please upload the same sir to my email address sir. thankyou.

    Reply

    admin Reply:

    No, sorry. It’s MetaTrader system tooltip that pops up there. Cannot change that.

    Reply

  20. trissuke

    hello admin, can you help me? I need this indicator but I would like an indicator that there is an alarm, for example, open price at 1.23000 then the price moves up 5pips of the open, at the price of 1.23050 I want the alarm to ring. vice versa if the price moves down I want the alarm to ring at a price of 1.22950.

    once again please help me.,
      regards,
    - Facebook https://www.facebook.com/profile.php?id=100004327297451
    - Mail trisnosuke@gmail.com

    Reply

  21. olee

    Thank you for sharing this. Really appreciate it. I have been looking for this for sometime now. When i discovered this blog… wow !
    I don’t have programming background. Just wonder. Can this indicator be made into an EA/robot ? I yes, can we run test to see whether the business argument that we pump in can be tested in order to see the success/failure rate ?

    Reply

    admin Reply:

    It can certainly be made into an EA and tested in a Strategy Tester, but what is a “business argument”?

    Reply

  22. prabhu

    hi i need to know, in that indicator shows many wick values like 5,6,7,8,9,10 and etc so in which point is correct to enter the market and when to exit. please explain, thanks.

    Reply

    admin Reply:

    Sorry, but I don’t think that this indicator can be used for entry signals.

    Reply

  23. Matt

    Hello!
    You guys seem the closest without going over.. :)

    This is really impressive stuff!
    What I’m looking for is a variation of this..
    An indicator that can calculate the percentage difference between the close and the low on a bear candle
    Or the close and the high on a bull candle.
    Then possibly with an ability to only display results if the result is >20% (like a customisable number)

    How would someone do that?

    Reply

    admin Reply:

    What is “the percentage difference between the close and the low”? Could you demonstrate an example, please?

    Reply

  24. Matt

    Hello Admin,

    No probs… Basically what I’d like is a variation on the PERCENTAGE version of this indicator.
    So that:
    a) The percentage of the candle that is wick is displayed above (or below the candle)
    b) You can personalize it. So instead of it generating the percentage for every candle you can adjust it so it only displays a result IF the wick is less then 10% of the overall candle.

    Hope I’ve been clearer here…
    Thanks alot for you help!

    Reply

    admin Reply:

    Why won’t Kev’s version work for you?

    Reply

  25. Matt

    I tried to code the version Kev provided and it generated too many errors?
    Did I do it wrong? Just popped it into mt4 coder and let it do it things?

    Reply

    admin Reply:

    Yeah, it’s bugged. I’ve coded a new one. Please see the post for an updated download link.

    Reply

  26. Matt

    Hey Admin!

    Thanks for all your help with this…
    Where is this new one you coded? I can’t find it?

    Reply

    admin Reply:

    There is an updated appended to the bottom of the post (just below the chart image).

    Reply

  27. Matt

    Hello!

    I’ve worked out a number of different kinks with this indicator to modify it to my personal spec.
    I need help trying to finalize the last part of the process…

    Right now… The Indicator works out PERCENTAGE of wick, and can be modified in the settings, to NOT include results BELOW a certain number (pre-set to ’5%’)

    What I have done is modify the code to make it:
    A) ONLY show results BELOW a certain number (to discount any results that are above what ever number I preset in the settings Ie: To NOT show me results above 10%
    B) Applied this filter to both TOP and BOTTOM wicks
    C) Made it so it only shows results when BOTH CRITERIA are met.

    What I need your help with is working out how I can get it to display the results of qualifying candles by just a simple Arrow or something… I want to only be notified of candles where the upper and lower wicks are below 10% – I don’t care what number below 10% they specifically are! I just care that my criteria has been met.

    How do I code the percentage wick indicator to simply notify me with an arrow or something instead of numbers top and bottom?!

    Thankyou very much for your help…

    Reply

    admin Reply:

    Please do not insert big chunks of code inside comments. Upload the file to some file sharing hosting and post a link to it.

    Reply

    Matt Reply:

    Apologies, I was trying to demonstrate where I was going wrong in manipulating the code already available.
    Can any one help with the version I’m looking to achieve?

    Reply

    admin Reply:

    Just put the file to Google Drive and post a link here. The code becomes unreadable after you submit it via comment.

    Reply

  28. Matt

    PS:
    That Percentage code one Admin… Awesome work man I wouldn’t know where to start with something like that! Really appreciate the time and effort man…

    Reply

  29. Matt

    In short I tried to make it comply to the conditions I listed before but it completely didn’t work. I don’t think the file would actually be any use to a coder except for a laugh maybe.
    Is there anyone who can help actually code those conditions?

    Right now… The Indicator works out PERCENTAGE of wick, and can be modified in the settings, to NOT include results BELOW a certain number (pre-set to ’5%’)

    What I have done is modify the code to make it:
    A) ONLY show results BELOW a certain number (to discount any results that are above what ever number I preset in the settings Ie: To NOT show me results above 10%
    B) Applied this filter to both TOP and BOTTOM wicks
    1) IF a BULL Bar – Filter Applied to TOP of Wick
    2) If a BEAR Bar – Filter Applied to BOTTOM of Wick
    3) An option to switch on for BOTH sides criteria to be met

    What I need your help with is working out how I can get it to display the results of qualifying candles by just a simple Arrow or something… I want to only be notified of candles where the upper and lower wicks are below 10% – I don’t care what number below 10% they specifically are! I just care that my criteria has been met.

    How do I code the percentage wick indicator to simply notify me with an arrow or something instead of numbers top and bottom?!

    Thankyou very much for your help…

    Reply

    Matt Reply:

    Sorry….

    PPS:

    I TRIED to code the above conditions and ended up with a pie in the face…

    Can someone help me to actually achieve the above coded? I’d really appreciate some help here..

    Thanks alot once again..
    Matt

    Reply

    admin Reply:

    You’ve got me confused. Have you actually modified the code for conditions and now only need to transform percentage display to arrows display?

    Reply

  30. Don

    I need to learn how to change the color or the candles to red and green, and if possible have the back ground color be white on MT5

    Thank you

    Reply

    admin Reply:

    Right-click on the chart -> Properties. You can set any colors for almost anything in the Colors tab there.

    Reply

  31. olee

    Hi. really need your help. can you help me to modify the code to show only wick which is greater than the body length. For example, if the candle body is 10 and the upper or lower wick is greater than 10, then the wick value is displayed. Else, no value is displayed

    Reply

    admin Reply:

    That’s not hard MathAbs(Close – Open) difference is what you need for body length. Just add it to the limit checking conditions.

    Reply

  32. Suresh

    Hi. I need a indicator to alert me for the following condition. 3 bars in a same bullish/bearish pattern and the last one of the three is more than 5 pips length and if the current bar is opposite to the last 3 bars with 5 pip length, then i need the indicator to alert me with beep.

    Reply

  33. mangomax

    All the above is rather confusing.

    I’m a Newbie’s NEWBIE and have absolutely no idea how to write script. Where can I find an indicator that give’s me the length of a candle in pips, wick-to-wick / shadow to shadow, whenever I place the mouse pointer on the candle.

    Many thanks in advance!

    Reply

    Andriy Moraru Reply:

    Sorry, but I don’t know if such an indicator exists.

    Reply

  34. David

    Hello again. I commented way back. I’m still looking for the same thing. I am not a programmer and still cannot get this great indicator to do something very simple. I would like it to display just the body length of the candle from open to close. That it and it would be so great! Can you help me please because using “MathAbs” or anything else has just not worked. Otherwise, I love this indicator!! The more I can automatically see the differences in the candle lengths and the open-close distance at a glance, the better. If this indicator can be modified to easily do both at the same time, that would be awesome! Thanks in advance.

    Reply

  35. David

    Correction (it’s early this morning): If I could see the open-close distance or length of candle body measurement AND the wick distances (shadow lengths) at a glance as well, this would really help me in my analysis. If it is to difficult, I would be happy just knowing the body length of the candle posted on the chart. Thanks!

    Reply

    Andriy Moraru Reply:

    It is difficult to display body length and wicks’ length because it is three values, while there are only two normal positions to place numbers on chart – above and below a candle.

    If you want the indicator to display body length, you will need to change the following (assuming you are using MT4 version):
    On line 85: High[i] – Close[i] to Close[i] – Open[i]
    On line 88: High[i] – Close[i] to Close[i] – Open[i]
    On line 93: Open[i] – Low[i] to Close[i] – Open[i]
    On line 96: Open[i] – Low[i] to Close[i] – Open[i]

    On line 104: High[i] – Open[i] to Open[i] – Close[i]
    On line 107: High[i] – Open[i] to Open[i] – Close[i]
    On line 112: Close[i] – Low[i] to Open[i] – Close[i]
    On line 104: Close[i] – Low[i] to Open[i] – Close[i]

    On line 127: High[index] – Close[index] and Open[index] – Low[index] to Close[index] – Open[index]
    On line 131: High[index] – Open[index] and Close[index] – Low[index] to Close[index] – Open[index]

    Do not forget to set input parameter DisplayWickLimit to 0 if you want it to display body length for all candles.

    Reply

  36. David

    Thanks for your quick response and analysis. You are right, it would be difficult to put three numbers showing these measurements. I input all your figures on each line (wasn’t sure about the two lines #104) and it would not compile completely:
    ‘CandleBodySize.mq4′ CandleBodySize.mq4 1 1
    not all control paths return a value CandleBodySize.mq4 16 1
    not all control paths return a value CandleBodySize.mq4 31 1
    0 error(s), 2 warning(s) 1 3
    I’m sure it is because I might have input them wrong. Thank you again for attempting to help me get candle body length on there. Let me know if you have any suggestions!
    This is a really cool indicator and code :)

    Reply

    Andriy Moraru Reply:

    Yeah, second 104 should be 112, not 104.

    It compiled OK. Those 2 warnings are harmless.

    Reply

  37. Simple

    May I put forward a personal request to customize the alert section of your indicator to show current symbol instead of year-month-date-time?

    Reply

    Andriy Moraru Reply:

    Yeah, please redownload the indicator. It will now show both date and currency pair.

    Reply

    Simple Reply:

    Thanks for the quick response…….keep up the good work. God bless

    Reply

Leave a Reply

required
required (will not be published)
optional

Subscribe to Monthly Forex Newsletter