MQL4 - automated forex trading   /  

Code Base

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

Library of programs in the new MQL5
Prepare for the Championship

This library is for
MetaTrader 4
Download MT 4 - 5.5 Mb

Mobile trading!
Buy a license and be mobile in your trading!

Name:
Candle Patterns [ ru ]
Author: sxTed (2008.12.16 08:18)
Rating: 3
Downloaded: 11297
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.

32 comments: 1 2 3 4   To post a new comment, please log in or register

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
sxTed wrote:

Tai, be aware that the name of the candle pattern as well as the message "Buy" or "Sell" is displayed at times, see symbolic constants #define M_BUY and #define M_SELL

Take care, Teddy.

Yeah I saw that thanks.

I'm wondering if there might be an issue. I entered all the patterns into into my EA separated into sections High, Medium, Low reliability as per CandleStickers rating system, this way it's very simple to comment out a specific pattern that you don't want processed.

This works great except that hardly any patterns outside the low reliability indecision patterns are ever found. 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. I know this can't be right, I see some of these patterns on a daily basis trading manually so I know they aren't this rare to turn up only once in a year.

So I then ran it again looking for High/Medium reliability ... 6 trades in a year. They were all winners which is awesome, but obviously we'll not be able to eat on only 6 trades a year.

I did this over an over until finally adding all the patterns, not until all the low rel indecision patterns were searched did we actually start to get trades, but of course, they aren't smart trades and about 60% of them lose money on SL.

I guess my question is ... what results have you experienced with High Reliability patterns, how many, how often etc, and is it possible there's something awry in the pattern matching that is filtering out H/R patterns, I can't see anything, but I thought I should bring it up just in case.

Thanks again Teddy for your responses, I appreciate the help :)

Tai

10.07.2009 01:29 tsheppard

Tai, be aware that the name of the candle pattern as well as the message "Buy" or "Sell" is displayed at times, see symbolic constants #define M_BUY and #define M_SELL

Take care, Teddy.

09.07.2009 22:50 sxTed
sxTed wrote:

Hi Tai,

Please look at my comment dated 05.01.2009 which could be a solution where your expert would run with Candle Patterns indicator on the same chart.

Thank you for liking the indicator. Take care, Teddy.

Thanks Teddy, you're the man!

Tai

09.07.2009 01:30 tsheppard

Hi Tai,

Please look at my comment dated 05.01.2009 which could be a solution where your expert would run with Candle Patterns indicator on the same chart.

Thank you for liking the indicator. Take care, Teddy.

08.07.2009 20:11 sxTed

Hi Teddy,

You've done an incredible job on this, amazing really.

I'm currently building an EA based on Ichimoku, and the isolation of specific price action patterns and began the tedious process of writing out all the candles when I remembered your awesome Candle Patterns indicator.

What I'm wondering is if you have lying around somewhere a version of this WITHOUT all the bells and whistles, no audio, text labels, csv files etc. Just the basic patterns configuration, I don't need all the other stuff, just the patterns and a way to have the pattern name or pattern number returned to my EA from the idicator. I want to let the EA make decisions based on specific formations.

I've spent a good deal of time now staring aimlessly at your flawless code, but this is so tightly written that I don't see any way to untangle it to filter out what I have no need for.

Thanks so much again for the incredible work you've done and I hope to hear back from you.

Tai

08.07.2009 02:08 tsheppard

Andrey (mql_fx4), Click on "MetaEditor" -> "MQL Navigator" -> "Files" -> "indicators", click (or double click) on "Candle Patterns.mq4". Click on "Compile".


Either right click on a chart and select "Template" -> "Candle patterns". Or click on "Indicators" -> "Custom" -> "Candle Patterns" and modify the parameter "Inputs" (if required).

25.02.2009 01:12 sxTed
10.06.2009 23:02 sxTed
malmsteen_2002 wrote:

Where's the ex4 file?,,can't use it cos it only provides mq4 file...

there is no((

Forex индикаторы


10.06.2009 16:34 mql_fx4