Details of Statistical Analysis

Use of Statistical Analysis

Some of the traditional alerts, such as unfiltered new highs, are very simple and are the same everywhere.  The more interesting and more unique alerts, however, make use of detailed statistical analysis to watch the market for useful patterns, and to decide which patterns are interesting enough to report.  A person does not have to know this information to use this alerts software.  However, some users have asked why a particular chart pattern did or did not generate an alert.  This page helps satisfy that curiosity.

Note:  All graphs below were created in the Pacific Time Zone.   In this time zone the US markets are open from 6:30 am to 1:00 pm, or 13:00.

Why Use Statistical Analysis?

Many systems and other forms of analysis make a precise recommendation like "buy when the price crosses above $31.02".  This sounds nice, but how do you apply it to a graph like this?

Tick chart of QQQ on a slow trading day.

This is a fairly typical tick chart for QQQ.  This chart was actually created on very low volume day.  The price looks more like a cloud than a point.  The overall price movements are not much larger than the noise that exists on even the smallest time frames.  Statistical analysis helps filter out the noise.

Not all stocks trade this much.  Some stocks can be summarized each day by a few large prints.  For these stocks you can use the block trade alerts and the large bid and ask size alerts.

But what if you want to watch a large group of stocks?  What's interesting for a slow moving stock is not interesting for QQQ.  How can you set filters that make sense for the entire market?  Using statistical analysis we can compare each stock to its own history, and only report when the stock is doing something interesting.

Using Volume to Find Price Levels

One of the hardest parts of technical analysis is just drawing a horizontal line.  How do you objectively decide where to draw a line?  Do you draw a line at the highest wick?  The highest body?  Many authors use the term "congestion".  Ignore stray points, and make the line go through the congested region.  That is a good idea, but a poorly defined term.

The following picture shows a weak consolidation pattern in TMPW.  The magenta box shows where most of the prices were during the time of this chart pattern.  Two candles are completely outside of this range.  Why?  Both of these candles have almost no volume.  These candles did not have a significant impact on the statistical analysis.

Consolidation pattern includes most of the candlesticks, but a few low volume candles are outside of the pattern.

Volume is one of the most important considerations in the alerts server.  Without volume, how do you know that a price action is real?  It is very common to see sudden spikes and retracements, where the price moves quickly, but only one trade was made at the extreme price.  Statistical analysis is used to separate the real opportunities from the flukes.

Using Tick Data to Find Price Levels

Look at the following 1-minute chart of CTAS.

1 minute candlestick chart of CTAS

The alerts server found a consolidation pattern on this graph.  Five minutes later, it found a strong confirmation of the pattern.  Do you see it?  Where would you draw the lines?

The top of the consolidation pattern is drawn at the highest stock price, but the bottom of the pattern cuts through the middle of the congestion.

The picture above shows the first consolidation.  Notice how many candles are partially cut off.  The first candle in the time frame is completely outside of the region.  The pattern actually starts 15 seconds into this 1 minute candle.  The highest prices can be completely ignored because they were mostly in the first 15 seconds of the candle.  The second candle is mostly cut off.  Most of the volume inside of this candle was near at the lowest price of the candle.  Without looking inside these candles the consolidation pattern would not have looked as strong.  Some candles are also cut off on the bottom. Some of these candles have a lot of volume.  Again, by looking inside of the candle, the software can see that most of the volume in those candles was inside of the range.

Stronger consolidation pattern

The picture above shows a stronger consolidation.  In this case the software placed the bottom of the pattern in the same position, crossing the middle of the same candles.  The top of the pattern, however, is right at the top of several candles, and does not cut much data off.  Just looking at the 1 minute candles, there would be no way to decide to place this line at the top of the candles, while in the previous pattern the line was placed much more liberally.

Using Tick Data to Confirm Trends

The graph below shows how misleading candlesticks can be.

10 minute candlestick chart of LAMR.  The stock price is stable during market hours, but quickly runs down in the post-market

From this graph it appear that LAMR has a very strong down trend at the end of the day.  The pattern happens shortly after the close, but there is significant volume to support this trend.  However, the alerts server reported just the opposite.  It reported a consolidation pattern that continued into this 10-minute bar.  It never reported a running down pattern.  Why?

1 minute candlestick chart of LAMR.  Trading on very high volume immediately after the market closes, before the stock price drops.

The 1-minute graph above shows more of the story.  Most of the volume in that 10-minute bar was at the higher price.  Also, the first part of the bar was at the higher price.  So there is every reason to continue the consolidation pattern into the middle of that bar.  But after that, the price dropped quickly.  Why was there no running down alert?

Tick chart of the same stock, including the bid and ask.

The graph above shows all the tick data for the time in question.  When the price drops, the best ask is actually going up.  The spread is huge.  With the spread that large and the volume that low there can be no meaningful trends.  The trends are clear when you look at all the tick data.  The difference is that the alerts server can look at all the tick data at once; a normal person could not.

Note: The graphs above come from eSignal.  These graphs are clearer than the graphs that come from many other programs.  The colors on the 10-minute graph show that the large downward motion all happens after the close, so might not be real.  Some software does not make this distinction.  On the 1-minute graph there are blank spaces where there were no trades.  Some software draws a horizontal line to fill in the blank spaces.  That would make the move look pronounced than it really is.

Variable Time Scales

The alerts server automatically chooses time scales based on the amount of volume that is going through at the time.  The software continuously adjusts these scales.

Look at the graph of CECO, below.  Try to describe the chart patterns.

Candlestick chart of CECO.  Includes running up and consolidation patterns.

On the surface it appears to be running up, consolidating, then running up again.  When a stock transitions directly from a consolidation pattern to a running up pattern, that is the definition of a consolidation breakout pattern.

The alerts server had a different opinion.  It showed several running up alerts, two consolidation alerts, then several more running up alerts.  However, there was no consolidation breakout.  Why not?

There was relatively little volume during the consolidation period.  There was a lot more volume during the two running up periods.  The running up pattern never stops.  The stock does not move up enough after the consolidation period to define a new running up pattern.  However, if you look at the entire day, there is a strong running up pattern.  This is most clear on an equi-volume graph, where the middle period virtually disappears.

The alerts server sees the consolidation, but on a completely different time scale.  There is no transition from one pattern to another.  The consolidation pattern is completely embedded within the running up pattern.  The situation is analogous to a person seeing one chart pattern on a 1-minute graph and a conflicting pattern on a 15-minute graph.  The difference is that a person would choose in advance to look at two or three specific charts.  The alerts server always looks at all time frames, and fluidly switches between them.

Using Time to Confirm Trends

Now look at the graph of XLNX, below.

XLNX stock chart, before the chart patterns were added

This example is the exact opposite of the previous one.  The alerts server found a consolidation pattern which continuously improved thought the day.  It also reported a running up alert.  But then it reported that the consolidation pattern was still improving.  How is this possible?

XLNX is trading in a tight range.  An arrow shows where the stock price quickly moves from the bottom to the top of the trading range.

Start with the initial consolidation alert.  The graph above shows that the stock is trading in a range.  The graphs below show the same stock for the past week and month.

The trading range looks small compared to the volatility of the previous 5 days The trend is confirmed again by looking at one month on a daily stock chart.

The current trading range is small compared to price changes over the past week or month.  So the trading range is small enough to be interesting.

As time passes, the height of the trading range does not grow.  The random walk model insists that a trading range slowly grow over time.  The more time that passes without breaking out of this range, the more obvious it is that the pattern is real, not random.  That is why the alerts server reports that this pattern is improving.

Now look at the running up alert.  In approximately 90 seconds, the price moved all the way from the bottom of the trading range to the top. It does not break out of the trading range, so the consolidation pattern is not affected.

The paradox is that both alerts refer to the same price range, $0.29.  The consolidation alert says that it is interesting that this range is so small.  The running up alert says that that it is interesting that the range is so large.  The difference is the time.  $0.29 in 90 seconds is very fast.  $0.29 in 6 hours is very slow.  The problem is analogous to comparing two stock options that are identical in every way except the expiration date.  In fact, the alerts server uses the Black-Scholes model to quantify this difference, the same model that is commonly used to price stock options.

Effects of Volatility

All previous descriptions have been qualitative; they describe the general shape of a chart pattern.  However, this is only part of the problem.  What makes one pattern strong enough to signal an alert when another does not?  That is where quantitative analysis is required.  Look at the graph of IMCL, below.

The stock price moves up on high volume

This graph shows a relatively calm period of time, followed by a period when the price goes up, then another calm period.  The first calm period generates no consolidation alerts.  The second period generates one new consolidation alert, and four more alerts confirming the pattern.  Why?

The simple answer is price.  By definition a consolidation pattern is when the price stays in a small range.  But this is not enough.  The price must stay in that range for a sufficient amount of time.  The amount of time depends on the volume.  Volume is key.  Volume is the reason why we had 5 alerts between 7:01 am and 7:09 am, but none before 6:50 am.

These first three factors show why the first half of the graph has fewer alerts than the second half.  But where do we draw the line?  How do we decide that a chart pattern is or is not strong enough to report?

Volatility is the last piece of the puzzle.  Short-term historical volatility is used to model the market.  These models set the expected performance of each stock.  When the actual patterns diverge too far from the expected patterns, the software generates an alert.  This ensures that each chart pattern will generate a response which is appropriate to the particular stock.  Without considering volatility, some stocks would always generate consolidation alerts, while others would always generate running up or down alerts.

This example focused on consolidation alerts.  Other alerts use similar models.  At a high level, if the stock moves up or down a lot more than predicted by the model, the alerts server generates a running alert.  If it moves a lot less than predicted, the alerts server generates consolidation alerts.  If the price moves are close to what the model predicts, no alerts are generated.  Practically speaking, however, different models are required to implement the nuances of different alerts.

Geometric Pattern Alerts

Many traders look for geometric patterns.  These include triangles (a.k.a. narrowing triangles), broadening patterns (a.k.a. broadening triangles, or inverted triangles), rectangles, head and shoulders, double bottoms, etc.  We use the traditional definitions of these patterns to create our alerts.  We use our own, proprietary statistical analysis to determine when a stock price is moving, congested, etc.

The patterns listed in previous sections are relatively simple.  Running up shows the price moving consistently in one direction.  We're really focusing on two points, the bottom and the top.  We look at the middle only enough to say that it looks like straight line connecting the bottom and the top, rather than a more complicated pattern.  Geometric pattern alerts are each made of several pieces, and each individual piece is a straight line or similar shape.  For this reason geometric patterns are often harder to find, but typically cover larger time periods.

Lets look at an example.
15 minute candlestick chart of IBC with an arrow pointing to a Doji with high volume
At this time we received two pattern alerts, a triple bottom and a triangle top.  First, the obvious question.  How can we have two contradictory signals at the same time?  The simple answer is timeframe.  One pattern stretched over several days, the other one, only part of a day.

Here we see a very clear triangle pattern.
Same stock chart, highlighting a triangle top stock pattern

If we zoom out we can see the triple bottom pattern.
Four day candlestick chart showing triple bottom and triangle top stock patterns

Both patterns look good on the chart.  But why does one say bottom and one say top?  We use the most common definitions of these patterns.  Tops and bottoms are always hard, if not impossible, to call.  This is especially true with triangle patterns.  In this case we reported the triangle because the last move was so well pronounced, creating an obvious triangle shape.  But that last move was only 3 cents, so you should be cautious with this type of pattern.

So, how did we do?
Traingle pattern ending on the last volume spike of the day, very small gap down, price moves down quickly after the open, and continues until the first volume spike of the day
We reported the triangle top on the last volume spike of the day.  The next day the stock continued down, as the common interpretation of the triangle top would suggest.  This lasted until the first volume spike of the day.

The triple bottom was briefly broken as described in the previous picture, and was tested again around the following close and open
In the long term, the longer term alert took over.  The stock price could not fall far below support.  Notice that we always draw the line as a shaded area.  We do not draw complicated patterns then expect them to be precise to the penny.  The fact that we have a very good triangle and a very good triple bottom at the same time shows that you need some slack in your definitions of these patterns.  We use time, volume, and volatility in the usual ways to determine what was important.  The 3 cents at the end of the triangle was very important.  The same 3 cents had no part in the triple bottom.

One question remains.  How could we call a bottom and a top at the same time?  Simple.  The price was very volatile at that time, so there were lots of price moves.  And there was a single volume spike punctuating our decision to present both patterns.  Take another look at the first chart, and look at the candle where we reported the alerts.  This is a "Doji" candle, a candle covering a large price range, but starting and ending at the same price.  Since so much price and volume is hidden in that candle, let's take a look inside.

A tick chart of IBC showing the triangle stock pattern.  The pattern ends with a whipsaw.  The volume spike in the previous charts comes from one single print.
Sure enough, the triangle ended on a very sudden move.  Based on the overall size of the two stock patterns, and the amount of noise at the time, we decided that the last and high and the last low were too close together to call.  We see a sudden jerk in the stock price. The stock price made a high and a low at approximately the same time on very high volume.  This type of sudden jerk is especially common at the end of a triangle pattern.  The definition of the triangle pattern requires the stock price to oscillate very quickly at the end.

Filtering

Data is typically analyzed in two phases.  The initial analysis looks at our entire universe of symbols.  This analysis determines which symbols are appropriate for which types of analysis.  The second phase includes the detailed analysis described above.  Some symbols are completely filtered out before the second phase, so no alerts appear for those symbols.

The initial phase looks at all electronically tradable US equities, ETFs and HOLDERS on the AMEX, and approximately 50 indices.  These are examined primarily for volume, as statistical analysis is meaningless for extremely low volume symbols.  Other factors, such a price, also play a part.  The exact selection of symbols changes every day.

The software then examines every tick from the resulting set of symbols, all in real-time.  This phase of the processing typically sees and reports on well over 99% of the dollars traded in the initial universe of symbols.

trade ideas logo
Copyright 2024 Trade Ideas, LLC.
Privacy Statement  /  Disclosure Statement