Rethinking Volume Analysis






As market technicians we learn volume analysis as part of chart reading.  The guidelines seem pretty clear.  High volume means strong interest, low volume the opposite.

A high volume breakout announces buyers arriving in force, while a similar breakout on low volume indicates a false breakout.

Retracements often begin with high volume and end with volume drying up.

Markets bottom on a final high volume climax selloff; nobody is left to sell.

What if this traditional way of analyzing volume is wrong, or at best incomplete?  What if we could see more closely into the buying and selling? By separating volume into volume at the bid and volume at the ask we can.

The daily chart at the top shows a failed breakout in the U.S. Natural Gas Fund ETF (UNG).

High volume attempts to move beyond 27.15 (dark red horizontal line segment) on 1/29 and 2/5 were followed by high volume moves down.  Another try on 2/19 failed (left-most white arrows), closing below resistance and towards the day’s low.

Finally we got the breakout we were looking for on the 21st – high volume and near the high.  The next day opened at a new high and sold off, moving well back into the base on very high volume.

Too see what happened let’s focus on two hours, one on the 19th and one on the 21st.  These were the hours when the actual breakouts were attempted.

Look at the lower, 60 minute chart at the top of the page.

Arrows point to the hours of interest.  At the bottom of the chart are two indicators that show us analogs of buying and selling pressure.

The upper indicator, Volume Bid/Ask Differential (*from the TraderHacks Toolkit), displays the difference between buying and selling volume as histogram bars.

If the buyers’ volume is higher the bars are green, red for sellers (the gold horizontal bar is the average volume over 120 hours, while the gold dot is the bar’s total volume).

If buying is greater than 55% of the total and volume is above average the histogram is bright green, dark otherwise.  In this way we can see if buyers are somewhat stronger.  The sellers’ bars are colored similarly but in dark or bright red.

The lower indicator, Volume Bid/Ask Differential Spectrum (*also from the Toolkit), displays the difference between buying and selling volume as a spectrum over multiple time periods.

The top row is for 1 hour, the second row 2 hours, the third 4 hours, etc., all the way up to 256 hours (nearly 2 months) on the bottom.  The coloring is the same as the Bid/Ask Diff.

While the B/A Diff shows us more detail, the B/A Diff Spectrum allows us to see the overall buying and selling differences over time.

When UNG tries its breakout attempt on the 19th there was already considerable selling pressure.

Multiple hourly bars on the B/A Diff showed above average volume with sellers’ volume beating that of buyer’s by at least a 55-45 margin.

The B/A Diff Spectrum confirmed this with higher selling pressure of similar magnitude going back to 16 hours prior (bright red segments), and of lesser magnitude going back several weeks.

The 60 minute breakout bar itself was low volume with sellers’ volume ahead.  Looking at the 5 minute UNG chart below shows us that in more detail.

There was plenty of selling, and virtually no buying pressure visible in either the 5 minute or 15 minute (lower indicator) B/A Diff displays.  The high selling pressure in the hours following precipitated the selloff towards the day’s lows.

What was wrong with the breakout on the 21st?  We got a break to new highs on high volume.  By traditional means this was a great breakout (we can argue over the previous high volume selloffs – weakness versus overcoming weakness).

But we can see clearly on the 5 minute chart the selling pressure increased during the breakout itself.

Prices held for the remainder of the day but volume was quite low.  Buyers were unable to push price higher the next morning and sellers came in around 10am (see 15 min B/A Diff) to begin the selloff.




So what does this all mean for the volume analysis we cut our teeth on?

High volume and low volume stills counts alot.

But the old school inferences about their meanings needs to be checked against the reality that buying volume is added to selling volume to get the total.

We need to take a close look at which crowd, if any, is in charge.


Trade well,

David Ayer


*The TraderHacks Toolkit is available on the TradeStation AppStore and can be subscribed to on the website as well as on the platform.


Copyright Mutant Software LLC 2015

Identifying Big One Bar Moves



Identifying Big One Bar Moves_Image1

Big one bar moves, often called wide-range bars, usually signify an important event in the life of price has taken place.

An exuberant confirmation of a new trend as in AZO’s case above.

The climax move of an existing trend telling traders that all that will be made has been made.

A strong breakout.

A market that refuses to let the bears win as HRB shows below by fighting back from an ominous gap down.


Identifying Big One Bar Moves_Image2


Or a reversal bar indicating you had better step off before shedding more equity.

A full day standoff between buyer and sellers.

A stock struggling to regain its footing like BLL below.


Identifying Big One Bar Moves_Image3


So how do you identify those bars?

They may be obvious just from glancing at a chart.

But they can also be hiding in a jungle of other bars.

And if you have to search for them across hundreds of markets in or in real-time with even just a handful you really need a tool for assistance.

The traditional measure, a one bar percent change, is actually quite limited.

That’s because markets vary dramatically in their volatility.

Yes, a 25% move is large in every market.

But what about a 5% move?

It’s a big move in a market that usually varies 2% between low and high per day.

But it’s nothing in one where 7 or 8% is the average, and there are plenty of those.

We could use raw points but that also has the volatility variance issue.

What about a volatility measure like Average True Range?

It does measure bar sizes but only over a single lookback.

What we need is something that compares the volatility of the last bar to a longer running average.

The Relative Volatility indicator, or AtrM/AtrN (or A/A) from the TraderHacks Toolkit does just that.

The RadarScreen image below shows the types of colorized output possible.


Identifying Big One Bar Moves_Image4


The parameters were set to compare one bar’s volatility to the average over 65 bars.

The green rows all have Relative Volatilities that exceed the High Threshold.

If desired an Alert can be set for such high ratios, and an automatic sort based upon that to move them to the top of the RadarScreen.

The remaining row types are colored red for those under a Low Threshold or colored neutrally if between the two thresholds.

All of the charts also show Relative Volatility in a panel beneath price.

It is evident that when seen lined up in this manner that the per-bar volatility is itself quite volatile.

Tracking many markets and trying to catch the big one bar moves in all of them is next to impossible.

But with a tool like Relative Volatility it will be just one of a large number of events that you can identify with ease.


Trade well,

David Ayer




*The TraderHacks Toolkit is available on the TradeStation AppStore and can be subscribed to on the website as well as on the platform.



Copyright Mutant Software 2015

Screening For High Volume Bars


Screening For High Volume Bars_Image1


High volume bars, bars whose volume is well above average, indicate strong interest or activity in a market.

The bulls may be in control (see EXPE’s chart above) or maybe they are in a pitched battle with bears (as in HBI’s chart below).

Identifying those markets is a key aspect of many types of setups.

High volume breakouts can signify the commencement of a repricing.

Bottoms can end with a climax selloff.

Trends can continue with breakaway gaps, or they can be interrupted or end with counter-trend gaps.

And retracements can end with a bang.




Screening For High Volume Bars_Image2



After refreshing your universe of equities you can begin screening for attributes specific to your setups and trading systems, such has high volume bars.

You can use the Scanner but it will be slow since calculating average volume requires history, so use RadarScreen instead.

TradeStation has a built-in average volume indicator but it does not have the functionality we need.

It does alert on bars above the average but does not provide any output calculation for the degree the volume of the bar exceeds the average.

So there is no way to order the list.

That may not seem to be a big deal but of the 327 equities in my universe at the time of this writing 146 had above average volume.

By ordering the list and selecting for those that had volume 50% above average the list was whittled down to 55.

And if you choose to be even more selective, say volume twice that of the average, you now only have to consider 25 stocks.

That is really the kind of efficiency we want and need when filtering, especially if we trade both sides of multiple setups.




Screening For High Volume Bars_Image3



Fortunately the *TraderHacks Toolkit has a component that can readily handle this task.

Relative Volume calculates a ratio of the volume of a short time period versus a longer one.

It colors all Relative Volumes over a threshold value to a chosen color while leaving those below the threshold a neutral color.

Any equities above the threshold can generate Alerts as well.

The RadarScreen image above shows a recent output with the Relative Volume in the right-most column, sorted descending.

The volume for 1 bar was compared to the average volume over 65 bars.

Of note is how large some of the ratios are.

Zeroing in on those stocks will place you in the center of the action every day.


Trade well,

David Ayer




*The TraderHacks Toolkit is available on the TradeStation AppStore and can be subscribed to on the website as well as on the platform.



Copyright Mutant Software 2015

Finding A Universe Of Stocks To Trade





Every multi-market trading system uses a set of filters to identify candidates for further analysis.

The filters can be divided into two groups – those that are specific to the trading system, such as those for trend or retracement characteristics, and those that select for sufficient volume and volatility.

Since most systems need to screen for volume and volatility we will focus on just those in this post.

If you trade multiple systems separating the filter groups into discrete steps is also useful and a time saver.

Volume is primarily a requirement for liquidity – we need enough participation from other traders when we are ready to get in or out.

Good volume is also associated with small bid-ask spreads, which is especially important for trading systems with short holding periods.

Volatility above a moderate threshold is necessary for directional movement – a low volatility market is a dead market.

TradeStation allows us to track over 8000 markets and provides multiple tools for scanning and screening.

The Scanner is really the only filtering tool you need but for the basic problem that it is very slow with scan rules utilizing indicators that require history.

TradeStation does have some built-in scan rules that are pre-calculated on their servers and are quite speedy. We will exploit those but need to take an additional step for further filtering.

RadarScreen is a spreadsheet-like grid application that we will use for that step. It is very fast but its limitation is it can handle only a relatively small number of symbols (1000 or 2000 total across all open workspaces depending on the TradeStation version).

So by using only pre-calculated scan rules (or ones that required no history) in the Scanner and then dumping the symbols that result into RadarScreen we can very quickly find a universe of stocks for further trading system-specific filtering.

Step 1: Scanning

The image below shows a sample scan with two required rules and a third, optional one.

First we create a new scan in the Scanner and select a Symbol Universe of All Stocks.

The first Scan Criteria rule specifies a Close > 18. Set this as low you need, but the lower it is the more symbols the scan will generate.

Stocks with low prices are also often associated with low liquidity and with bid-ask spreads that are large as a percent of the price.




The second rule filters out all stocks whose average volume over the past 10 days is less than 400k per day.

It is set at a lower value than we will set in the second step with RadarScreen. We will also use a longer lookback period.

The last rule is an example of how to split the scan into multiple steps if the results generate too many symbols for RadarScreen.

In that case you would run the first scan, filter the results in RadarScreen, (see Steps 2 and 3), and repeat with a second scan (in this case with a % of 52 Wk High/Low < 70).

Step 2: Screening

Now that we have done the initial filtering (make sure you run your scan) we take those results and copy them into RadarScreen.

We will be using two indicators from the TraderHacks Toolkit, Volume Average Truncated and Atr Percent.

The Volume Average indicator that comes standard with TradeStation would work perfectly well in this usage.

We prefer the Toolkit version due to the difference in Alert functionality which we will exploit as an additional time saver.

The standard version alerts when the volume of the most recent bar is greater than average while we want to be alerted when average volume is greater than a threshold.

We use Atr Percent since the Average True Range indicator that comes with TradeStation is not up to the task.

Two stocks could have the same Atr but their prices could differ so greatly that only one would be sufficiently volatile given its Atr value.

For example ABC with an Atr of 0.75 points and a price of 25 would be volatile enough, but XYZ at 250 and the same Atr would not have the requisite daily movement for trading.

First create a RadarScreen, Format All Symbols to Daily, and insert the indicators.

Format Volume Average Truncated with a Length of 65 bars (days) and Threshold to 800000 (shares per day).

Again this is just a sample and you should set all values in all steps to your preferences (while being cognizant of the RadarScreen rows limitation).

Format Atr Percent with AtrBars at 65 (days) and MinAtrPctThresh at 2.5% (leave the max at 5.0 and hide the LongAtr% and 1BarAtr% plots).


Step 3: Sorting

It is not necessary to use alerts to finalize your results, but it does speed up your process some every day and setting it up once is easy.

If you skip this step you will have to manually sort RadarScreen first on Average Volume, manually delete the stocks that are too low, then sort on Atr Percent, and delete those that are below the low threshold and then those that are above the high threshold.

First right click on each indicator’s column title in RadarScreen and Format each For All Symbols and select the Alerts tab.

Enable Alert Once Per Bar, select None for Message Center notification, and save it.

Next execute a Format Page and click on Sort. The final version can be seen below.




Now add the Alert for Volume Average Truncated and Atr Percent and sort Descending.

Select Keep data sorted with whatever interval you like (keep it short) and save it.

From now on after you dump your symbols in from the scan your universe will be at the top of the RadarScreen.

The image at the top shows an example of the four row types.

We want the rows with alerts generated for both indicators, in this case the five rows at the top (in practice there will likely be hundreds).

If you use the multi-scan method be sure to delete rows that are not in your universe before copying in the symbols from the second scan.

Fast, Fast, Fast

Having the right tools and using them effectively is the key to having a blazing fast trading process.

Quickly generating a universe of stocks for trading system-specific filtering is an important first step.

The setups and procedures outlined here are by far the fastest route to that.

It is so quick your list can (and should) be refreshed daily.

Your trading process requires efficiency as one of its primary goals and that is what the Toolkit is all about.

Trade well,

David Ayer



Copyright Mutant Software 2015

First TraderHacks Toolkit Releases






I am pleased to announce the first releases from the TraderHacks Toolkit, published by Mutant Software LLC, on the TradeStation TradingApp Store.

The Toolkit helps to increase productivity and make your trading process more efficient by decreasing preparation time and reducing errors.

Available now for immediate use are the Price/Volume Utilities indicator pack, the HiLo Breakout Detect indicator, the Volume Bid/Ask Differential indicator, and the Volume Bid/Ask Differential Spectrum indicator.

The Price/Volume Utilities pack from the TraderHacks Toolkit is a set of basic but essential indicators for finding and analyzing setups and positions and identifying exceptional conditions. They allow you to utilize volatility-normalized and zero-lag response indicators to see more clearly and quickly – to decrease prep time and to decrease reaction time.

HiLo Breakout Detect, calculates the number of bars for which the current bar’s Price is the highest or lowest. Breakouts are indicated by color and Alerts.

The two Bid/Ask Volume indicators give you the ability to differentiate strong versus weak buying and selling using advanced volume analysis. The chart at the top shows a downtrend and the climactic selling at its end using the two components.

Volume Bid/Ask Differential displays the difference between the volume at the ask price and volume at the bid price as a histogram.

Each bar’s histogram is individually colored based on whether the buyers or sellers are in control and the total volume exceeds the average volume. It also displays the average volume as a line graph and the total volume as a dot above the histogram.

Volume Bid/Ask Differential Spectrum also displays the difference between the volume at the ask price and volume at the bid price but as a spectrum over multiple time periods.

The segments in each bar’s histogram column are individually colored based on whether the buyers or sellers are in control and the total volume exceeds the average volume.

The first 30 days for all Toolkit components are free and, since there is no long-term contract, you can cancel at any time (refunds during the first ten days of the month).

You can subscribe on the TradeStation website or directly from the TradeStation platform and subscription fees are taken out of your account automatically.

Before subscribing to any Pack and using any of its components you should read and understand the Terms and Conditions.

The Documentation page has links for all of the components (plus other useful links).

The Toolkit/Documentation menu on the menu bar at the top has items for each component listed alphabetically.

Some new application notes will be forthcoming, but the Archive contains numerous technical articles that feature Toolkit components (see for example the posts whose titles begin with “Finding Opportunities…”).

As always your questions, suggestions, comments, etc are welcome using the Contact page or directly at


Trade well,

David Ayer


Copyright Mutant Software 2015


Delayed Gratification




More than a month has passed since my last post. Earlier in the year I had promised to write more often, so I am sorry so much time has gone by. I will disclose the reason in a minute.

I had also stated that the TraderHacks Toolit would be available this spring and unfortunately that is unlikely, with the same cause as the posting delay.

In order to sell subscriptions to the various Toolkit components on the TradeStation AppStore I had to apply to and be approved as an official AppStore Developer. A number of conditions had to be satisfied including the TraderHacks website meeting certain criteria.

The verification process was supposed to take a handful of days. My plan was to then upload the code to the AppStore, make an announcement here, and begin a series of posts detailing how to accomplish all that the Toolkit promised .

I applied to TradeStation and the waiting began – one week, two weeks… After nearly three weeks they informed me that due to “unforeseen circumstances” reviews had been suspended.

Finally, after another week and a half I was told that my risk disclosure statement was not placed properly and would have to be changed. Despite my protestations that I had met the requirements (and even pointed them to another similar and approved site) they were unmoved.

To your right you will notice a new sidebar that contains the risk disclosure. While I am now unhappy with the visual appearance, I believe I chose the best among a set of crappy alternatives (the boring details follow).

I originally gave a great deal of thought to TraderHacks when I began to conceive of it. I decided on a target audience of early-stage traders and a minimalist appearance to avoid distracting the reader.

I also decided on a soup-to-nuts web hosting company who would take care of software installation, software updates, backing up the site, etc. I also knew I wanted to use the WordPress blogging platform. Both would mean a no-fuss website after initial setup.

The downside of using such a hosting company is they place a large set of restrictions on your site and the set of options open to you. Now the appearance and end-user functionality of every WordPress-based site is dependent on its WordPress Theme.

The hosting company only provided a limited set of Themes, but I found one that, with some tweaking and some clever WordPress hacks, gave me everything I wanted, more or less. Colors, fonts, formatting, full-width pages, custom header, etc were all within reason and I was happy.

That was the TraderHacks site that has been up since January 2014. But what TradeStation wanted was the risk disclosure to appear on most pages and not on separate pages as TraderHacks had them.

The problem was that the existing Theme only provided for a possible sidebar and not a footer. The implication was either hand editing about 90 different pages and placing the statement at the bottom of each page or ruining the appearance with a sidebar.

The editing option would take too long and there was the unacceptable risk TradeStation would reject the disclosure text and force me to do it again. One other possibility was to change Themes.

Of the 362 available Themes only 29 supported a footer. I have a free play site that I used to get the original TraderHacks to have the look-and-feel I wanted and returned there to explore what I could get out of the footer Themes.

Sadly, after much effort, I found nothing that was even close. Ugly or broken was the repeated result – deleted content, poor menu support, unreadable fonts, permanent sidebars, permanent and unwanted widgets, poor or destroyed formatting, etc.

So ultimately I opted for the sidebar with a text widget on the existing Theme. It looked far better than any of the footer Themes and was a simple change to make.

Had I not been such a purist the path would have been much easier. I have always been that way with my designs, especially software. It is more demanding of the creator; it takes more time and effort and requires higher standards.

But in the end I think it is worth it (see Apple’s products for evidence). After all you create once and live with it for a long time. Consider that when designing your trading systems and trading process and choosing indicators and laying out the workspaces on your platform.


Trade well,

David Ayer

Copyright Mutant Software LLC 2015

The Market Internals Stink





If you are confused by the U.S. markets you are are not alone.  The evidence is decidedly mixed.

The chart above shows the weekly S&P 500 (SPY is used as a proxy) in a solid uptrend, with the green 40 week moving average supporting the large-caps for most of the last 6 years. The index closed at new multi-year highs a few weeks ago, yet momentum has slowed considerably since late 2014 and choppiness has moved from low to moderate.

The S&P 500 daily chart below shows the same thing in greater detail. Momentum is down and choppiness up. But recent volatility (21 day) is low compared to long-term volatility (200 day).




This all points to a fairly healthy bull. We would prefer a little more directionality, but there is little that hints at a possible top.

That conclusion must be questioned, however, after the internals (and other factors) are considered. Frankly, they stink, and are not consistent with the price action.

The chart below shows the NYSE versus its percent of stocks above their 50 day MAs (blue) and 200 day MAs (green), respectively. While the NYSE regained its place above support and sits just 0.5 Atrs below it recent highs, roughly half of its stocks are displaying weakness.




Less than 46% of the NYSE stocks are above their 50 day MAs. This is down from the over 70% registered at the peaks in late February and is an indication that institutions have not been buying at the 50 MA.

In a sense the story with the number of NYSE stocks above their 200 day MAs is even worse. With less than 52% of stocks above it, that means the nearly half of the NYSE is in bear territory.

The NYSE New Highs versus New Lows graphic superimposed over price in the chart below reinforces the less than shower-fresh smell of the internals (the middle gold line is the 200 day average of the 1 day highs minus lows, the upper and lower gold lines are +/- 1 standard deviations, and the histogram is the one day highs minus lows for that day).




As the NYSE moved above support in mid-April we should have seen much more than average numbers. We certainly should expect better than below average now when we are so close to revisiting the recent highs.

The last chart below (15 min candles) shows the NYSE versus the 5 day cumulative TICK, a minute-level advancing minus declining issues metric. It has been trending downwards since the late April highs and had only a muted response during the yesterday’s decreased volume gap up day.




The 5 day TICK’s excursion into negative territory displays further evidence of selling. Investor’s Business Daily also found a bearish divergence with an elevated count of distribution days in the past month, indicating institutional selling.

IBD characterized the U.S. market as “Uptrend Under Pressure” for most of the past 6 weeks and switched to “Market in Correction” this past week. They also noted a high number of failed breakouts and recent big losses among many market leaders.



So here we sit near new highs with an intact uptrend and lowish volatility. But momentum has slowed measurably with choppiness rising some. More ominous (or perhaps I should say odoriferous) are the internals issues, all of which occur preceding and during market topping processes.

Price is primary (and internals secondary) and, with the exception of the numerous distribution days, we have not seen the large choppy price moves with high volatility levels characteristic of market tops. We certainly have not seen topping patterns on the charts.

Until we see price do something dramatic to the downside it is too early to shift out of moderately bullish (which I have been since mid-February, see Indexes Breakout On Good Breadth). But the deterioration in internals should be cause for modifying the structure of your portfolio.

In general consider moving towards a lower net long balance. This can be achieved by decreasing longs position sizes, exiting weak long positions, or adding short positions.

If a top does occur it will likely take many weeks to play out. Evolve your portfolio as the price/internals dichotomy gets resolved – react but avoid overreacting.


Trade well,

David Ayer



Copyright TraderHacks 2015

The Right System At The Right Time



Success in the financial markets involves the interplay between our trading system(s) and the market context in which we are trading. The system must fit us and the system must operate effectively in the current context.

When we first begin trading we can be confused about our lack of profitability. We have a system that shows positive expectancy in backtests or in others’ hands but our equity keeps dropping.

Traders who survive long enough to get it figured out are those who identify their unique mix of traits and find systems that leverage their strengths and minimize or avoid areas where they fall short.

They also learn that the conditions under which they trade the system matters a great deal. The context provides clues as to how hard to push the accellerator or the brake or even when to rest by the side of the road.

The Right System

Many of us come to trading from other fields and our success there relied upon a particular mix of attributes. But often the requirements of trading conflict with what we thought were strengths.

A salesman’s aggressiveness may result in jumping the gun on setups or in taking too large a net position. An engineer’s analytical contemplations can mean waiting for too high a level of certainty, not taking action, and missing opportunities.

Choosing the right system is dependent upon how clear we are about our mental abilities and our psychological traits. We need to identify our skills and what styles of trading our lifestyle allows us.

Knowing all of these permits us to investigate trading system issues with greater clarity. Consider some trader-dependent aspects of systems:

– mathematical or statistical systems vs pattern-based ones

– intra-day vs short-term vs medium-term setup and holding periods

– momentum or trend or breakout vs pullback or reversal or range

– directional vs volatility

– investor vs trader

– speculator vs technician

– theme-based or top down vs bottom up or state-driven or event-driven

– fundamental analysis vs technical analysis

– system trading vs discretionary trading

– simple vs complex

– single market vs portfolio systems

– stocks vs stock indexes vs bonds vs currencies vs futures

– risk per trade and drawdowns vs profit per trade and runups

– win rate vs win and loss size

The right system is not one that works – it is one that works with you doing the driving.

The Right Time

The right time means trading your system when the market context favors profitable outcomes for it. Determining what that context is and when it is occuring can be quite challenging.

Some systems can benefit from incorporating some market context parameters directly into system logic and backtesting them. But many systems cannot take advantage of that, and much of the context cannot be accounted for directly.

The market context often involves reading tea leaves and balancing conflicting or contradictory information. The reactions to particular events or situations are often surprising, which must then be fed back into the analysis.

The context is fluid and can propagate to affect a range of markets. An event occurs or a government announcement made, a strong market reaction follows, and then a market counter-move reverses the previous reaction. The following day foreign markets confirm the move and other asset classes have their own responses.

Some of the issues which may affect your trading system:

– high vs low volatility

– high vs low volume

– trend vs range

– Fed loosening vs tightening

– waiting for Fed loosening vs tightening

– market responses to news

– large vs small cap

– growth versus value

– riskier vs safer assets

– fear vs complacency

– breadth at market peaks/troughs

– industry/sector rotation

– earnings or sales expectations vs results

– currencies

– interest rates

– commodities supply/demand, prices

– inflation

– taxes, regulations

– housing permits, sales, prices

– job openings, growth, layoffs

– wage growth

– consumer spending

– producer spending, productivity

– inventories, shipments

– geopolitical developments

– bad weather

That’s a long list and is undoubtedly not exhaustive – the U.S. and international economies are complex as are the reactions of market participants.

Trading Your System In A Given Market Context

If correctly identifying the market context day after day is not challenging enough now add trading decisions into the mix. The context changes every day, sometimes hourly, but themes often persist for days and weeks.

The market context is shades of gray more often than it is black or white. We
are generally better off with degrees of certainty than with definitive views.
With the former we may want to step with some caution, but if we are sure it can pay to be a pig.

After a change in the context try to make incremental changes if possible. As our view is confirmed we can add positions or add to existing ones. If we are wrong we haven’t overreacted and so haven’t overcommitted.

Learning the significance of different types of context changes takes some experience. Much of it can be seen in the amplitude of the reaction and in the distance of its propagation.

A uptick in the unemployment rate will not be met with anywhere near the activity level that an initial Fed tightening will. The same is true for a breakdown in a trade negotiation versus a military invasion.

Each trading system is unique as is each market context. Perhaps the best metric for system/context match is your trade loss rate – if it has been increasing you may need to reassess your view of the market context and how you have been trading your system within it.

Trade well,

David Ayer



Copyright TraderHacks 2015

Bad Math




In Invalid Indicators I asserted that indicators can have faulty formulations that can render them invalid. Some simply have basic math errors while others have conceptual problems.

It is not uncommon for exponential moving averages (EMAs) to have problems on various platforms. Conceptually some think of them as a weighted sum of prices within a lookback period divided by the lookback length. The weights decrease exponentially as we go further back in time.

But mathematically EMAs are defined differently, as a recursive calculation:

EMA = S * Price + (1 – S) * EMA[1]

The EMA value for the current bar is calculated using the value for the previous bar (which is why it is recursive). The equation also relies on S, the Smoothing Factor – there is no lookback. The user interface to EMA indicators, however, usually does contain a lookback, and S must be derived from it.

Even using the correct equation does not guarantee the EMA provides the correct value on a given bar. The initial value of EMA[1] can be poorly chosen or S may not be calculated properly.

To avoid conceptual errors we want to make sure an indicator is taking an objective measurement. The common usage of objective in technical analysis means that we have measured some quantity pertaining to price or volume. But it could be any quantity, even an arbitrarily-defined one.

However, the proper use of objective is given by epistemology, a branch of philosophy which deals with the nature of consciousness, with knowledge, and what constitutes a valid concept. An objective measurement in this sense is one that measures something in reality so that our minds are provided with the proper value of it.

An objective measurement is based on a standard and expressed in units of that standard. A standard is fixed and unvarying and something we can count on.

A long time ago a king’s foot was used as a standard of length measurements. That complicated trade between areas with different rulers (no pun intended). And replacing the king with his successor was problematic as well.

Now we define standard length by how far light travels in a vacuum in a given length of time, and standard time by the number of wavelengths observed of radioactive decay of particular elements. These and other measures such as for electrical current or energy are critical to physical science’s objectiveness.

Objective measurements must also be repeatable. If we measure the same thing a number of times, say the mass of an object, the means of measurement and the procedure must be such that we get the same result each time.

Related to repeatability is the measurement accuracy and error. These are impacted by the scale of the measurement and the resolution of the measuring instrument. Generally the larger the scale the poorer the resolution. Human errors can also be a factor here – they can simply read the instrument wrong.

Choosing an instrument with the appropriate scale is not always easy. The length of a basepath on a baseball diamond is simple, but the length of a coastline is more dependent on the length of the ruler (the basepath and coastline have different fractal dimensions).

The financial landscape is replete with measurements of dubious, non-objective formulation. Our unemployment numbers do not count those who have been out of work more than two years. GDP includes non-productive government expenditures alongside manufacturing or services output. Inflation measures conflate price changes due to supply and demand issues with those from currency debasement.

Technical analysis does not get out unscathed. Simple moving averages (SMAs) were among the earliest indicators, predating the use of computers, and have retained their popularity. Sum the prices in the lookback and divide by the lookback length to yield a very simple and perfectly valid calculation (I will ignore the issues with lag for arguments sake).

While SMAs usually use a fixed lookback period, ones with variable lookbacks have been constructed. These are done in a purposeful and controlled way, such as modifying the lookback proportional to recent volatility versus longer-term.

But what if the lookback was altered in an arbitrary way? What if we based the lookback on the bar’s order number on a chart – bar 75 would have a lookback of 75, bar 325 a lookback of 325, etc? You would probably say “Ayer, you’ve lost it, man! What the hell does it measure?”

Maybe I am nuts, but I did it anyways. The chart at the top of the page shows such a monstrosity. The lower, purple line is the “Simply Bad” Average (SBA); the blue line above it is the 50 day SMA for comparison. The vertical is placed at bar 50 – both lines have the same value there, as they should.

This chart has 450 bars (the gold indicator at the bottom counts them) and as the bar count goes up so does the lookback length of the SBA. It gets slower and slower and less responsive to price.

That is not what makes the SBA invalid though – it is the fact that each bar uses a different measurement. We are unable to compare SBA on different bars and doing so would be meaningless.

The chart below shows the same symbol, SPY, ending on the same date with the same indicators. The 50 day SMA has the same value on each bar as the first chart but the SBA does not. The reason is that this chart has an additional 250 bars loaded – the SBA calculations for the visible bars are done with different bar counts compared to the first chart.




Why am I using such a ridiculous and seemingly-contrived example to illustrate invalid formulations? Because the underlying math is used commonly and often.

An SMA sums over N bars and then divides by N. If we did not divide by N in the SBA we would still have the problem – N is varying, so the sums are not comparable on the same chart or when using differing bar counts on what appears to be the same chart.

Not dividing by N leaves us with a regular old cumulative measurement. This is how Advance/Decline, New Highs/New Lows, On-Balance Volume, and a number of other cumulative indicators are calculated. They all just as invalid as SBA.

Unfortunately these are used all over the place, in financial publications with large readerships, and by many prominent bloggers. The concepts behind these indicators are fine, it is the formulations that are wrong.

The simple solution is just use a fixed lookback in your own work. The length is always an issue, but at least it will be a valid measurement. And having such a measure is especially useful if you see the normal version differs from the actual reality your’s is measuring.

Trade well,

David Ayer



Copyright TraderHacks 2015

Invalid Indicators





The old timers didn’t have indicators.  Charts were either published in books or created by hand by plotting the prices on graph paper day after day.  Trading the financial markets went on for hundreds of years prior to the use of computers to research and track them.

Once computers started to become common in large businesses in the 1960s pioneers like William O’Neill could rent time on them to do their research.  In the 1970s software-based indicators started to gain popularity as mainframes began to have competition from much lower-priced mini-computers.

Researchers in smaller firms could invent mathematics to process price data without the severe time limitations inherent in renting multi-million dollar machines.  This progression accelerated in the 80s with PCs and networks.  Trading programs and data vendors allowed anybody with any (half-assed) trading idea to express it.

The advent of the Internet, followed by the web, saw an explosion of the trading population along with a multitude of new indicators and ways of using and abusing them.  As traders we want to ensure we use valid indicators and are deploying them in valid ways.

Indicators are simply measurements taken on price or volume data.  We use them because we are trying to measure multiple somethings important and relevant to a trading system or the market context in which trading will take place.  But there are many ways to go wrong.


Non-indicators are like psychics or astrologers for traders.  In fact, there are astrology indicators in many trading platforms.  The “indicators” in this category have nothing to do with measuring the markets.  If you believe that the phases of the moon, the conference of the Superbowl winner, or the political party of POTUS have any bearing on trading I think you will get what you deserve.

Wrong Measurement

If you do not begin with a solid grasp of the concepts behind a trading system, choose types of measurements consistent with the concepts, and then select appropriate indicators as concrete means of making those measurements you will probably run into trouble.

Likewise if you do not understand what an indicator is measuring.  A price oscillator is not a bad choice for shorter-term overbought and oversold indications within a longer-term trend.  Using that same oscillator as the trend filter will not usually work out in your favor.

Obscuring What’s Going On

One of the great temptations for indicator developers is to combine multiple simple measures into one grand one that provides magical comprehensive answers to market questions.  The desire from many traders to have someone else provide them with simple bull/bear or buy/sell signals and to avoid critical thinking is part of the equation.

To merge the number of decliners and advancers and decliner and advancer volume as done in TRIN seems to be a very good idea.  At times such a calculation can be very useful.  But there will be occasions when seeing the individual numbers wlll matter – so look at them next to the composite.

Bad Settings

Using indicators with the wrong parameter settings is a cousin to using the wrong indicator and about as effective.  The market concepts drive the measurements which drive the indicator choices, including the parameter settings.

Oscillator settings must find outliers, overbought/sold conditions that are not too common as to be seen in 20% of the bars, but not so rare as to be seen in only 0.1% of them.  Trend indicators must maintain enough distance from price that they avoid market noise but close enough to allow price to cross at the trend’s completion.

Wrong Timeframe

Operating in the wrong time frame is what Alan Farley deems a Time Relativity Error.  They are effectively the same as using a bad parameter setting.  Instances include analyzing in one time frame but trading in another or looking for an effect in one time frame when the edge appears in a different one.

Bad Math or Logic

Indicator developers are often looked at as masters, traders whose competence is unquestionable.  But like other humans they are not infallable and can make errors.  Bad math or logic even shows up in some well-known and often-used indicators like Advance/Decline and On-Balance Volume.

The indicator can have a valid concept but whose formulation is faulty.  Or the software implementation itself can have bugs.  These are similar issues with similar causes, the difference being one of level of abstraction, with the former existing at a higher level than the latter.

Users of indicators should read documentation and source code, if possible, to understand the inner workings of each of their indicators.  Proprietary indicators (where no source is available) should be fully-specified by the developer.  All indicators should be field tested before use with real money.

Being responsible for your trading results means first being responsible for your screening, analysis, and trading systems.  These are all dependent on the valid choice and use of indicators.

In engineering school we were taught to judge our final calculations on criteria such as units of measurement and reasonableness.  Knowing what you are trying to measure conceptually, logically, mathematically, etc is necessary to meeting those goals as well as those of the bottom line.


Trade well,

David Ayer

Copyright TraderHacks 2015