Popular Posts

Editor'S Choice - 2019

Exploring the patterns of Price Action patterns

Hello, colleagues forex traders!

Recently, traders shared the observation that Price Action candlestick patterns work out with different probability depending on the day of the week on which they were formed. And in today's lesson we will test this idea with mql4. In the course of our study, I will introduce you to working with candles and candle patterns, and also teach you how to output information to a separate .csv file. This file is easy to open in Excel, so we will analyze it in it. We will build various charts and in every possible way visualize the information received, such as: the best profit / loss ratio, the distribution of transactions by day / month, and many other patterns.

Those who are not interested in the technical side of solving the problem can immediately go to the results of the revealed patterns - they definitely deserve attention.

Analysis objectives

So, the purpose of the analysis is to study the effectiveness of candle patterns on history, and also to reveal a correlation between their profitability and the day of the week or month in which these patterns arose. We need statistics for each pattern for each currency pair on the H1-D1 timeframes according to the following parameters:

- the optimal ratio of stop loss to take profit;

- distribution of transactions by day of the week;

- distribution of transactions by day of the month;

- distribution of transactions by months of the year.

We will explore the following Price Action patterns:

doji, takeover, inner bar, pin bar

Programming Advisor

Analysis tools

Naturally, our main tools for obtaining statistics are the MetaTrader4 terminal and the code editor. We will also use excel to analyze the results.

At the same time, we will not use candle patterns just like that, we need to consider them in the context of the current situation, namely: the pattern should be based on the level and the input should be in the direction of the current trend. To determine the trend everywhere and everywhere we will use a simple moving average with a period of 50. If the price is above it, the trend is upward, and vice versa for a downtrend.

The automatic construction of adequate levels on the chart is not an easy task and in itself involves a whole study of the effectiveness of various approaches, as well as for determining a trend. Our task now is not to write a quality adviser for earnings, but simply to obtain suitable statistics. To determine the levels, we will use the simplest of the options - fractals. We will look for pairs of fractals at approximately the same level with an error of 10 points in the history of 100 candles. At the same time, it doesn’t matter to us whether it was a fractal up or down - the main thing is that the price reversed. Also, we will provide the ability to disable trend definitions and levels and collect statistics without them.


In total, about 90 thousand transactions were analyzed for 23 currency pairs in three periods for four candlestick patterns from 2000 to today. I can’t even imagine how long such a collection of information would have taken if we had not automated it.

Period H1

Profit Charts:

As can be seen from the graphs, the use of Price Action patterns on the H1 period without additional confirmation in the form of levels and work on the trend will lead to a loss of deposit.

Optimal stop-to-take profit ratio:

As you can see, the optimal ratio of profit to loss is on average 3 to 1 - 4 to 1.

Profitability by days of the week:

The middle of the week is most optimal for entering the doji pattern on the H1 period, while working with the pin bar, the optimal time is from the middle to the end of the week, and when entering the rest of the patterns, the beginning of the week is optimal.

Monthly yield

By the month, I do not see any dependence.

Monthly profitability:

I don’t see any definite correlation by months of the year, except that in the summer months, patterns work out worse. Perhaps this is due to the traditional sluggishness of the markets these months.

On the H1 period, most Price Action patterns do not work without additional confirmation. The only exception is the pin bar, but its yield is too low.

Period H4

Profit Charts:

Strange enough, but the picture on the H4 period is the opposite of what we saw on H1. Now the bulk of the patterns are profitable, except for the pin bar. Nevertheless, you still cannot call such trading successful - additional filtering is still required.

Optimal stop-to-take profit ratio:

The optimal ratio of profit to loss is still on average from 3 to 1 to 4 to 1.

Profitability by days of the week:

For entering the doji pattern and absorption on the H4 period, Monday and Tuesday are most optimal, while working on the pin bar and the inner bar - the middle of the week. Doji pattern also brings good profit on Friday entry.

Monthly yield:

And again, no explicit correlation can be traced.

Monthly profitability:

In the case of H4, there is absolutely no dependence on the effectiveness of patterns on the month of the year.

On the H4 period, most Price Action patterns without additional confirmation bring little profit. Work on the pin bar is generally unsuccessful.

Period D1

Profit Charts:

Trading any of the patterns even without additional filtering, without taking into account levels and trend, on the D1 period is capable of generating stable profit.

Optimal stop-to-take profit ratio:

The optimal ratio of profit to loss has not changed and, as before, averages from 3 to 1 to 4 to 1.

Profitability by days of the week:

The internal bar on the D1 period does not work well on a signal on Friday, and the doji on Wednesday and Thursday. The pin bar is best taken on Wednesday. Absorption fulfills properly on Monday, Wednesday and Thursday.

Monthly yield:

And again, I see no apparent correlation.

Monthly profitability:

The only regularity. which you can track with a stretch when working on D1 relative to the months of the year is that most patterns really work better in the winter season.

On the D1 period, all Price Action patterns can even be profitable even without additional confirmation. But, of course, the best results can be achieved, given the direction of the trend and the main levels on the chart.


  1. Create the advisor described in the lesson.
  2. Get statistics on Price Action patterns taking into account one of the two filters that we thought up at the beginning of the lesson - a level filter or a trend filter.
  3. Try to apply the approach described in the lesson to another market phenomenon that you are currently interested in.


Today we conducted a market research using our knowledge of mql4 programming. It took me two and a half days to collect and analyze the data presented in the article. Such a study without auxiliary tools, like the adviser that we wrote today, would take more than one month, and a large amount of data provides a wide field for errors. We learned that correlation depending on the day of the week really exists, learned how to write a simple level filter, and also use mql4 for market research and excel to process the results. And most importantly, we were convinced of the effectiveness of using candlestick analysis on higher timeframes.

Branch by Price Action

Watch the video: The Magic Of The Engulfing Pattern (November 2019).

Leave Your Comment