Friday, September 15, 2017

Types of chart patterns detected by ATmatix

Just a few words about the way ATmatix detects the patterns and the types it supports.

A chart pattern is nothing more than a unique scheme of price tops and bottoms that appear in a certain finite period of time. Those tops and bottoms are just local maximums and minimums created by the asset price behavior.

To make things short – for instance, double bottom consists of two local minimums divided by a certain minimal number of sessions, in between which there is some local peak (additionally the rise from the lowest bottom to the peak can’t be too small). Of course, it’s not everything, because to talk about a bottom, the pattern must be preceded by a certain descending trend. The trend’s reversal is often - but not always - preceded by the creation of a bottom pattern.

A huge part is played by the parametrization of our pattern recognition algorithms. We will try to put those parameters on the ATmatix website in the future. For instance, we assumed that the rise from the first bottom to the local maximum between two valleys in a bottom pattern should be at least 5% for stocks and at least 2% for indices and futures.

Some patterns form specific shapes, such as triangles, channels, wedges, etc. Those patterns usually have two limiting trendlines. Breakout occurs when a stock price pierces one of those trendlines in a certain direction. For example, a channel pattern consists of two parallel trendlines next to each other (more or less in the same time) in the price chart and the price bounces from the bottom to the top line and back few times. Those trendlines are the breakout levels. Their slope indicates the type of the channel (horizontal, descending or ascending).

ATmatix detects trendlines in the following way: it looks for two points, being local minimums (in case of the lines limiting the pattern from the bottom) or maximums (in case of the lines limiting the pattern from the top) and a third point located between them - which doesn’t have to lie exactly on the line between those two points (there is some tolerance, without it we wouldn’t be able to find many). So, basically to set the line, you need three points. Sometimes, the technical analysts base the trendline using two points only, but there would be many of such lines found, and in our opinion minimum of three point sounds like a reasonable compromise between the large number of signals (sometimes false positives) and the risk of “overlooking” some signal due to a trendline occurrence.

Currently, ATmatix is able to detect price chart pattern types gathered below. The list is going to be gradually developed.

Bottom patterns:
  • Double bottom,
  • Head and shoulders bottom
Top patterns
  • Double top,
  • Head and shoulders top
  • Triangle, symmetrical triangle
  • Descending triangle
  • Ascending triangle
  • Descending channel
  • Ascending channel
  • Horizontal channel
  • Falling wedge
  • Rising wedge
  • Flag
  • Pennant
Broadening formations:
  • Broadening triangle (inverted triangle)
  • Descending broadening triangle (descending inverted triangle)
  • Ascending broadening triangle (ascending inverted triangle)
  • Descending broadening wedge
  • Ascending broadening wedge
Other, special types of patterns or price schemes:
  • Flat base
  • Vertical run up
  • Three rising valleys
  • Support
  • Resistance
  • Uptrend
  • Downtrend

At one point ATmatix was able to detect also a diamond pattern, but it is such a rare occurrence on Warsaw Stock Exchange that we have dropped it (the statistics wouldn’t be realiable at all).

Why does ATmatix not detect so-called candlestick patterns (hammers, shooting stars, etc.)? Firstly of all, we find them not helpful – how can you predict price movement based on one (sic!) or even a few candlesticks on the chart? Maybe it’s realiable for the weekly or longer interval charts. For us, those signals are insignificant with long-term investments – but we would emphasise it – it is just our opinion.

Secondly, many candlestick patterns’ scanners can be found accross the Internet. As we have already mentioned, the creation of ATmatix was sort of a technical and algorithmical challenge for us, slightly bigger than recognizing simple candlestick patterns.

Labels: , , ,

Tuesday, September 12, 2017

The states of the patterns

The price patterns, since they are identified by ATmatix, until reaching the target price (or maybe not) in a certain period of time, may be in a few states (or statuses). All of them are described below.


When ATmatix detects a new pattern, it finds all the local peaks and valleys within the pattern. On the chart, they are marked as green or red arcs. Additionaly, for some types of patterns, those points in charts are connected with a blue dotted line, as it is easier to observe some price movement schemes.

Every pattern has its starting point (the first, the earliest local peak or valley, which could be identified) and the end-point (the last peak or valley). The end-point is also a date of pattern detection, presented in the pattern list view.

At the time of the detection, two levels of breakout are determined (trendlines limiting the pattern from the top and bottom):
  • Downward breakout level (red line)
  • Upward breakout level (green line)

For some linear patterns, where breakout levels are inclined at an angle (triangles, wedges, channels, etc.), some fragments may be marked with solid lines, as it is easier to observe the shape of a pattern; other fragments may be marked with dotted lines.

A solid line is used within a pattern area (between the starting point and the ending point) and the dotted line is just an extension of that line outside the pattern.

It is intresting to notice that for some linear patterns, the breakout lines, inclined at an angle, get closer to each other and converge at some point.
It happens, for instance, in case of triangles or pennants. Then, the intersection point becomes the last moment, where the breakout is possible.
More on breakouts can be found below.

Certain values characteristic of the pattern are calculated immediately after its detection. Those are:
  • The width of the pattern (the number of sessions, or candlesticks in chart, between the starting point and an end-point),
  • The height of the pattern (the percentage difference between the highest and the lowest price value within the pattern),
  • The potential of the pattern (expected percentage price change to the hypothetical target, assuming there were an upward breakout on the day of its detection). After the actual breakout, the potential is calculated again. More information below.
  • Volume trend – the approximation of the turnover volume value from the starting point of the pattern to its endpoint, determined by the linear regression method. The slope of this approximated line may be falling or rising. 
  • Breakout statistics – based on the pattern type and the historical data. Please, note that these statistics may not add up to 100%. 

The statistics are calculated in this way:
  • In case of an upward breakout, the occurrence is counted as the upward breakout (nevermind throwbacks)
  • In case of a downward breakout, the occurrence is counted as the downward breakout (nevermind pullbacks)
  • In case of the upward breakout and then throwback, not reaching the target price, and then downward breakout (or the other way round), the statitistics take into account the move that was stronger after one of the breakouts
  • No breakout at all – often it happens with triangles, whose area is bounded by two approaching lines. Also the time span ATmatix waits for a breakout, is limited.
New, emerging double bottom pattern - example

What time does ATmatix wait for a breakout?

What time does ATmatix wait for a breakout, so that it could detect it and inform about it? It depends on the width of the pattern.

I have already mentioned the triangles or pennants – if the breakout (upward or downward) doesn’t occur within the pattern, then the breakout will not be detected by ATmatix (and will be counted as no breakout, which is why the upward/downward breakout statistics not always add up to 100%). Obviously, the price may choose a particular direction after some time, but it couldn’t be confirmed with a breakout within the pattern area.

It is slightly different for the patterns for which the breakout levels are constant values (for instance double bottom) or lines not expected to cross in the future (i.e. channels, broadening patterns).
Then the breakout time limit since the detection date is: the width of the pattern (number of sessions), but not less than 60 sessions.

For example, for double bottoms 30 sessions wide, we wait 60 sessions for the breakout, and for a double bottom 80 sessions wide, we wait 80 sessions.


If the price approaches an upward breakout level from the bottom, or approaches a downward breakout level from the top, but not pierces it, then ATmatix marks it as “near breakout” (upward or downward). Those occurrences are detected with some tolerance. For the constant (horizontal) levels the tolerance is 2.5% for stocks and 1% for indices/futures.

Some additional conditions apply:
  • For “near upward breakout” – there has to be no decline on that day – the price hasn’t changed or has risen, reaching almost the upward breakout level with the tolerance as mentioned above,
  • For “near downward breakout” – there has to be no rise on that day – the price hasn’t changed or has declined, closing to the downward breakout level with the tolerance as mentioned above.
For example, the stock closing price on a given day must be at least 2.5% below the level of the upward breakout (and it can’t be a declining move). It is a bit different with patterns limited with non-horizontal trendlines. The lines may approach each other (triangles), get farther from each other (broadening patterns) or be parallel (channels). Then the area between the upper and lower trandline – on a given day – is divided into 4 equal parts. If the close price on that day, is in the highest or lowest quarter, and when the above conditions are met (decline, rise or no change), the event “near upward breakout” or “near downward breakout” is detected.

It is essential to notice that if the price will make the breakout with one-day strong movement, then the “near breakout” event may not be detected at all.
That can be also signalled a few times, when the close price of a stock approaches the near breakout area several times during the following sessions.
Those occurrences are marked in the charts with yellow arrows, next to which a close price and an event date are given.

The pattern is close to the upward breakout - example


A breakout happens when the price pierces upper or lower level of the breakout (goes through the trendlines limiting the pattern) on a given day.

The pierce of the constant breakout level is detected in case when the close price exceedes the level even by a penny. In case of linear breakout levels (leaning at some angle) the breakouts are detected with some tolerance.
It happens because the detection of trendlines itself works with a certain tolerance (the lines may not lay perfectly on the three selected points in the chart and the line may in general be based on different point combinations –  give a technical analyst a task to draw the trendline and you’ll know what I mean).
For this reason, piercing the trendline by even the smallest margin, could result in a false breakout – this is why we have set up some tolerance.  Additionaly it’s good to observe the turnover volume on the day of the breakout.

Currently, the tolerance is 0.55% for stocks and 0.32% for indices/ futures. The values were empirically selected as a compromise between large number of possibly false positive signals and their validity.
Usually the price volatility for indices/futures are rather smaller than for stocks, which is why we have decided to divide the list of instruments into two groups, and for each of them some parameters of the pattern scanner are different (the statistics are alsbo calculated separately for stocks and indices/futures).

Other values caltulated after the breakout are:
  • Breakout price – the level, for which the breakout occurred. Price targets are calculated in relation to this level (with a rare exceptions, such as flags and pennants)
  • Potential – the value is updated according to the direction and price of the breakout. It comes right from the target price computed with a measure rule for a given pattern type (explained below). The values less than zero mean that a certain decline is expected
  • Turnover volume on the day of the breakout – this is a relative value, comparing the turnover volume with the average volume from 30 pre-breakout sessions. It is a percentage, where value below 0 shows that the volume was smaller than the average, and the value above 0 means the volume was greater than the average.
The pattern breakout is either a confirmation, or the negation of its validity. In case of the bottom pattern – its confirmation is an upward breakout. If the bottom pattern had a downward breakout then it’s not the bottom any more, because the price has declined even further. It is then an invalidation of such pattern. Similar things happen in the case of top patterns and upward breakouts. However, it doesn’t mean that it is impossible to try to predict the hypothetical target price after such breakout. ATmatix can handle it as well - we will post some information about it in the future.

In case of pattern types commonly regarded as “continuation” patterns, it is hard to speak in terms of pattern confirmation or invalidation, so the breakout direction usually (but not always) means the direction of the preceding price trend is sustained.

The upward breakout - example

The most important data – target prices – are calculated after the breakout. They are presented with the statistical efficiency rates of such breakouts, based on the historical data. Please remember that any historical data does not guarantee you will get the same outcome in the future, but they are a good (and the only reasonable and available) reference when estimating risk of success or failure.

Usually, the target price (we can treat it also as a take profit level after an upward breakout or the purchase opportunity after the downward breakout move is completed) is measured by adding the absolute value of the height of the pattern to the breakout price – there are some exceptions to that rule, but I will dwell on it some other time.

These are the theoretical breakout levels and the description of their measure rules may be found in many books and across the Internet. I emphasize that such theoretical levels are not always specified. The specialized literature often says nothing about calculating targets after the downward breakout for bottom patterns or the upward breakout for top patterns.

The unique feature of ATmatix is calculating one more target level, based only on the historical data of the patterns. Those statistics allow us to compute, first of all, the effectiveness of the theoretical measure rules (the percentage of reaching the targets in the past), and secondly, they allow us to set the target level with a certain value of probability (based on the historical data).

Because it is a highly complex matter, and probably the most important for the application, I will describe it in detail in some other posts.

For now, to sum it up – ATmatix sets the target range of two values (from – to):
  • Theoretical level (and presents the effectiveness of reaching it in the past) – it is not always possible to calculate it – i.e. it is missing in case of the downward breakout form the bottom pattern – as I’ve mentioned it above,
  • The statistical level (reached with certain probability, based on historical data) – this level is always calculated. The exception is when we don’t have the statistics for a certain type of pattern or our data sample is too small. 
A lower level of the two is always given as the first. If any breakout level will be 0 or less – which can happen for the low value stock and the downward breakouts – obviously such value is not presented.

ATmatix also displays the expected percentage price changes related to the breakout price (this is the potential of the price change). Let’s remember that these are the values calculated with the assumption of the perfect trade and there is no guarantee of achieving such results. We often fail to buy the stock exactly at the breakout price and sell them right at the target price, and the profit will be reduced by the transactional costs.

Nevertheless, we know what to expect and whether the transaction made on the basis of one, certain pattern, will be more or less profitable, more or less risky than for some other pattern – thanks to the calculated target levels and statistics gathered by ATmatix.

One more thing – there may be some situations in which the breakout goes one direction, the price doesn’t meet the target price, then there is a throwback (or pullback) and the price breaks out in the opposite direction.
Then we can say the pattern is busted. ATmatix detects only two breakout occurrences in different directions - after the breakout, there may be a reversed one. In such case, the target levels are adjusted accordingly.

In case of the third change of the breakout direction (the third breakout directed opposite to the second breakout and in the same direction as the first one), such situation is not being detected. Those cases (multiple pattern busts) are rather rare, but of course still possible.

Those breakout events are labeled with green or red arrows in the charts, depending on the breakout’s direction. Next to the arrow, you can see the closing price and the breakout date (month and day).


When the asset price after the breakout reaches at least the predicted target range, the pattern is completed. Certain conditions have to be met:
  • After the upward breakout, the high price on a certain day has to reach the value greater than or equal to the lower level of the target range
  • After the downward breakout, the low price on a given day has to reach the value lower than or equal to the upper level of the target range
Sometimes the price target is met on the same day the breakout had occurred (if the price movement was strong enough to reach it and the target level is near the breakout level) and obviously ATmatix signal both events on the same day.

The time limit for meeting the price target, since the day of the pattern detection is currently set to 90 sessions, regardless of the width of the pattern.

In the charts, those occurrences of pattern completion are labeled with blue arrows. Next to the arrow, there is the low or high price on the event day (depending on the direction of the breakout).

The stock price reaches its target after the breakout - example


Irrespective of reaching the target price in a certain time limit or not doing so, ATmatix tracks each pattern for some period yet.

So, after some time since the pattern completion or since ATmatix has stopped tracking the pattern, its data is deleted, but it is obviously included in our historical stats.

Labels: , , , , ,

Sunday, September 3, 2017

WSE indices technical situation overview - 9/1/2017

It's been quite a long time since our last technical situation overview (polish language version only). Meanwhile, WIG20 index has reached the level previously set by ATmatix, and made it even higher. On the other hand, small caps turned out to be the weakest link of the Warsaw Stock Exchange.

WIG20 - new highs

Recently, we've been expecting the rise to the level of 2468 points on this index, due to the upward breakout from the flat base pattern that emerged in july.
As you can see in the chart, this scenario has been already accomplished.

However, the first approach near the 2420 level failed and the index rebounced down slightly with the throwback below the breakout level of 2363 points. But bulls regained control once more and the index jumped above 2500, making its new yearly highs. Should we have expected that?

Let's take a look at another pattern - the ascending channel. ATmatix detected this setup on august, 14. The first downward breakout could be misleading, as the downward movement suddendly reversed and the index run up vertically with an impressive momentum, piercing the top of this pattern with a considerable turnover volume. Target price, predicted by ATmatix, was reached on august 28th, almost in point.

What to expect next? Looking at the double top pattern, which was invalidated with the upward breakout, we can expect another rise, even above the 2600 level. This target was measured using our statistics that allow us to predict the post-breakout upward movement even in case of pattern tops.

We had a similar situation already this year - forming the top pattern on WIG20, then invalidating it with a rise to the new highs - see the example pattern.

Of course this is not 100% sure, as we are already close to some significant resistance level, which was repeatedly tested in years... 2013 to 2015, and all these attempts resulted in bearish reversals. We're talking about the 2560 - 2630 range. Thus, we're getting close to the important point for this index. In our opinion, we can expect profit realizations near these levels, as far as demand manages to lift the index there.


When we looked at the technical situation for mid-cap stocks index in July, it was in the middle of testing its important resistance level. A number of chart patterns emerged there, for which the downward breakouts that occured could lead to a further decline - such as the rising wedge pattern below:

Nonetheless, the 4660 target has not been reached yet, as the drop was stopped near the 4800 horizontal support level.

So we're in a sort of ambiguous situation here - we should be aware of both bullish or bearish scenario. We can expect a breakdown of the 4800 level mentioned above and seeking the underlying support near the 4660 area, or we can also expect the another attempt to break up the resistance located at 4960 points and reach for a new highs.


Previously, we pointed out at the triangle pattern and its downward breakout, for which the target of 15000 points on the small-caps index was set. This target hasn't been achieved yet and there is a chance that it won't be reached at all. Looking at the chart with a broader scope, we can notice the area near 15100 points and consider it as the potential support. It comes from the horizontal consolidation region that occured in February this year and the index value has already come close to this level during the last few weeks.

We can interpret the price scheme that emerged recently, in several different ways - for example we can consider it as a broadening falling wedge, and so it slightly changes the market perspective, as our statistics indicate the greater possibility for an upward breakout, rather than in the opposite direction.

Another version of that data pattern was automatically recognized by ATmatix in this way:

... and yet another in the following way:

All these pattern types with upward breakouts are a positive signal quite often, so we can assume the index is likely to go back up near the value of 16000 points.

The situation is not so clear here as well, but still the attempt to rebound may turn out to be successful - in our opinion, the anticipated rise above the 15600 level, along with a strong turnover volume, should increase the chances to defend the recent minimum. If the market chooses the opposite direction, the level of about 15100 points is expected to form the another layer of support.

Labels: , , , , , , , ,