The Harami Pattern. Does it Engender a New Trend?
29 December 2021In the proposed study, we will research the Harami graphical pattern.
In his book "Japanese Candlestick Charting Techniques", Steve Nison characterizes this pattern as follows:
"The Harami model is a candlestick with a small body that is within a relatively big body of the preceding candlestick. 'Harami' is an ancient Japanese word which means 'pregnant'. A big candlestick is a 'mother', and a small one is a 'child' or 'fetus.' "
This pattern is believed to be reversal.
We will check if it is true by using a large volume of historical data.
The Harami pattern belongs to trend reversal patterns.
The Harami model consists of two candlesticks.
The first candlestick, which is rather big, corresponds to the current trend. That is, if the trend is upward, then this candlestick will be white. And if the market was falling before, then the first candlestick of the model will be black.
The second candlestick is small, filled with the opposite color. The necessary condition is for this candlestick to be completely absorbed by the first one. That is, to be inside its body.
The first candlestick is "pregnant", and the second small one is a child inside it, or a "fetus". The result of the "delivery" will be appearance of a new trend.
There are two types of Harami: bullish (formed on a downtrend) and bearish (formed on an uptrend) (Fig. 1).
Bullish Harami foreshadows growth of the market, and when it appears, you need to consider placing a buy-to-open order.
For bearish Harami it's the exact opposite: the trend after its appearance is predicted to be downward, and a sell-to open order should be placed.
Event Detection Method
The pattern on the charts will be defined as follows (for bullish Harami):
- Identify a downtrend (we determine gradually decreasing lows of several candlesticks):
Low3 < Low4
Low2 < Low3
- We find a combination of two candlesticks, the first one (Black) is relatively big, it corresponds to the current trend. The second candlestick (white) is small, filled with the opposite color. The necessary condition is for this candlestick to be completely absorbed by the first one, i.e. be inside its body. The shadows of the long candlestick should cover the shadows of the small one:
Close1 > Open1 (bullish Harami)
Close2 < Open2 (the second bearish Harami candlestick)
Low2 <= Low1 (Harami is completely absorbed by candlestick 2)
High2 > High1 (Harami is completely absorbed by candlestick 2)
Close2 <= Open1 (the Harami body is completely absorbed by candlestick 2)
Open2 > Close1 (the Harami body is completely absorbed by candlestick 2)
PP < PP Max(the overlap percentage of the bodies should be less than the set value: the smaller the Harami body, the stronger the signal)
- A buy-to-sell order can be placed once the pattern has been formed.
The formation of bullish Harami is described above. For bearish Harami, the situation is mirrored.
The signals generated by the Harami model will be tested on a large volume of historical data of various financial instruments and in the context of two timeframes.
In addition, the Harami model will be tested in three of its combinations, namely by adjusting the conventional parameter, the overlap percentage of the candlesticks. For convenience, let us call it PP.
The overlap value of the PP is calculated with the following formula:
PP = (High1 - Low1)) * 100 / S
where S = Max(Open2, Close2) – Min(Open2, Close2)
Visually, the Harami model with the above parameter looks as follows (Fig.2):
The figure shows a bullish Harami formed on a downtrend, the situation is mirrored for an uptrend.
What does the conventional Harami parameter mean?
- The PP characterizes the size of the candlesticks relative to each other. The smaller the OP of the candlesticks, the shorter the body of the "fetus" (white candlesticks in Fig. 2) compared to the body of the "mother" (black candlesticks in Fig. 2) and the Harami pattern is even more pronounced.
Now let us discuss the conditions for opening and closing a trading position.
Conditions for opening a trading position.
After the pattern is formed, a position is placed on the open of the next candlestick:
- On bullish Harami – buy;
- On bearish Harami – sale.
Closing a position:
In all situations, the lifetime of the position is 5 or 10 candlesticks.
Next, we will determine the list of financial instruments and their timeframes on which the trading signal will be tested. This sample will be presented by:
- 23 currency pairs (Forex);
- 6 commodity futures (Commodities);
- 2 stock indices (Indices);
- 30 stocks included in Dow30 (Stocks).
Timeframes used:
- H1 (1 hour) - the history of 5 years,
- D1 (1 day) - the history of 10 years.
The sample is 2,124,495 values.
After defining all the conditions and setting the necessary parameters, let us start testing!
Analysis of the results obtained
The results are first estimated by the size of the sample obtained:
For a timeframe of 1 hour (H1):
Type of financial instruments | Number of candlesticks | Number of events |
Forex | 994755 | 39510 |
Commodities | 191850 | 7425 |
Indices | 87600 | 3621 |
Stocks | 628011 | 19604 |
For a daily timeframe (D1):
Type of financial instruments | Number of candlesticks | Number of events |
Forex | 83950 | 4082 |
Commodities | 21900 | 915 |
Indices | 7300 | 272 |
Stocks | 109129 | 3860 |
Total: 2,124,495 candlesticks and 79,289 events (Harami patterns).
Next, let us look at the share of Harami in the total number of initial candlesticks in the aggregate for two timeframes:
Harami Parameters | Forex | Commodities | Indices | Stocks | Average |
PP 25 | 0.35 | 0.36 | 0.38 | 0.29 | 0.32 |
PP 50 | 0.71 | 0.68 | 0.73 | 0.57 | 0.64 |
PP 75 | 0.96 | 0.86 | 0.95 | 0.73 | 0.84 |
Based on the results of the grouping, it can be concluded that regardless of the type of financial instruments, the distribution of Harami is approximately the same, namely:
- Harami with the parameters of PP 25 ranged from 0.29 to 0.38% of the total number of candlesticks;
- Harami with the parameters of PP 50 ranged from 0.57 to 0.73% of the total number of candlesticks;
- Harami with the parameters of PP 75 ranged from 0.73 to 0.96% of the total number of candlesticks.
Also note that the more expressed the Harami pattern, the smaller its share in the total number of candlesticks.
Now let us have a look at the outcome of processing trading signals obtained as a result of the generated Harami.
The results will be evaluated according to two criteria:
- Momentum (m) – reflects the average percentage increment of quotations of financial instruments at the time of closing positions, in %. A positive value of the momentum indicates the profitability of signal processing, a negative value indicates running at a loss.
- SPP – the Share of Profitable Positions, %.
Momentum in % and the SPP in % in terms of the periods of holding positions, timeframes and Harami parameters:
Indicator | 5th candlestick | 10th candlestick | H1 | D1 | PP 25 | PP 50 | PP 75 |
m | -0.03 | -0.04 | -0.003 | -0.07 | -0.06 | -0.02 | -0.03 |
SPP | 49.5 | 49.4 | 50.1 | 48.8 | 49.5 | 49.4 | 49.4 |
Momentum in % and the SPP in % by types of financial instruments:
Indicator | Forex | Commodities | Indices | Stocks |
m | 0.01 | -0.13 | 0.06 | -0.06 |
SPP | 49.3 | 48.2 | 50.3 | 49.7 |
9 out of 11 average values of the momentum parameters are negative.
At the same time, some features can be highlighted.
To do this, we will visually present the results in the form of momentum distribution (m) relative to each parameter under consideration (position retention period, timeframe, Harami parameters (PP), type of financial instruments):
The diagrams above represent the distribution of momentum depending on the considered parameters. Each diagram consists of two parts: a "box" and "tails" or "whiskers". 50% of the observed values are placed in the box, the remaining 50% are represented by tails. The end of the lower tail represents the smallest of the observed values, the end of the upper tail represents the largest. The cross shows the average value.
The analysis of the results allows us to make the following preliminary conclusions:
- fixing a position on the 5th candlestick is slightly less unprofitable compared to fixing on the 10th candlestick;
- the average value of the momentum on the hourly timeframe is higher than on the daily one, which indicates less loss-making performance of the signal on the hourly charts;
- the momentums are approximately the same at different values of the conventional Harami parameter;
- the greatest momentum among financial instruments is noted for Indices.
Let us look at the results in the context of the following parameters: time of holding positions, timeframes, the Harami parameter (overlap percentage) and types of financial instruments.
Let us use the following symbols:
"H1 / 5" – closing a position on the 5th candlestick when working on a timeframe of 1 hour;
"H1 / 10" – closing a position on the 10th candlestick when working on a timeframe of 1 hour;
"D1 / 5" – closing a position on the 5th candlestick when working on a timeframe of 1 day;
"D1 / 10" – closing a position on the 10th candlestick when working on a timeframe of 1 day;
SPP – the Share of Profitable Positions, %.
OP - the Overlap Percentage, %;
The number of Harami, Momentum in %, the share of profitable positions in % in terms of the periods of holding positions, timeframes and types of financial instruments with an overlap percentage of less than 25
PP 25 | Indicator | Stocks | Indices | Commodities | Forex | All |
H1 / 5 | Quantity | 3483 | 655 | 1390 | 6683 | 12211 |
Momentum | -0.019 | 0.003 | -0.099 | 0.004 | -0.028 | |
SPP | 50.7 | 51.9 | 48.9 | 50.8 | 50.6 | |
H1 / 10 | Quantity | 3482 | 655 | 1389 | 6683 | 12209 |
Momentum | -0.051 | 0.033 | 0.009 | 0.004 | -0.001 | |
SPP | 48.7 | 53.4 | 51.5 | 51.0 | 50.0 | |
D1 / 5 | Quantity | 784 | 59 | 189 | 850 | 1882 |
Momentum | -0.096 | 0.155 | -0.333 | -0.021 | -0.074 | |
SPP | 50.0 | 46.9 | 44.1 | 48.8 | 48.9 | |
D1 / 10 | Quantity | 783 | 59 | 189 | 848 | 1879 |
Momentum | -0.215 | 0.027 | -0.479 | 0.074 | -0.148 | |
SPP | 49.5 | 50.1 | 46.7 | 47.7 | 48.6 |
The number of Harami, Momentum in %, the share of profitable positions in % in terms of the periods of holding positions, timeframes and types of financial instruments with an overlap percentage of less than 50
PP 50 | Indicator | Stocks | Indices | Commodities | Forex | All |
H1 / 5 | Quantity | 6983 | 1288 | 2668 | 13936 | 24875 |
Momentum | 0.023 | 0.009 | -0.057 | 0.001 | -0.006 | |
SPP | 50.3 | 52.4 | 48.9 | 50.1 | 50.2 | |
H1 / 10 | Quantity | 6982 | 1288 | 2667 | 13935 | 24872 |
Momentum | 0.017 | 0.015 | -0.020 | 0.001 | 0.003 | |
SPP | 49.6 | 50.8 | 49.5 | 50.2 | 49.8 | |
D1 / 5 | Quantity | 1393 | 97 | 319 | 1423 | 3232 |
Momentum | -0.053 | 0.152 | -0.110 | -0.036 | -0.012 | |
SPP | 48.8 | 47.6 | 47.5 | 47.9 | 48.3 | |
D1 / 10 | Quantity | 1392 | 97 | 319 | 1420 | 3228 |
Momentum | -0.083 | 0.065 | -0.148 | 0.044 | -0.031 | |
SPP | 50.5 | 47.8 | 47.5 | 48.5 | 49.4 |
The number of Harami, Momentum in %, the share of profitable positions in % in terms of the periods of holding positions, timeframes and types of financial instruments with an overlap percentage of less than 75
PP 75 | Indicator | Stocks | Indices | Commodities | Forex | All |
H1 / 5 | Quantity | 9138 | 1678 | 3367 | 18891 | 33074 |
Momentum | 0.018 | 0.005 | -0.050 | 0.001 | -0.007 | |
SPP | 50.3 | 52.2 | 48.7 | 49.9 | 50.0 | |
H1 / 10 | Quantity | 9136 | 1678 | 3366 | 18889 | 33069 |
Momentum | 0.008 | -0.007 | 0.012 | 0.003 | 0.004 | |
SPP | 49.4 | 50.1 | 49.6 | 49.9 | 49.6 | |
D1 / 5 | Quantity | 1683 | 116 | 407 | 1809 | 4015 |
Momentum | -0.071 | 0.187 | -0.198 | -0.020 | -0.026 | |
SPP | 49.3 | 49.9 | 48.0 | 48.2 | 48.8 | |
D1 / 10 | Quantity | 1682 | 116 | 407 | 1806 | 4011 |
Momentum | -0.167 | 0.128 | -0.075 | 0.011 | -0.026 | |
SPP | 49.6 | 50.3 | 47.7 | 48.7 | 49.1 |
Let us summarize the results obtained using diagrams:
The results obtained allow us to make the following conclusions.
The largest momentum of 0.004% is shown by signals generated by the Harami pattern on the timeframe of 1 hour and with the Harami parameters se to the PP being less than 75% and fixation of the position at the 10th candlestick.
In general, the momentum generated by the signal of the Harami model is insignificant, regardless of the degree of expression of the model itself.
Summing up, we can conclude that the signal of the Harami pattern does not bring profit in the generally accepted interpretation.
The influence of the Harami pattern on the market has not been established.
Detailed results are presented in the appendix:
Comments
4