Today’s Analysis – Example Using MACD Div Signals Pages

I’m posting my weekend market analysis today for two reasons: 

  • to illustrate how I use the MACD divergence signals
  • because it looks like something interesting may be afoot

Step 1 – Form an overall opinion of the market direction

I use several indicators, factors, and experts to form my overall opinion of the markets.   Some methods I’ve back tested, others await testing.  For today, I’ll cite the following:

  • McClellan Summation Index Negative Divergence
  • SPY down hard and closing at its lows, after exhibiting repeated negative MACD divergences
  • Weekly Trade Triangle Sell Signal — check out this video by Adam Hewison for a very articulate rundown

I come away with a bearish outlook for US stocks.

Step 2 – Check the Weekly MACD Divergences, then Daily MACD Divergences

Since my outlook is bearish, I will be looking more at the negative MACD Divergence signals.   I have yet to publish the back test results for shorting MACD Divergences but let me just say that I know to be VERY cautious with these signals on the short side.     If I owned any stocks on the negative divergence lists, however, I would sell them in a heartbeat, given my outlook from Step 1.

If my outlook were more bullish, I would examine the positive divergence signals for possible buy candidates.  But it isn’t, so I don’t.

Always check the larger timeframe first so that means looking at weekly charts before daily charts.  Whether you choose to review MACD Histogram divergences or MACD Lines divergences or both will depend on your goals and temperment.

I check in this order:

  1. Weekly MACD Divergences
  2. Weekly MACD Histogram Divergences
  3. Daily MACD Divergences
  4. Daily MACD Histogram Divergences

As of Friday’s close, two stocks appear as negative MACD divergences on all four lists: BIDU and SBUX

Step 3 – Gather more info about the candidate stocks

I check the charts of my two favorites from the lists.  Both charts look like reasonable negative MACD Divergences.   I also take a brief glimpse at selected Key Statistics.   BIDU is showing moderate but not overwhelming growth.   SBUX sports 4-figure earnings growth which I take to mean they have recovered a bit from the abyss.   Still MCD is making strong competition.

I also check my affiliate’s trade triangle trend analysis.  Again, I haven’t yet published my back test results but let me briefly say that my interest is to emphasize the Weekly Trade Triangle.   I don’t take all the signals but won’t trade against them, that’s for sure!

As it happens, SBUX  just got a weekly triangle buy signal so that scratches it from my list for now but I add it to my portfolio to watch.   BIDU is listed as “sideways mode” so that remains a viable candidate for a high-risk short sale.

Along the way, I noticed a fresh weekly triangle sell signal on AAPL.  That catches my eye because AAPL showed up on the weekly negative divergence list and my friends were talking about its upcoming product announcement Wednesday.   I also add AAPL to my watch list for consideration late in the week.

(if you want your own Trend Analysis, just click the symbol and enter your email address)

Step 4 – Apply Risk Management

The final step in assessing trading opportunities is applying judgement to reduce risk.  

I first consider what I know of my best current candidate from the steps above, BIDU:  its a crowd favorite that’s defied gravity before.  That’s not to say it hasn’t been knocked down, it just that as it hit a New High earlier in the week, I know it will come to the attention of lots of momentum traders.    

I decide to short BIDU, but select a risk amount on the small end of my scale.

I consider where to put my stop loss and realize due to the high price per share, it will be over $50 per share away from my likely entry point.  That means to keep my risk low, I will be trading very few shares indeed.   So be it.

I enter the order to sell short, along with an automatic stop loss and wait to see what next week will bring.

In summary, this is an example of my process of stock market analysis which highlights how the MACD Divergence signals can be used in the context of a broader market analysis.    I hope you can learn from this example and apply these tools to help your own trading.

MACD Divergence Signals

macd_histogram_divergence_weekly_chartThe new Signals pages give you a snapshot of the MACD divergence signals across all NASDAQ stocks.   This gives you a quick and easy way to find these elusive signals without flipping through thousands of charts.

In keeping with our mission as an educational resource, these MACD divergence signals are posted to show you an easy way to find examples for further study.   Before trading, we strongly enourage you to assess the track record for divergences — it is not perfect — by reading the definitive guide to MACD by Jackie Ann Patterson:

The divergences sought and presented by the scanners are:  

Check out the Signals pages today:

Profit Trading: How to Choose Buy or Sell Signals


Here’s a short interview at the MoneyShow on the topic of choosing buy or sell signals in order to profit trading and reduce risk of loss. Click here to play video

To summarize:

Before risking any money in the markets, I want to know that I have a reasonable chance to profit trading.   With that in mind while choosing technical indicators to give buy signals and sell signals, I first evaluate them by whether I think they will yield a profit trading.   My preferred method is to backtest and then publish the results in BackTesting Report.

Trying to figure out whether it’s the buy signal or the sell signal which is the source of profit when trading brings a chicken-and-egg problem.   Is the trading profit due to the buy signal or is the trading profit due to the sell signal?   One  way to sort this out is to first backtest the buy signals as independently as possible and then later backtest several sell signals using the buy signal that showed the most potential trading profit.

Backtesting Report does this by setting a timed exit, meaning that the strategy will sell after a given number of days.    This is not meant for real trading, even if it does show a profit.   It is simply to get an idea if the buy signal is any good.  

Different types of traders favor different timeframes.    To make the hunt for a good buy signal more realistic, BackTesting Report models three different types of traders and reports the win rate or percentage of profitable trades.   A timed exit of:

  • 200 days models an active investor who may hold a position for a year – potentially getting favorable capital gains treatment for trading profits. 
  • 20 days models a position trader who looks for trading profit after a few weeks in each trade.
  • 2 days models a swing trader who looks for a quick trading profit almost immediately but is willing to hold a stock overnight if necessary to ride a profitable trade.

If you already know what timeframe you prefer you can just look at the results for that timeframe.   I have also found it useful to compare win rates across different holding periods to help me decide which timeframe I want to target to maximize trading profit.

After picking a buy signal, then it is time to choose a sell signal.   The BackTesting Reports compare several different exit strategies for the same buy signal to see which results in the best potential for trading profit.   The main criterion for measuring potential for trading profit at this stage is expectancy. The different types of sell signals in BackTesting Report are in these categories:

  • Timed – as discussed above
  • Symmetric – often a mirror-image of the buy signal.  For example if the buy signal is moving averages crossing upwards, the symmetric sell signal is moving averages crossing downwards.
  • With stop losses – setting a fixed price to cut losses and sell.  Another technique is a trailing stop loss which raises the stop price as stock price moves up and trading profit accumulates.
  • With profit targets – picking a price or indicator configuration in advance to take profits

Here again it’s useful to look at the amount of time each strategy held a position and match it up to your needs.    Of course, the main point is to choose a strategy with the highest potential for trading profit.   

Along with backtesting results, it’s also a good idea to do forward testing to confirm the choice of buy signal and sell signal.

Of course there is more to learn about how to profit trading than just picking a buy and sell signal.  You need to decide how to opportunities to trade and how to keep track of trading profits and losses, for example.    Most important, is deciding how to manage risk to be sure to stay in the game and hang on to your trading profits!

For more info on technical indicators tested as buy signals and sell signals, see

MACD Divergences on SPY Since 2001

People at the MoneyShow and elsewhere ask me, “why MACD?”

The short answer is that seeing how MACD Divergences pointed out some very good times to buy stocks and ETFs motivated me to want to use MACD.  So I learned the basics, made some good trades and a little money.   It wasn’t all roses however and taking a few too many losses prompted me to do all this backtesting.

You can see how the MACD divergence signaled good times to buy in this 10 min. video and summary about the SPY.

Since not everyone will want to take 10 min to watch the video, here’s a brief summary:

The MACD positive divergence in Oct 2002 and the one in March 2003 originally got me interested in MACD divergence.  In the TradeStation screenshot below, you can see the green MACD technical indicator at bottom showing a divergence as price hits a new low but the MACD does not confirm with its own new low.   This is a classic MACD divergence.    The dark green line is the backtesting strategy registering a profitable trade between Oct 2002 when it got the MACD bullish divergence buy signal and Sept 2003 when it got the MACD bearish divergence sell signal. Click the charts to enlarge them.


Another interesting MACD divergence on the SPY takes place in Aug 2004. The SPY had been choppy in a trading range when the MACD bullish divergence signaled that this Aug bottom might be different. Sure enough the SPY broke out of the range. See the TradeStation screenshot below of the trade taken by the backtesting engine.


What has the MACD divergence done for us lately?  Check out this chart of a MACD divergence catching a good time to buy in March 2009.  This most recent profitable trade on the SPY (green line in the chart below) comes on the heels of three attempts to find a bottom during the credit crisis that didn’t work out.    So you can see from this chart that nothing is perfect and you can’t expect every trade to be a winner.  In fact, this is a sample size of only one — SPY.   You should not rely on this to be representative of future performance.  


These charts and video show why I am interested in the MACD.    I want an objective signal of good times to buy like Oct 2002 and March 2009.  However, I learned the hard way that its not enough to just see a few good examples and then go trade.   This is the beginning of the research, not the end. 

Are you interested in using MACD to find good times to buy stocks and ETFs? If so, here’s three steps you can take today:

1. Find out the historical track record of various MACD divergence signals.   I recommend reading the TruthAbout MACD series from BackTesting Reports. You can either get the reports directly from this link, or visit the new for a free video and CD-ROM.   If you are serious about trading with the MACD, the performance data in the backtesting reports is a must-read.

2. Learn to recognize a MACD divergence when it happens at the right edge of the chart.  The BackTesting Reports have some example charts, and the “Power Tools” book has a chapter on the MACD, or get the original Master Class to see Gerald Appel explain the MACD himself.  

3. Get software to scan the market for MACD divergence conditions. These signals don’t come around all that often so it helps to be able to find them when/where they occur. The software I use to scan the US stock market for MACD divergence is available by clicking here.

( MACD stands for Moving Average Convergence Divergence.  SPY is the Exchange Traded Fund (ETF) of the S&P 500 which is often used as a proxy for the whole US Market.)

Updated 10/16/09 to fix typos.

Stock Buy Signals

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. )

Stock Screens and Signals

With a rally coming together over the past week, I want to review two distinct and important elements of the buying process.   Before I jump in, let me say that I don’t claim to know if this is The Time to buy or not.  I do want to give you two steps to consider when making that decision for yourself.   They are:

  • Screening for candidate stocks
  • Signaling the time to buy (and sell)

This first, stock screens, is more time invariant – a fancy way of saying the list doesn’t change much day to day. In fact, you may not want to change you stock list much year to year as there is a lot to be said for getting to know a handful of stocks inside and out.   If you’re like me, you itch to scan a huge number of stocks to see offer up the best opportunities.   Of course, you can do both.  I have my screeners delivering new stocks every day and I also have my favorites that I’ve gone back to so many times over the years that I am part of the reason support and resistance works because I know from memory what is a low buying price and when to take the money and run.    On the other hand, a decidedly Bad Idea is obsessively returning to a stock on which you lost thinking that it “owes you”.  This is where an objective plan can really save you.

Sit down at a quiet time and think through the things you want in your candidate stocks.    I consider three categories:  practical matters, fundamentals, and technical screens.   Other folks might want to consider social values, or what their friends say, or worldwide demographics.    I have a hard time making the last three objective myself.

On the bare-bones practical side:

  •             Volume is a very measurable criterion that is almost pointless to test.   You need enough volume to get in and out.  Period.  I like to see at least 500,000 shares traded per day.
  •             Price is another area where it’s very easy to be objective – at least at the extremes.   If you want to be a penny stock trader – great!  Go be the best.   But most people choose $1, $5, or $10 and say it’s as low as they go.  
  •             Your risk limits drive a price/volatility limit.   If you risk only 2% of your account per trade (and that’s being generous), you can’t get into any stock with an average true range bigger than that amount.

Do fundamentals matter or is the sum total of available information reflected in the price?   You will have to make your own decision on that, dear reader, because the fundamental data I had at my disposal last I looked was not clean enough to make a good determination.    Even so, I do use fundamentals as a tie-breaker for the times when I get too many signals at once.   Then I’ll take the signals on the stocks with fundamentals (and story) to my liking.  A better way is to refine the objective rules to come up with just the right number of stocks to fit your account.

Technical stock screens are an important component of your plan.  They can and should be tested thoroughly.   First define what you want, say stocks in an uptrend, or beaten down stocks, or stocks trading in a nice range, whichever.  Then figure out which tool from technical analysis delivers the best candidates for your needs.  This means know how well the various technical analysis tools have performed.  This applies whether you are picking the short list of stocks you will grow with for the next couple years, or setting up a daily screen.   If it’s done right, your technical stock screener can give a solid list of candidates.   Remember, the point is not to go out and buy all of these right away, but instead to stalk them for the right time to make your move.

 For example, a moving average can function as a stock screener, where stocks above the moving average are said to be in an up-trend and stocks below the moving average are said to be in a downtrend.   Many experts recommend buying only stocks which are above their moving average, although some will say you can capture more of the move by getting in well below the averages.  Of course the advice varies on which length of moving average and what you use may depend on whether you have a short- or long-term outlook.    Click here to order your copy of the BackTesting Report on moving average stock screens and find out which moving averages have potential and which have not proven out as a stock screener.

 This post talks about screens stocks to build a candidate list that is bigger than you can use at any one time.   The examples — price, volume, above/below moving averages — showed objective, testable tactics that can identify out a candidate list.  But the stock screener doesn’t pinpoint the time to buy.   For that we need a more precise entry signal which I’ll discuss in the next article.

BackTesting Moving Averages

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.

Selecting Time Periods for Backtesting

When people say they want recent data for backtesting, I wonder two things:

1. How do they test longer term strategies using only recent data?   Anything involving a 200 day moving average, for example, needs nearly a year of data just to calculate the average.   Then it needs multiple years of data to get various signals and see how they play out.

2. How did they do in 2008 relying on anything resembling the recent past of 2003-2007.   It seems to me that you need to go back to 2001, at the very least, to find data that represents a crash.

When I selected time periods for backtesting, I looked for a nice long segment that included sideways, up, and down markets.   I ultimately decided on May 1994- April 2004 as the core time period for my testing.    This includes the tech bubble and the bubble bursting in a double-dip recession.  1994 showed less volatility, and the 1998 crisis broke up the monotony of the rising market.

Added to the core period is the next segment for out-of-sample testing.   I read somewhere (sorry, forgot where) that the out-of-sample period should be one-third the length of the initial period.   May 2004- April 2007 fit that bill timewise. The market action during this period was flat and upward biased.

Yes, I could detrend the data but I’ve found that approach very unintuitive.   If I am testing trend-following strategies, it doesn’t make sense to me to remove the trend.  Instead, I do a baseline test using a simple strategy and use it for comparison to supposedly smarter strategies.    This approach, and the fact that I apply it during varying market conditions, provides a way to see if a strategy really adds value.    A strategy demonstrates “alpha” by doing better than the baseline.

Another note about my time periods.   I began my efforts with this data set in May 2007.   Hence the time periods run May – April of each year.

My third time period, May 2007 – April 2008 came about because a) it was there, and b) this period is now one-third the previous period, making it the out-of-sample for the out-of-sample data.   As it turns out, the market action was again very different, allowing further stress-testing of the strategies.   Here again, I think it would be a mistake to focus solely on the carnage of the recent past.   Dawn has so far always followed the dark of night.

Signal Definition

A Signal is the specific event that says when to get in or out of a stock. 

Extra Insight:

Some signals are objective, for example price hitting a 52-week high.   Others are more subjective, for example magazine covers depicting emotional extremes can signal the end of a trend.

For backtesting, we need objective signals that can be evaluated by a computer program.

During backtesting, the computer will take every signal promptly. 

A human trader may ignore a signal or delay taking action — particularly if it is painful!  A human trader may also act even in the absence of a signal, buying when they feel like shopping or selling when they feel fearful, regardless of the signals from their trading strategy.   In this case, the profit/loss performance will differ from the backtesting result.

Updated 11/22/08.

Trading System Definition

Trading System refers to the whole set of rules, practices, and habits that make up the process of trading.    This includes market selection, portfolio selection, when to trade, which trading strategies to use when, entry signals, exit signalssizing, record-keeping, risk management.   The whole enchillada.

Extra Insight:

Even though I often use the terms interchangably, I think Trading System is bigger than Trading Strategy.

A Trading System is said to be either mechanical, discretionary, or a mixture of the two. 

Most mechanical systems are run by a computer, but they need not be.  A person could conceivably make manual calculations and monitor trades according to rigid rules.   Even in a fully automated mechanical system, the human element is present — someone must decide which system, when to turn it on, how to keep the computers running, etc.   However, backtesting is an obvious step in the development of a mechanical trading system. 

For discretionary traders, modern trading also relies on computers acting according to fixed rules.  For example, many people, wheither they consider themselves traders or investors, fundamental or technical, consult stock charts populated with their favorite analysis techniques and indicators.   Backtesting can inform the judgement of a discretionary trader by outlining the potential performance of various strategies and indicators.

Ed Seykota often says that a trader’s system is really the set of emotions he/she is unwilling to feel.  (See Sat, 17 July 2004 in his Trading Tribe FAQ).   I feel like dodging by saying the emotional side is beyond the scope of this blog.  

Now that I think about it, its not so hard to backtest a general example with software.    For example, the Rational Choice book cites a few studies that prove our human tendency for loss aversion.  To codify that, write a system with: 

  • no stops in order to avoid the pain of taking a known loss,
  • close targets to avoid the pain of giving profits back, and
  • quick file deletion to avoid the pain of knowing its unprofitable. 

(Backtesting Blog is an Amazon Associate.)

Updated 11/13/08.