BREAKOUT - linclund.com

8
IN COLLABORATION WITH: ANALYSTS: JOACHIM NILSSON, MICHAL NOWAK & VICTOR TIET SUPERVISORS: JOHAN HAMMARSTEDT & JAN MUELLER 2020-05-17 TRADING & QUANTITATIVE RESEARCH REPORT BREAKOUT Analyzing sentiment changes in the forex market by observing price breakouts

Transcript of BREAKOUT - linclund.com

Page 1: BREAKOUT - linclund.com

IN COLLABORATION WITH:

ANALYSTS: JOACHIM NILSSON, MICHAL NOWAK & VICTOR TIET

SUPERVISORS: JOHAN HAMMARSTEDT & JAN MUELLER2020-05-17

TRADING & QUANTITATIVE RESEARCH REPORT

BREAKOUTAnalyzing sentiment changes in the forex market by

observing price breakouts

Page 2: BREAKOUT - linclund.com

INTRODUCTION & THEORY

Introduction

Cup and Handle, Double Top and Head and Shoulders. These are all

names of classic trading patterns in technical analysis, a methodology

which focuses on statistical methods, trends and previous patterns to

determine a future price movement of a financial derivative. This

differs from fundamental analysis, where the decision is instead derived

from financial and economic analysis. Thought to have originated several

hundred years ago by merchants, this methodology was primarily used to

predict prices of basic commodities. Today, technical analysis is a

commonly used tool by traders, individuals who buy and sell financial

assets for the short term, as it is primarily used to predict short term price

movements. It is also used by many investors, hedge fund and retail, as a

complement to their fundamental analysis. With the rise of new

technology in the form of increased computational capacity, it has

become easier for traders to detect complex patterns in the market and

execute strategies accordingly with the help of algorithmic trading, thus

marking a potential paradigm shift in capital management.

This paper aims to explore a common phenomenon in technical analysis

known as a breakout, where the price of an underlying asset breaks

through a line of support or resistance, hence breaking a trend pattern

that has been formed during a consolidation. This will be done by analyzing

the historical price of a currency pair and then identifying the

consolidations and breakouts with the help of different data analysis tools

(see Figure 1).

Theory

As stated above, a breakout is generally defined as a price movement

breaking through an area of support or resistance. These areas often form

during a consolidation period where the price oscillates within a price

“corridor”, a consequence of market indecisiveness. In this case the

areas are the edges of the corridor, in which the area of support is the

bottom edge and the resistance is the above. Breakouts often occur when

market sentiment changes, from indecisiveness to a bias, hence resulting

in an either bullish or bearish price movement. As it is frequently

followed by many traders as an opportunity to take advantage of a trend

reversal, a breakout can often be volatile and uncertain. In general, a

common strategy for trading consolidation breakouts is to go long when

the area of resistance is breached (see Figure 2a) and short when vice

versa (see Figure 2b). In this paper a breakout is defined when the price

moves 1 pip outside of the consolidation range. The range is the width of the

corridor, from a price perspective, and should be between 8-15 pips. The

area of resistance and support, each 2 pips wide, is included in the range

as edges and, in order to get the oscillation pattern, the price should have

entered each edge twice during the minimum 3 hour long consolidation.

A pip, which is an acronym for “percentage in point”, is defined as the

fourth decimal of a currency ratio in the forex market. Furthermore, there

should be a minimum of 30 minutes between two registered price

movements in the same edge, starting from the last 5-minute candlestick

bar of the first registration and ending on the first bar in the second

registration. These requirements imply that the price should have

oscillated between the edges of the consolidation range in such a way that

it covers as much of the consolidation corridor as possible. The last

criterion specifically ensures that the price throughout the consolidation

does not stay in the top or bottom of the range, but rather tests both

extremes at different times. All identified consolidations should also end

before the weekend as trading is closed during that time.

To ensure more balance of the price movements in the corridor the

following requirements were also implemented:

• When the price touches any of the edges it should be a 30 minute

extreme point.

• After the second price registration at any edge the price should

revert back to the middle of the price range.

LINC – Lund University Finance Society | Var vänlig ta del av våra ansvarsbegränsningar i slutet av rapporten 1

Figure 1. Multiple consolidations* and breakouts during a trading

session.

Figure 2b. A consolidation followed by a breakout

resulting in a bearish price movement.

Figure 2a. A consolidation followed by a breakout

resulting in a bullish price movement.

The first requirement specifically ensures that the consolidation period

cannot begin with the price coming from an upward or downward

price movement., hence avoiding retracements. A retracement takes place

when the price does a temporary price reversal in a larger trend. A simple

illustration of this is when the price moves like a "staircase" going either up

or down with the retracements taking place when the price goes flat.

Retracements often have a trading bias as they are expected to follow

a larger trend and should therefore in this case not be equated with a

consolidation period. The second and third requirements simply state that

the price movement should cover the consolidation corridor in a balanced

way. For example when splitting the corridor into halves the price

movements in the second half of the consolidation period should be

mostly similar to the first half of the period.

• When the price touches the second edge for the first time the

price should revert back, at least 80% of the difference between

the highest and lowest values in the range, from the touch.

*Pink Line: Upper edge upper bound, Red Line: Upper edge lower bound, Blue Line: Lower edge upper bound and Yellow Line: Lower edge lower bound..

Page 3: BREAKOUT - linclund.com

METHOD & STRATEGY

Method

In order to execute code and find consolidations, historical data was used. In this paper the datasets that was used consisted of a combination of several

different currency pairs like EUR/CHF, AUD/USD, EUR/USD etc. The price rates ranged everywhere from the 1st of January 2017 to the 4th of

April 2019, but the majority of the data was from the period between 1st of November 2018 to the 14th of April 2019. The data consisted of 5 minute

datapoints which contained the opening and closing price but also the highest and lowest price rate reached during the 5 minute period.

LINC – Lund University Finance Society | Var vänlig ta del av våra ansvarsbegränsningar i slutet av rapporten 2

Figure 3. A flow chart over the algorithm

used in the project.

To identify consolidation periods in the dataset, with the definition as a template, an algorithm was written in Python. A flowchart of the execution of the

program is presented in Figure 3. As depicted in the flowchart, a 3 hour interval is first collected from the dataset. The difference between the maximum

and minimum price in the 3 hour interval is then checked, as the biggest allowed price range according to the definition is 15 pips. If the difference is

below or equal to 15 pips, the edge requirements get tested (i.e. there should be at least two touches of each edge with at least 30 min between each touch)

in every possible way. All edge combinations are then checked with the objective of finding a suitable consolidation range between 8-15 pips.

Lastly the interval is checked to make sure that the price movements during the consolidation are well balanced. This is done by verifying that the

price reverts back to the middle of the consolidation price range after the second touch of each edge. Furthermore, it is checked whether the price

reverts back 80% of the difference between the highest and lowest price in the range after the first touch of the second edge. If all of these requirements are

satisfied, a breakout is found with the simple demand that the price has to move 1 pip outside the established consolidation price range. If not approved,

the 3 hour interval is expanded with 5 minutes and rechecked until it either qualifies or the difference between the highest and lowest price rate during the

interval gets bigger than 15 pips.

Strategy

Three different strategies was implemented in order to trade the

identified breakout.

1 to 1 odds.

• Distance to stop loss and target is the same.

2 to 1 odds.

• Distance to target is 2 times larger than to stop loss.

4 to 1 odds.

• Distance to target is 4 times larger than to stop loss.

The distance is, in this case, the gap between stop loss/target and

breakout price. The distance to the stop loss is equal for all three

strategies and is calculated as the difference between the highest

and lowest price rate during the consolidation period.

Furthermore, as there are two different possible outcomes from

a breakout (bullish/long or bearish/short), the stop loss had to

placed the opposite side from the breakout. In the end, when

the price reaches either target or stop loss (which one is

determined by the one that comes first) the trade is closed and

profit or loss is registered (se Figure 4a and 4b).

Figure 4b. Same breakout as in Figure 4a, but with 2 to 1

odds implemented. This time, the trade fails.

Figure 4a. A successful trade with 1 to 1 odds implemented.

Page 4: BREAKOUT - linclund.com

LINC – Lund University Finance Society | Var vänlig ta del av våra ansvarsbegränsningar i slutet av rapporten 3

RESULTS & DISCUSSION

The data that was used in this paper consisted of six different currency pairs (see Figure 5). All of them, except EUR/USD,

were from the period of October 2018 to April 2019 while the data of EUR/USD spanned longer from 2017 to 2019. This had to

be taken into consideration when comparing the returns from the different currency pairs. Note the rather inconclusive results of

the 1 to 1 odds strategy but simultaneously the significant return in the 4 to 1 odds strategy. Furthermore, in order to calculate the

return, the pip profit from each trade had to be converted into the base currency in the currency pair, i.e. euro for EUR/USD.

This was done using pip value, which is the value of 1 pip when the amount of invested capital is taken into consideration. For

this paper we choose the initial trading capital to be 1 mini-lot, that is 10 000 units of the base currency. It should be noted that

the initial trading capital was the same for all three strategies, which from a risk management perspective is not ideal as each

strategy has different risk, hence the invested capital should be adjusted to the risk level of each strategy. However, for the sole

purpose of calculating the cumulative return in percentage, this can be neglected.

Figure 5. Total cumulative return calculated for every currency pair.

Figure 6. Statistics from all of the trades. Figure 7. Statistics from all of the consolidations.

We can see from the statistics over all the trades (see Figure 6) that the win rate for the different strategies decreased as the target

increased (1 to 1 odds vs. 4 to 1 odds). This was quite self-evident as it should be more difficult for the price rate to reach a target if

the distance to the target keeps increasing while the distance to the stop loss stays the same. However, a higher win rate does not

automatically mean that a strategy is superior than another, something that can be observed in the cumulative returns for the

different strategies and the registered total pip profit where 4 to 1 odds is clearly more successful than say 1 to 1 odds. A simple

explanation for this can be found in that the increased distance to the target equates to a greater pip profit which compensates for

the lower win rate. Another observation worth mentioning is the fact that no bias was found when comparing the amount of

registered bullish and bearish breakouts (see Figure 7). Simply stated, there is a roughly 50 % probability of a bullish (or

bearish) breakout to occur after a identified consolidation period. Unlike the win rate, the trade cancellation rate increased as the

target moved further away. This can be explained by the breakouts that occurred right before the weekends and that never reached

the target (or stop loss) before the markets closed, hence when the distance to the target increases so does also the rate of

cancellation.

Page 5: BREAKOUT - linclund.com

LINC – Lund University Finance Society | Var vänlig ta del av våra ansvarsbegränsningar i slutet av rapporten 4

DISCUSSION

After having analysed the data we found some interesting patterns. As we can see in the upper plot of Figure 8, it seems like for the 1 to

1 odds strategy the profitable and non-profitable trades are evenly dispersed over all durations of consolidations. Hence, there does not

seem to be any relation between the length of the consolidation and the likelihood that the trade will be profitable when trading with 1

to 1 odds. However for the two other strategies the profitable trades become less common as the length of the consolidation is

increasing.

Figure 8. Scatterplot of the profit against the length of consolidation of all trade for all three strategies.

Figure 9. Estimated probability distribution of length of consolidation for all the winning and

losing trades for all strategies.

To further analyse this pattern and to get a more clear visualization of this we plotted the distribution of length of consolidation for the

winning and losing trades separately for all strategies in Figure 9. However as we can see the distributions of winning and losing trades

are very similar, which indicates that there is no notable relation between the length of consolidation and the probability that a trade will

be profitable. To be even more sure we did a Kruskal-Wallis test to see if we could find a statistically significant bias regarding length of

consolidation (how Kruskal-Wallis works is described more in detail later in the discussion). However the test could not find

a statistically significant bias. It should be added that this does not mean that there is no bias, only that no bias could be find in our

data.

Page 6: BREAKOUT - linclund.com

LINC – Lund University Finance Society | Var vänlig ta del av våra ansvarsbegränsningar i slutet av rapporten 5

DISCUSSION

Figure 10. Estimated probability distribution of pips above consolidation high for all the winning and losing

bullish trades for all strategies.

Another interesting pattern that we found can be seen In Figure 10 where we have plotted the probability distribution of what we call "pips above

high", for both the profitable and non-profitable bullish trades for all three strategies. "Pips above high" is the difference between the highest

measured price going 24 hours back from the start of the consolidation and the highest measured price during the consolidation. As we can see in

the upper plot in Figure 10 the distribution of the profitable and non-profitable trades is roughly the same for the 1 to 1 odds strategy. In contrast, for

the other two strategies the distribution of the winning trades is further to the right than the distribution of the losing trades. This suggest that there

is a relation between "pips above high" and the probability that a trade is profitable.

Before drawing any conclusion from this we need to check if the relation we found is statistically significant. We first observe that none of the

distributions in figure 10 is normally distributed. This means that we need to use a nonparametric test. We choose the Kruskal-Wallis test. What

this test does is testing the null hypothesis that the median of different samples of data is equal. In our case we tested the median of "pips above

high" for the groups winning and losing bullish trades. The test indicated that for the 1 to 4 odds strategy the median of "pips above high" for the

winning trades differ from the median of the losing trades. The p-value of this test were 1.4%, meaning that the probability of getting the result

that we did when the real medians actually is equal is as low as 1.4%. We can therefor say with some confidence that the median of the two

groups differs and that we have a relation between "pips above high" and the probability that a trades is profitable.

As "pips above high" is known before the trade is initialized this could be taken into account when choosing a strategy for a specific trade.

It could be argued that the same pattern should emerge for the opposite case. That is to say a connection between pips below low (difference

between the lowest measured price going 24 hours back from the start of the consolidation and the lowest measured price during the

consolidation ) and win rate of bearish trades. But this connection could not be found.

When the data of the pair USD/SEK was searched for consolidations, none were found. This was traced to the fact that the difference in values

of the two currencies was much larger than any of the other pairs. Hence, the movement in pips was overall greater than for the other currency

pairs. Since our definition of the consolidation has a fixed upper bound of 15 pips, this resulted in no identified consolidations as all

consolidation-like patterns had larger scale.

Page 7: BREAKOUT - linclund.com

LINC – Lund University Finance Society | Var vänlig ta del av våra ansvarsbegränsningar i slutet av rapporten 5

CONCLUSION

Trading a breakout is a common strategy among traders, as it many times results in a predictable and strong price movement. In

order to find a breakout, a consolidation period has to be identified first, thus when the price moves outside the consolidation

range, a breakout will occur.

As seen in the results, there is a big difference in the yield and win rate between the different strategies. While the 1 to 1 odds strategy

boasts the highest win percentage at 51.3 % it also has the lowest return. As we go up in the difference between target and stop-

loss, the win percentage goes down but the yield increases substantially. Our conclusion is that the probability for a successful trade

decreases with increased odds since this requires a long movement in essentially one direction. However, once such a movement

happens the large profit more than makes up for the lower win ratio. Since the selection of the odds for the three strategies has not

been based on any involved analysis, it is possible that the profitability of the strategies could be further boosted by selecting

different odds.

From the comparison of consolidation lengths and profitability of trades (Figure 8 and 9) we see that length of consolidation did

not have a notable effect on profitability.

We investigated whether the difference between the highest measured price in the 24 hour period preceding the consolidation and

the highest price in the consolidation had any effect on the outcome of the bullish trades (Figure 9). We found that it does have an

effect on the high-odds strategies, specially the 1 to 4 odds strategy where we could observe a statistically significant connection.

There was no such effect to be found in the opposite case (impact of lowest measured prices and bearish trades). The reason for

this is not known.

As seen in the results, trading a breakout can yield impressive returns if a consolidation and breakout is correctly identified and a

suitable strategy is used, but in order to completely rule out randomness in the market more testing on historical data has to be

performed. When analyzing all of the trades from the different strategies, some interesting connections were also found which can

be utilized in the future when implementing more complex trading strategies, but as always more testing has to be done in order to

confirm the correlations found in this paper.

Page 8: BREAKOUT - linclund.com

Research & Analysis

DisclaimerThese analyses, documents and any other information originating from LINC Research & Analysis(Henceforth “LINC R&A”) are created for information purposes only, for general dissipation and are notintended to be advisory. The information in the analysis is based on sources, data and persons whichLINC R&A believes to be reliable. LINC R&A can never guarantee the accuracy of the information. Theforward-looking information found in this analysis are based on assumptions about the future, and aretherefore uncertain by nature and using information found in the analysis should therefore be done withcare. Furthermore, LINC R&A can never guarantee that the projections and forward-looking statementswill be fulfilled to any extent. This means that any investment decisions based on information from LINCR&A, any employee or person related to LINC R&A are to be regarded to be made independently by theinvestor. These analyses, documents and any other information derived from LINC R&A is intended to beone of several tools involved in investment decisions regarding all forms of investments regardless of thetype of investment involved. Investors are urged to supplement with additional relevant data andinformation, as well as consulting a financial adviser prior to any investment decision. LINC R&Adisclaims all liability for any loss or damage of any kind that may be based on the use of analyzes,documents and any other information derived from LINC R&A.

Conflicts of interest and impartialityTo ensure LINC R&A’s independence, LINC R&A has established compliance rules for analysts. Inaddition, all analysts have signed an agreement in which they are required to report any and all conflictsof interest. These terms have been designed to ensure that COMMISSION DELEGATED REGULATION (EU)2016/958 of 9 March 2016, supplementing Regulation (EU) No 596/2014 of the European Parliament andof the Council with regard to regulatory technical standards for the technical arrangements for objectivepresentation of investment recommendations or other information recommending or suggesting aninvestment strategy and for disclosure of particular interests or indications of conflicts of interest.

OtherThis analysis is copyright protected by law © BÖRSGRUPPEN VID LUNDS UNIVERSITET (1991-2020).Sharing, dissemination or equivalent action to a third party is permitted provided that the analysis isshared unchanged.

Disclaimer