MQL4 - automated forex trading   /  

Code Base

Read Financial Magazines in MetaTrader 4 and MetaTrader 5!

Code Base  Indicators  Candle Patterns To post a new code, please log in or register

Download MetaTrader 5 and visit MQL5.community Code Base
and Trade on the Go!
and Trade on the Go!
Couldn't find the right code? Order it in the Jobs section

This library is for
MetaTrader 4
Download MT 4 - 455 Kb

and Trade on the Go!

and Trade on the Go!

Name:
Candle Patterns [ ru ]
Author: sxTed (2008.12.16 08:18)
Rating: 3
Downloaded: 24467
Download:
 Candle Patterns.mq4 (72.0 Kb) View
 gSpeak.mqh (576 bytes) View
 speak.dll (36.0 Kb)
 Candle Patterns.zip (56.2 Kb)

Description:

I am gratefull to the following on which the code is based on: Japanese Candlesticks by http://www.candlesticker.com (which lists the various patterns for bear/bull scenarios) and CandleCode by Victor Likhovidov, references to be found at http://www.forexschool.ru

Setup:

Place files into the following subdirectories: |
Candle Patterns.mq4 into "\experts\indicators",
Candle Patterns.csv into "\experts\files",
Candle Patterns.rtd into "\experts\files",
Symbols_.csv into "\experts\files",
gSpeak.mqh into "\experts\include",
speak.dll into "\experts\libraries",
candle patterns.tpl into "\templates".
Close and then re-start MetaTrader for it to find the new files.
Select "Indicators" -> "Custom" -> "Candle Patterns".
The "Custom Indicator" window is displayed, select "Common" and enable "Allow DLL imports".

Inputs:

"Inputs" are described in file "Candle Patterns.rtd", alternatively right click on the chart and select "candle patterns.tpl" from "Templates".

I spent my youth in Kinshasa and if my programs come in usefull in your trading please let us help the people of the Democratic Republic of the Congo by donating what you can to: http://www.redcross.ie/help/donate_now.php?appeal=107 or any charity.

Take care, Teddy.

39 comments: 1 2 3 4   To post a new comment, please log in or register
hi can you help me . i have down load candle patters and instal it but it could not workink
08.02.2014 11:58 adnan
harpreetseehra:

hi,

I am not able to use the the above indicator as some files are missing

candle patterns.csv, candle patterns.rtd, and symbols.csv are missing.

Can anyone tell about that

Regards



In the zip file.
25.09.2012 16:03 mwduke

hi,

I am not able to use the the above indicator as some files are missing

candle patterns.csv, candle patterns.rtd, and symbols.csv are missing.

Can anyone tell about that

Regards


27.04.2011 10:25 harpreetseehra
sxTed:

Hi way2Freedom, the following method does not make use of iCustom(), take care, Teddy.

On the chart set up custom indicator "Candle Patterns" then call up your EA with the following included code:

void start() {
  static datetime tPreviousTime;
  string obj="CP_NAME", sPatternName="";
  
  // ..... code for OrderClose(), OrderDelete() and/or OrderModify()
      
  // code for retrieving pattern name, if present
  if(tPreviousTime == Time[0]) return;
  tPreviousTime=Time[0];
  if(ObjectFind(obj) >= 0) {
    // External Input Parameter "MaxBarsToScanForPatterns" of custom indicator "Candle Patterns" set to "1"
    sPatternName=ObjectDescription(obj);
    if(StringLen(sPatternName)<2) return; // no pattern
  }
  else {
    // External Input Parameter "MaxBarsToScanForPatterns" of custom indicator "Candle Patterns" set to "0"  
    obj="CP_"+Time[1];
    if(ObjectFind(obj) == -1) return; // no pattern
    sPatternName=ObjectDescription(obj);
  }
  
  // ..... code for testing of suitable pattern
  
  // ..... code for OrderSend()
}


Hey Teddy,

I don't know if you're around anymore, but I have a question.

Is it possible to output the pattern name to the indicator buffer as opposed to having it placed into an object?

While using the above method (which works great) there's no way to run any backtesting other than in visual mode since the the patterns are read from the object on the chart.

Even if it has to be a numeric value or even a color returned in the buffer it could be converted within the EA to the correct pattern name.

I really love this indi, but in order to make it work for my EA I need to use the iCustom parameter to get the actual pattern found as opposed to the buy sell signal.

Also I'd like to remove all the labels on the candles and the audio.

If you can help I would really appreciate it, or if anyone else here in the community could help that would be great too.

Thanks Teddy, I hope you're well and you haven't left us here :)

-Tai

16.03.2011 16:41 tsheppard

01.01.2011 23:45 ALIENLIFEFORM

HI TEDDY,

I'VE JUST BECOME YOUR FAN; SINCE YESTERDAY.

HOW CAN I CHANGE THE RECTANGLE ARROUND THE SINGLE CANDLE (WHICH COMES IN YELLOW BY DEFAULT-AlternateColorSingleCandle=Yellow;) INTO DOTS. THE POINT IS THAT I WISH TO BE ABLE TO SEE THE PREVIOUS & FOLLOWING CANDLESTICK CLEARLY AND THEIR SHADOWS TOO.

PLEASE SEE THE ATTACHED SCREEN-SHOT. I KNOW NOTHING ABOUT CODING.

THANKS,

ALF (ALIENLIFEFORM)

01.01.2011 23:36 ALIENLIFEFORM
Hi, why I can not attach it on the chart ? I follow all of the instruction, please advice
28.09.2010 18:39 kissaki

Hey Teddy,

BTW I forgot to ask you, is there a way to get only confirmed patterns through the method listed in your 5/1 post? As I watch the EA run with the indicator attached I see the confirmation arrows come up on the top right of my chart, but I never see the text from

M_DN, M_UP, M_REV_DN, M_REV_UP get displayed on the screen top left. I would think logically this is what should be happening, then I could test for the text string to find only confirmed patterns.

Thanks.

Tai

11.07.2009 05:33 tsheppard
sxTed wrote:

Tai,

In Candlestickers rating system the High reliability patterns are mostly comprised of between 3 to 5 candles in a pattern. The algorythm in function Pattern() first test's for patterns comprised of 5 candles, then 4 ... down to 1. Patterns comprised of 2 or 3 candles have been detected quite often by "Candle Patterns" Custom Indicator. In Note 1 of the preamble to my program I stated that "While testing, the indicator has not encountered patterns comprised of 4 or 5 candles...".

You say "For instance I ran EUR/USD on 15 minute chart for an entire year looking only for High Reliability patterns, and it found 1 for an entire year. ONE. " Results do vary from broker to broker and from real and demo charts but I found the following on EURUSD,M15 during the last three weeks on Trading Server: UWC-Demo.com of Broker: United World Capital Ltd at www.uwcfx.com (in Inputs opposite variable "MaxBarsToScanForPatterns" set value to "55000" (or greater)).

2009.06.18 09:00 Medium Bullish Engulfing

2009.06.19 16:45 High Bearish Dark Cloud Cover

2009.06.23 10:45 High Bearish Dark Cloud Cover

2009.06.23 14:45 High Bearish Dark Cloud Cover (and the market climbed a further 130 traditional pips)

2009.06.24 03:45 Medium Bullish Harami

2009.06.25 09:45 High Bearish Dark Cloud Cover

2009.07.03 22:45 High Piercing Line

2009.07.10 20:15 High Bearish Dark Cloud Cover

As Steve Nison in his book "Japanes Candlestick Charting Techniques" pointed out "Candlestick charts are flexible, because candlestick charts can be used alone or in combination with other technical analysis techniques. A significant advantage attributed to candlestick charting techniques is that these techniques can be used in addition to, not instead of, other technical tools".

Some patterns are more suitable for certain instruments, the "FTSE" futures will be populated with lots of "Doji's" with only one or two yielding good results, yet a "Doji" with small legs appears on the "DJIA" and causes a stampede in the opposite direction to the current trend.

I tested the profitability of individual patterns without much success, however in combination of reversal patterns hitting a moving average then the picture looks rosier, also a "White Marubozu" or "Long White Candle" followed by a "Black Marubozu" or "Long Black Candle", independant of other indicators, is usually a good reversal sign, also single candle patterns like "Spinning Top's" and "High Wave's".

The values for Candle comparisons "iVeryNear" and "iVerySmallBody" were estimated and after scrutiny are working. The patterns are heavily reliant on sizes for the candle body and shadows (tails) and by inspection represent the different sizes "Marubozu", "Candle" and "Small Candle".

Hey Ted,

Thanks so much for the thoughtful and informative response.

First of all let me apologize, when I said it only found one in a year that was misleading, what actually happened was there was only one trade made in a year, which was partly my fault as I found out afterwards.

So to set the record straight, what I did was to set a print function to print out the candle pattern to the journal, then I went a scan for all patterns for both bull and bear.

For EUR/USD for the time period of 7/1/2008 - 7/1/2009 there were just over 7600 buy/sell signals thats an average of over 25 signals a day if my math is right, which is awesome for sure. If we could isolate just 5 or 6 of those per day that could generate 25 pips each thats over 3600 pips a month. Thats a pretty good living right there.

HR signals did not fair as well, with only 96 signals total both bull and bear for the year.

So I guess the answer will need to be as you described, adding other indicators. I was really hoping for this to be a price action EA that would use only candlesticks and maybe some pivots or fibo levels to create a true live action setting.

Most every indicator out there lags to some degree because they are made up of mostly moving averages. The only true non-lagging indicator is price itself. If we can look at price alone and make a determination by what we see in the candles we can be on the leading side of nearly every move we make in the market. Of course not all will be winners, but by working with price alone, you're at the beginning of the move, not waiting till some indicator tells you there's movement, and oh by the way, it was 3 bars ago.

Anyway, this was the reason I chose Candle Patterns to work with because it's the only thing I've seen that actually works directly with price in a meaningful way. Yes it's an indicator, but it tells us directly whats happening with price, not an average of price.

Anyway, thanks for the help Teddy, I appreciate you taking the time, if I discover the Holy Grail I'll send you 20% :)

Have a good one!

Tai

11.07.2009 05:15 tsheppard

Tai,

In Candlestickers rating system the High reliability patterns are mostly comprised of between 3 to 5 candles in a pattern. The algorythm in function Pattern() first test's for patterns comprised of 5 candles, then 4 ... down to 1. Patterns comprised of 2 or 3 candles have been detected quite often by "Candle Patterns" Custom Indicator. In Note 1 of the preamble to my program I stated that "While testing, the indicator has not encountered patterns comprised of 4 or 5 candles...".

You say "For instance I ran EUR/USD on 15 minute chart for an entire year looking only for High Reliability patterns, and it found 1 for an entire year. ONE. " Results do vary from broker to broker and from real and demo charts but I found the following on EURUSD,M15 during the last three weeks on Trading Server: UWC-Demo.com of Broker: United World Capital Ltd at www.uwcfx.com (in Inputs opposite variable "MaxBarsToScanForPatterns" set value to "55000" (or greater)).

2009.06.18 09:00 Medium Bullish Engulfing

2009.06.19 16:45 High Bearish Dark Cloud Cover

2009.06.23 10:45 High Bearish Dark Cloud Cover

2009.06.23 14:45 High Bearish Dark Cloud Cover (and the market climbed a further 130 traditional pips)

2009.06.24 03:45 Medium Bullish Harami

2009.06.25 09:45 High Bearish Dark Cloud Cover

2009.07.03 22:45 High Piercing Line

2009.07.10 20:15 High Bearish Dark Cloud Cover

As Steve Nison in his book "Japanes Candlestick Charting Techniques" pointed out "Candlestick charts are flexible, because candlestick charts can be used alone or in combination with other technical analysis techniques. A significant advantage attributed to candlestick charting techniques is that these techniques can be used in addition to, not instead of, other technical tools".

Some patterns are more suitable for certain instruments, the "FTSE" futures will be populated with lots of "Doji's" with only one or two yielding good results, yet a "Doji" with small legs appears on the "DJIA" and causes a stampede in the opposite direction to the current trend.

I tested the profitability of individual patterns without much success, however in combination of reversal patterns hitting a moving average then the picture looks rosier, also a "White Marubozu" or "Long White Candle" followed by a "Black Marubozu" or "Long Black Candle", independant of other indicators, is usually a good reversal sign, also single candle patterns like "Spinning Top's" and "High Wave's".

The values for Candle comparisons "iVeryNear" and "iVerySmallBody" were estimated and after scrutiny are working. The patterns are heavily reliant on sizes for the candle body and shadows (tails) and by inspection represent the different sizes "Marubozu", "Candle" and "Small Candle".

11.07.2009 03:16 sxTed