Posts Tagged ‘indicator’

MACD Divergence

November 12th, 2009 by jackieannpatterson | No Comments | Filed in MACD
MACD Divergence on SPY Weekly Chart

MACD Divergence on SPY Weekly Chart

MACD Divergence typically means a divergence between the MACD technical indicator and price.   The name MACD divergence is a little confusing and new traders are inevitably unclear about the definition of a MACD divergence or, most importantly, how to recognize one.  Once identified, the next question is how long after the MACD divergence signal does it remain a consideration in the analysis of price action.   Finally, or (perhaps initially to know why we might care) , what kind of performance might a trader expect from a MACD divergence — win rates, expectancy, drawdowns, tendency to jump stops – these are all important considerations to a trader selecting an indicator or strategy.

Naming

MACD spells out to Moving Average Convergence Divergence.   Adding another divergence on the end of all that may at first seem redundant but really it means that two sets of things are diverging.   The first “Divergence” built into the MACD acronym refers to the movements of the two moving averages that form the basis of the MACD.    (The MACD itself is the difference between two moving averages of price, usually the 12-day EMA and the 26-day EMA. )   The second “divergence” in MACD divergence refers to a disparity between the price action and the movements of the MACD indicator.

Identifying a MACD Divergence

 The basic characteristic of the MACD divergence is that the indicator does not confirm price action.  If the price makes a new low but the MACD indicator makes a higher low, that is called a positive MACD divergence.  

MACD Divergence

Positive MACD Divergence on IWM*

On the other hand, if price makes a higher high but the indicator makes a lower high, that is called a negative divergence.   Sounds simple enough but in practice there are subtleties such as the appropriate time between extremes of price.     Further, some traders will look for specific characteristics in the divergence such as minimum or maximum price differences between the price extremes or the slope of the price trend at the time of the divegence.    This adds complexity to the identification process.  

An efficient way to identify MACD divergences is to use a software scanner that can identify which stocks, ETFs, or other instruments are experiencing a MACD divergence at the right edge of the chart.

MACD Divergence on THS

Red arrows highlight the negative MACD divergence on this StockFinder chart of THS at right.

Another easy way to find macd divergences is to subscribe to divergence-alerts.com, which reports macd divergence signals on stocks, ETFs, and e-mini futures.
 

Persistance of a MACD Divergence

Some traders may look at a divergence as an occurrance that impacts an entire trend.   Others may consider that the MACD divergence is only in force until the MACD Histogram moves in the opposite direction.  One way to settle the debate among traders about how long a MACD divergence remains a factor is to back test different scenarios and compare them.

Performance of a MACD Divergence

For a high-level comparison of the historical performance of the MACD Divergence to other MACD signals, watch the free video at the Truth About MACD site.   Or you can read the BackTesting Report #8: Finding Big Bottoms with MACD Divergence, which is part of the Truth About MACD series, for the detailed historical stats from our large-scale back test.   Only with a solid understanding of the strengths and weaknesses of the MACD divergence can a trader  make the best use of it.

* IWM is the ETF of Russell 2000

SPY is the ETF of S&P500

Tags: , , ,

Tom McClellan at LA Trader’s Expo

June 16th, 2009 by jackieannpatterson | 2 Comments | Filed in Classes

mcclellansummary_stockfinder

(StockFinder® screenshot of McClellan Summation Index in yellow plotted with S&P500 in green, red arrows mark important divergences between indicator and price.)

Tom McClellan’s hour at the LA Trader’s Expo started from a deep historical perspective and carried through to current market conditions.  Los Angeles was a fitting locale because it was actually reporting on local LA television stations that made popular the McClellan Oscillator and McClellan Summation Index.   These two indicators were developed by the speaker’s parents, Sherman and Marian McClellan respectively.   The McClellan Oscillator and Summation Index are market-wide indicators whose mission is to help traders and investors get an early sense of market trend, the strength of the trend, and impending changes.

Part of the talk focused on the construction of the McClellan Oscillator and the McClellan Summation Index.   Rather than repeat it here, you can find it at the McClellan website.  

One thing I want to highlight is that the McClellan Oscillator is the difference of two EMAs of the Advance/Decline line which means it is actually a MACD of the Advance/Declines.     Evidently both the McClellan Oscillator and the MACD were invented independently at about the same time.   What an interesting confluence of events!

Another somewhat geeky point is that the Advance/Decline data varies between vendors.   The Yahoo data includes ETFs while the Wall Street Journal Advance/Decline number does not include ETFs.    According to Tom McClellan, the difference in end results is not that large, but its nice to see that he is on top of data sources and using clean data for his calculations.

Tags: , , , ,

Gerald Appel’s “Technical Analysis Power Tools for Active Investors” – a Book Review

April 16th, 2009 by JackieAnnPatterson | No Comments | Filed in MACD, Outside Products Reviewed, Technical Strategies

appels_power_tools1

 
4.0 out of 5 stars Reveals Widespread MACD Misconceptions – Almost, April 16, 2009

Buried in this book are clues that point to widespread misconceptions about the MACD.

The clues are
1. Hints at not waiting for the MACD lines to cross to start buying
2. A calculation of MACD Histogram that is different than most, but not all, charting websites and software
3. Suggestions on circumstances to slow down and sometimes skip MACD sell signals

Experienced traders may spot the differences between Appel’s approach in this book and what is often bandied about regarding the MACD. I think it would have been even more helpful if the author had addressed the differences and pointed out any common misconceptions directly. Having done some backtesting of the MACD, I think the book needs more specific, objective details on how to anticipate MACD lines crossing and recommendations for using the MACD histogram or Appel’s histogram, as I have come to call his way of plotting it.

I reckon that reading the book years ago and thoroughly understanding the nuances of how Gerald Appel uses the MACD would have helped me, especially in 2007. Since then, I’ve seen the value of backtesting. The good news is that many sections of this book show historical test results. However, I was a little disappointed not to find backtesting results for the MACD in this book. Test data is rarely included in trading texts so it is probably a bonus to get the data that is presented in this book.

The author emphasizes synergy and gives specific instructions for using other market-timing power tools — along with the MACD and sometimes even without the MACD. In fact, the MACD is only one chapter. But MACD is why I came to the book and I suspect many other readers do the same, so that’s where I focused most of this review.

Besides the MACD, the book has instructions on key indicators of market internals and health. It also gives rules of thumb for estimating duration and extent of market moves, using chart patterns, and it covers moving average channels.

Bottom line: Worth reading to get the benefit of the experience of Gerald Appel, the man who invented the MACD and has seen a lot more than the current boom/bust cycle.

(Backtesting Blog is an Amazon Associate.)

Tags: , , ,

New Report: MACD Buy Signals

April 11th, 2009 by JackieAnnPatterson | No Comments | Filed in MACD, Reports, Technical Strategies

Do you use the MACD indicator or MACD Histogram?
Or follow an expert who does?

If you answered “yes”, you may be leaving money on the table without even knowing it. The most recent BackTestingReport uncovered two mistakes that even experts make with the MACD and MACD Histogram.

After independently researching the report, I sent it to the inventor of MACD, Gerald Appel. Here’s what he said:

“You do seem to have come pretty much to the same conclusions that our research staff has. Most of what you see regarding MACD was arrived at before 1990 by which time I was already advising audiences not to await crossings.”

Mr. Appel is the president of Signalert with hundreds of millions in assets under management, and he has a research staff. If you don’t have quite those resources – or even if you do – you might consider a small investment in an easy-to-read research report.

When you read the MACD Buy Signals Report, you will get an idea how much it cost US stock market participants who waited for MACD lines to cross before buying a stock. Not only that, you will be clued in to a second costly mistake, this time with the MACD Histogram. This one is so widespread, you’ll run into it even on Yahoo Finance charts.

Finally, you get critical data to decide how best to use MACD for your own gain.

Click here to order your report today

Tags: , , , , ,

Stock Buy Signals

March 16th, 2009 by jackieannpatterson | No Comments | Filed in Moving Average, Objective Trading, Strategy Development, Technical Strategies

Here is part 2 about stock entry strategy or the buying process.   The previous article talked about stock screening, which is the background investigation to select a pool of candidate stocks to buy when the time is right.   The trigger or market timing signal is the topic of this article.   

 Why You Need to Time Your Entry

Once you have a universe of candidates, you need an entry signal or trigger.  Stocks can sit around looking good enough to buy for a long time, and you need a discrete event to say “Buy Now”.  Hard experience has taught me that “when I have time to complete research” and “when I feel excited about stocks” are not the best entry conditions.    In retrospect, it was usually a price extreme that got me pumped enough to research stocks and hit the buying point.   I’ve found that exercising the judgement to pick a better entry point can be more financially rewarding than just jumping in.     Personally, I suspect that even a random entry point would be better than emotion-driven buying, and backtesting can help identify strategies that do better than random.

 How To Time Your Entry

I see three broad categories that can be used as in entry signal: news events, clock or calendar events, and price events, especially as indicated by objective technical analysis.   Let’s compare them.

 News Events

If you’re new to the stock market, reacting to news events may seem the most natural thing in the world.  However, a little experience shows that the market anticipates and prices in news before it happens.  This is called discounting.  As an example, remember the recent situation with Steve Jobs and Apple.   It follows the saying, “Buy the rumor, sell the news”, only in reverse because bad news is what moves the market lately.   Here’s what happened:  Amid rumors of Jobs’ recurring illness, the price of AAPL declined, all the while Apple insisted Jobs was healthy.   Then Jobs announced that he was taking a medical leave of absence.   If the rumor of illness prompted a decline, then one might think that the news of his departure would tank the stock – he has had an unquestionable impact on the company, after all.    What actually happened, though, is that AAPL traded down to a new 52 week low in after-hours trading on January 14, the day of Jobs’ departure.  The following day, the price opened low, but regained most of it to close at near the high of the day.  Price bounced around the lows for 3 days, and then began an ascent that ended 3 weeks and 30% later.   The market had already priced in the news and the reaction went in the opposite direction, as it often does.    The upshot of this example is that it is difficult, if not impossible, to form an objective strategy around the news because the news may be priced into the market and always must be subjectively interpreted.

 Calendar Events

The second type of entry signals, clock and calendar events, are more objective than the news, but that’s not saying they’re 100% reliable.   Some of the people who use this category of signals are

  • day-traders who never hold overnight
  • pro traders who only hold overnight
  • investors following the adage to “sell in May and go away”
  • small-cap investors who show up in December
  • commodity traders following the seasonal fundamentals
  • and those folks who mine the charts looking for the dates when a stock almost always seems to go a certain way

Some of the calendar-driven moves truly are driven by the calendar. Others are due to coincidence, while still others are illusion.  Backtesting – either automatically or by manually checking the charts – can weed out the pretenders by determining which have been profitable in the past, and that is a useful first step.    I think you owe it to yourself to take it one step further and look for a plausible cause for the move rather than betting good money on a pattern that came about by chance.

Technical Indicator Signals

 The same can be said of technical indicator signals – you need to understand why they work — plus you need to make sure they are objective.   Aronson’s book makes a good case for using objective indicators rather than relying on subjective information for trading decisions.   A signal is objective if there is no “wiggle room” in describing it, if any two people always see it the same way (not like pattern recognition) and/or you could program it into a computer.  Elder’s first book gives good descriptions of technical indicators grounded in crowd behavior.  

 You can also think through the implications of the strategy.   For example, consider the trend-following strategy of buying when price hits a new high.   A new high doesn’t guarantee that the price will keep going, but all runaway stocks had to make new highs along the way.   A good thing to know is how many stocks making new highs go on to make a profit for investors holding for, say, one year.   Backtesting is one good way to estimate this info.   Sign up for email alerts to find out when new highs will be featured in BackTesting Report.             

Backtesting can also help us overcome our human tendency to become overconfident in a signal because we can easily spot on a chart the times that the signals worked and all too easily overlook the false signals.   A false signal is where the signal comes but the stock price doesn’t go in the expected direction long enough for the trader to profit.  It’s expensive to learn about false signals and our little foibles of human cognition in live trading.

The previous article used the example of price above the moving average to illustrate a potential stock screen.  A corresponding signal using moving averages is price crossing the moving average, or moving averages crossing each other.    They offer objective, discrete events to replace emotional guesswork with rational decision-making.  To find out more, check out the BackTesting Report MA Buy Signal package.

Updated on 3/17/09 to add: (BacktestingBlog is an Amazon Associate. )

Updated on 3/19/09 to add: (Author has a position in stocks mentioned in this article. )

Tags: , , , ,

BackTesting Moving Averages

March 9th, 2009 by jackieannpatterson | 7 Comments | Filed in Backtesting Set Up, Moving Average, Reports, Technical Strategies

Why Moving Averages

As a trader or investor, the only reason to investigate moving averages is to gain knowledge to increase profits. Like many other technical indicators, moving averages are meant to help us objectively tell the market status at any given time. This helps us see through the emotions of the day and make rational decisions, which we’re told will lead to greater profits and/or fewer losses over the long run. Moving averages (MAs) smooth the series of prices for a stock. MAs are most often used to identify the trend of market direction, and are classed as a trend-following indicator. This doesn’t mean that MAs are only for long-term investors – short term traders use them also. Moving averages can be used to screen stocks for good candidates, signal buying opportunities, and offer sell signals.

Why Backtest – A Story

The goal of backtesting is to find out if moving averages really do lead to better results and what are the most promising ways to apply MAs. Let me tell you a short story. While I was putting together the results for one of the moving average BackTesting Report issues, I happened to visit a friend. At her house, I came across some reading material from a well-advertised discount stock broker. In it was an article that advising its customers to use a particular moving average length applied in a certain way to get the best results. I had my comprehensive tests right in front of me and I can tell you that broker’s method did not get the best results although they did mention a MA length that is useful in other ways. I had in my hand test results that showed that the way that broker applied the moving average had a win rate worse than the baseline when tested on 7147 stocks over 14 years of stock market data. Clearly the broker wasn’t running that kind of testing. It’s up to the customers – us! – to fend for ourselves and find out what works versus what doesn’t.

How to Calculate MAs

When backtesting moving averages, the first decision is how to calculate the moving average. Do you want a simple moving average (SMA)? Or something designed to track price better such as an exponential moving average (EMA)? You might consider an experiment to compare the win rates of the two different averages. I did just that a couple years ago, and while I don’t have the results to publish, I came away with the notion that it didn’t make a big difference whether I chose SMA or EMA — just pick one and use it consistently. So for this project, I choose to use simple moving averages because I see them mentioned in commentary most often. To actually do the calculation, I relied on the built-in function which came with TradeStation. (The choice of backtesting engine is another decision which is general enough to write about in another post.)

How to Use MAs

Next you need to pin down how exactly you want to apply moving averages. How will you interpret the relationship between price and moving average? What rules will you use to decide when to buy and sell? You don’t have to read long about stocks before coming across a bullish reference to a stock trading above its 200-day moving average or its 50-day moving average, or even the 10- or 20-day MA. Or advice about buying stocks as they cross their 50-day or 200-day moving average. These are important rules to test in the backtesting engine. And then there’s the moving average crossover – a classic method of technical analysis. That makes three distinct ways of using moving averages to test.

Going more in-depth, some trading texts talk about the slope of a moving average. If you hark back to algebra and consider the MA as a line, to find its slope you would pick two points on the line and apply the usual formula ((x2-x1)/(y2-y1)). This brings up the question of how far apart to pick the two points which can make a difference to results. Really, since the MA is being used to identify the trend, we just want to know if it is sloping up or down. Then we can simplify the whole calculation by noticing that if the price is above the moving average, it must be pulling the average up, and a price below the MA pulls it down. Thus another reason to test the efficacy of price above the moving average.

Parameter settings

Once you decide on how to use the MAs, you need to pick a selection of various lengths to test. Beware of over-optimizing. Somewhere out there is a guy with backtesting results showing 3895% gain or whatever using just the right moving average. Too bad he doesn’t know what MA will produce those results in the future. That said, you need to try more than one length to make sure that your results aren’t a fluke. Stick with defaults settings or the ones you hear about most in the media. Finding the one perfect parameter setting is not going to make you rich. Finding a cluster of good, robust settings just might do you a great deal of good though.

As a practical matter when backtesting allow enough data lag before measuring. All tests must begin measuring at the same place for apples-to-apples comparison among different MA lengths. For example, if you’re testing a 200-day moving average, it will take the first 200-days of data to calculate the first point of that moving average. That means that the first day you could possibly have a signal is 200-days into the data set. To make a fair comparison with, say, the 10-day moving average, you need to make sure not to count any signals from the 10-day moving average before the 200-day is ready to go. Fortunately TradeStation has a way to set the “Maximum number of bars study will reference” in “Properties for All” strategies which forces the backtesting engine to wait that long before tabulating data.

More Profit from Buying or Selling?

Moving average rules, and in particular moving average crossover rules, are often discussed as a reversal system. This means that one signal, say the MAs crossing upwards is a buy signal and then its opposite, say MA lines crossing down, is not only a sell signal but also the trigger to go short. Theoretically, that’s just fine but many people are not interested in shorting the market. They are looking for techniques to help them buy and maybe sell. Even a person who regularly sells and sells short might use different techniques for buying and selling. For these reasons, it’s wise to test the buy signals separately from the sell signals.

This poses a dilemma because it’s hard to evaluate a buy signal in isolation. One way to do this is to use timed exits – that is, exit the trade or sell the stock after a certain amount of time elapses. I chose to run each backtest three times with three different times exits because different people have different styles and different needs. To produce backtesting results useful to swing traders, I exit after 2 days. To model position traders, 20 days. To meet the needs of active investors, backtesting holds each position for 200 days. This gives a way to isolate the buy signals and find out just how useful the moving average is to stock buyers of various temperaments.

Need to Define Goodness

One more very important thing to consider if you are backtesting moving averages to find out how well they do in the stock market: How will you know what is good? You need objective criteria for success. That means identifying the key statistics such as win rate, expectancy, hypothetical equity gains, etc. It also means setting standards for acceptable performance in each of these areas.

An example illustrates why this is important and why it’s not as easy as it first appears. Say your tests show a win rate of 55% for a particular indicator. That may might not be so good if, say, 62% of all stocks went up during the same period of time. Or if only 25% of stocks rose during that time period, your 55% win rate would be spectacular. What is good depends on how it compares to baseline market performance under the same conditions.

You can download a free copy of the BackTesting Report Baseline issue by clicking here.

Test Set

For a meaningful backtest, you need to have enough data to make a statistically valid comparison. At the minimum, that means 30 trades. Even if you are trading just one instrument – just one stock or just one currency pair – I think it’s important to test your trading strategy on many different instruments to prove its robustness. I went over the top with an extremely large test set — 7147 stocks over 14 years — to make sure my results would apply in a wide variety of market conditions.

You can get your copy of my backtesting reports on moving average buy signals by clicking here.

Tags: , , , , , , , , , , , , , , , , , , , , ,

Curve-Fitting Definition

November 4th, 2008 by jackieannpatterson | No Comments | Filed in Glossary

 Curve-fitting in general is the process of finding the (mathematical) description which best matches a given set of data.    When its not applied to trading strategies, it can be a very useful way of drawing conclusions from experimental data.

 When applied to trading strategies, curve-fitting can produce over-optimized, over-optimistic results.   In any set of price data, there is some “magic”  combination of indicators and parameters that catches most every move and shows outstanding results.    Unfortunately, that magic formula is the result of chance and is different for every data set.   That means that future results probably won’t come close to the numbers generated with the full benefit of hindsight.

Extra Insight: 

There’s a fine line here.   On the one hand, we want to use backtesting to see how trading strategies performed in the past with an eye to picking the best one to trade.    On the other hand, we don’t want to trade a fantasy strategy that has little chance of working in the future.

I’m using the term curve-fitting as the negative connotation of over-optimization and data-mining as the positive connotation of selecting the best of many strategies via backtesting. 

Here are three things I do to help avoid the pitfalls of curve-fitting:

  • Out-of sample testing, e.g. test and compare results across multiple time periods.
  • Select parameters which fall in the middle of a range of good parameters.   Avoid the outlier settings that produce much better results than their neighbors.
  • Forward-test new trading strategies in live trading with small amounts before committing to full size trades.

See Technical Traders Guide to Computer Analysis of the Futures Marketsfor more against curve-fitting.

(Backtesting Blog is an Amazon Associate.)

Last updated 11/11/08.

Tags: , , , , , , , , ,

Indicator Definition

October 27th, 2008 by jackieannpatterson | No Comments | Filed in Glossary
Price and Other Indicators

Price and Other Indicators

An Indicator is an abstraction of historical price data which is used to gain insight into the stock or market behavior.   Examples of popular technical indicators are Moving Averages, Bollinger Bands, MACD lines and histogram, RSI, Stochastic Oscillator.

Stockcharts.com has a good comprehensive definition of technical indicators.

Extra Insight:

Indicators describe past market action in a way that can be calculated by computer.   We can objectively define trading signals in terms of the indicators.  For example, we could define a buy signal as the stock price increasing above a moving average.

Its also possible to use indicators subjectively, but that greatly diminishes their value (IMHO).

Backtesting checks market action subsequent to an indicator’s signal.  Backtesting a large number of stocks over a large time period gives insight into how the indicator performed in the past.   Backtesting can only be done with objective rules for evaluating an indicator.

Even an indicator that tested well in the past may not perform well in the future — there are no guarantees.

An objectively defined indicator can help a trader make crisp decisions and trade by a system of rules rather than be ruled by emotion.

Updated: 11/12/08.

Tags: , , , , , , , ,

Naming Convention Definition

October 22nd, 2008 by jackieannpatterson | No Comments | Filed in Glossary

My trading strategies follow this Naming Convention:

[Direction]_Entry_TestPeriod_[Dataset]_Exit

where:

  • Direction is either L for buying long or S for selling short.   Direction is optional and if missing defaults to L.
  • Entry indicates the entry strategy used.
  • TestPeriod is the abbreviated years of the test data.   The data runs from May to April.  So 0407 means May 1, 2004 to April 30, 2007.
  • Dataset indicates the data vendor.   It is optional and defaults to CSI Data if not used.
  • Exit indicates the exit strategy used.

If one of the above field’s parameters are varied during the test, the exact settings for the run are shown next to it.   If settings are not given, then the commonly used settings apply.

For example, L_All_9404_CSI_Timed_200day

  • Trades Long (enters by buying stock)
  • Enter always
  • Spans the time period  May 1, 1994 – April 30, 2004
  • Runs on CSI Data
  • Exits on a specific time setting of 200 days

Another example, MACDH_0407_ATR3

  • Trades Long (enters by buying stock)
  • Enter when MACDH ticks up, settings 12, 26, 9
  • Spans the time period  May 1, 2004 – April 30, 2007
  • Runs on CSI Data
  • Exits on a trailing ATR stop of 3

Updated 11/12/08.

Tags: , , , , , , , , ,

Out-of-Sample Testing Definition

October 22nd, 2008 by jackieannpatterson | No Comments | Filed in Glossary

Out-of-sample testing is a way to guard against curve-fitting.   Its a good practice because we don’t know how the market will go in the future. When we ultimately trade our strategy it will be on live data as it evolves, not on the historical price data used for backtesting.

Here’s how out-of-sample testing works:  First a backtest is performed on a given test period.    Then the same backtest is run on a new test period — a different sample of data, hence the name.     If the parameters or settings were over-optimized in the first backtest, its unlikely that they will perform well in the second time period.   

For example, its possible to tweak the parameters on just the right indicators to make over 1000% gains in backtesting.    But when we run those same settings in another period, it might actually lose money.   If it is custom fit to one set of data, it won’t work as well in a different set of data.  Much better to find that out with an additional backtesting run rather than live trading!

Extra Insight:

With two different time periods, the results are almost always going to be at least a little different.   

The most challenging situation is if the original sample is a bull market and the out-of-sample is a bearish period (or vice versa).

My backtesting reports are broken into distinctly different samples for exactly this reason.

To be completely effective, the out-of-sample data should only be used once.   Each backtest should have its own out-of-sample data because if it is used frequently, the out-of-sample data too easily becomes in-sample data.  Using Monte Carlo method is better in this respect.    See Evidence-Based Technical Analysis: Applying the Scientific Method and Statistical Inference to Trading Signalsfor more information.

(Backtesting Blog is an Amazon Associate.)

Updated 11/12/08.

Tags: , , , , , ,