Tuesday, October 31, 2006

Sy Harding's Seasonal Timing Strategy (STS)

The other day I came across Sy Harding's website. Until recently I had never heard his name. His website claims that Timer's Digest consistently ranks him as one of the best market timers in a number of different markets. I saw his name mentioned in a mini-article on pg. 58 of the 2001 issue of the Stock Trader's Almanac that I found in the back of our trading library closet. I was looking through it for fun because I initially thought it would be full of superstitions and statistically insignificant claims of the market tending to go up at a particular hour on a specific day of the year. Although the book does contain some questionable claims on specific seasonals, it actually has some very useful information on the history of the stock market.

The mini-article claimed that Sy Harding had improved upon the traditional Sell-in-May-and-Go-Away seasonal market timing by using a daily Moving Average Convergence Divergence (MACD) indicator as confirmation of a short-term rally being under way. I read the page where he explains how he improves the traditional seasonal system. Basically when the seasonal date of October 16th comes around, he checks to see if the MACD is positive (on a buy signal). If it is, you get in October 16th. Otherwise, you wait until the MACD goes positive before buying. For the exit, on April 20th, you check to see if the MACD is on a buy. If it is, you stay in until it goes negative. If it is negative on April 20th, you sell immediately.

Questioning the Claims

I was very suspicious at first because the mini-article in the 2001 Stock Trader's Almanac states:
"Applying Harding's signals generated for the Dow, to the S&P, show astounding results. Instead of $10,000 gaining $363,353 over the 50 recent years [1950 to 1999] when invested only during the best six months, the gain almost tripled to $901,761."
If I'm not mistaken, the Almanac says that the gains of Harding's slight alteration results in THREE TIMES the ending value than if you only bought November 1st and sold April 30th. What I think they mean is that Harding's strategy triples the S&P buy-and-hold return not the traditional November-April seasonal strategy. I couldn't resist backtesting it myself so yesterday I wrote some AIQ Expert Design Studio (EDS) code to approximate Harding's strategy:

SEASMACD.EDS (To download, right click and choose "save target/link as").

(Note you need AIQ's Trading Expert Pro and Expert Design Studio to run this file.)

The EDS output didn't give me what I wanted so I used my Excel date converter to shift the dates back one trading day so that I could create a signal file for the ULTRA market timing program I've been using. Then I tested both the S&P500 and DJIA to see if I could at least come close to the returns the Almanac was claiming for the S&P500 and the returns listed on Harding's explanation page for the DJIA.


As I suspected, the article most likely meant to say that Harding's strategy triples the S&P buy-and-hold return, not the November to April seasonal strategy. Although I don't show the results here, Harding's MACD entry strategy only does 1% better in terms of Compound Annual Return (CAR) than does buying November 1st and selling April 30th. However, 1% CAR edge adds up over 50 years.

Below, I replicated the 1950-1999 Harding strategy for the S&P that was listed in the 2001 Almanac:

(Click image to enlarge)

(ULTRA Market Timing was used to run this backtest)

In fact, my backtest shows a slightly higher Compound Annual Return (CAR) than does the table in the Almanac. The Almanac shows a starting account value of $10,000 in 1950, growing to $901,761 by the end of 1999. If you use Excel or a TI-83 calculator to compute the CAR, it comes to 9.41% per year. My backtest shows a CAR of 10.97%. This difference is probably a result of slight differences in the S&P data, the entry and exit dates, and the risk-free rate earned on cash while not invested.

Next I wanted to confirm the claims made in "Table 1" on Sy Harding's page (scroll down till you see Table 1). I was able to corroborate the claims for the 8 years of returns for the DJIA:

(Click image to enlarge)

The left column shows the market returns and drawdowns. The right column shows the Harding strategy results using my approximation of his strategy. The returns almost exactly match his.

If tested on the DJIA over a longer period from 1950 to 2006, the findings are robust:

(Click image to enlarge)

(ULTRA Market Timing was used to run this backtest)

As you can see the Compound Annual Return (CAR) remains high, at 11.29%.


Overall, this seasonal strategy is great (especially IF it continues to work in the future) because you make better than average returns with only being exposed 51% of the time.


Sunday, October 29, 2006

Give Me Stock Index ETFs Instead of Candy for Halloween

In my search to find out whether "sell in May and go away" seasonality exists in the U.S. stock market in a statistically significant way, I've been doing a little reading on the Internet.

Although I had shown this seasonal effect with an Excel analysis, I was still perplexed as to why this seasonal hasn't disappeared over the years. If everyone knows about seasonality, why doesn't it go away or start shifting backwards?

Remember that people (like myself) want to come up with an explanation for something that doesn't necessarily have a simple solution or cause. This often arises from the human tendency to equate correlation and causation. For example, if I buy some Google stock on Monday and the stock goes through the roof on Tuesday, I might conclude that the new type of coffee I drank on Monday caused my success in the market. The point is that people try to find simple causes for phenomenon that are most likely a result of a combination of factors. Having been warned, I have collected for you a number of links I found that provide some different explanations for this seasonal effect. Some of them are quite convincing:

(Please note that I do not advocate any of the following services or websites. I have not tried their services, nor do I have any commercial relationship with them):
In my own analysis I have found that the period from October 27th to first week of November is the most bullish (on average) for the stock market. This period is almost an outlier when you analyze the S&P500 average seasonal history. Why might this be?

It must be all those trick-or-treaters scaring people to give away their money and candy on Halloween. Then those damn kids sell the candy to younger kids and invest all the cash in the stock market! OK, let's be reasonable. Mutual funds fiscal year-end happens to coincide with Halloween. If you get quarterly or annual prospecti or reports from a mutual fund company like Fidelity, look at the year-end date for their financial statements. It's October 31st in most cases.


Saturday, October 28, 2006

Portfolio 123

We've been using Portfolio 123, a do-it-yourself technical analysis / fundamentals hybrid site for a portion of our portfolio. It allows you to create "technimental" based models to rank and filter a universe of stocks with fundamental ratios and custom buy and sell rules. The method of ranking is similar Joel Greenblatt's "magic formula" method of picking stocks from his book "The Little Book That Beat the Market" that I recently read.

Portfolio 123 is great if you want to build your own ranking model, which is especially useful when it comes to picking small-cap stocks. One of the users with the username DennyHalwes has managed a 1-year 119% excess return over the SPX with his proprietary small-cap Portfolio123 model.

I recommend you check it out: http://www.portfolio123.com/


Wednesday, October 25, 2006

New EDS Code Files Posted

Recently, Rich and I have been building our Traders Edge Systems website.

Just yesterday we posted several EDS files containing the code for many of AIQ's built-in indicators. Using the recoded versions of the built-in indicators is superior to the default way (using "[indicator]") because you may want your custom trading system to assume different parameter values from those that you manually change in the charts module. If you design a system using the default " [ ] " way of referencing the built-in indicators, and then manually change the parameters of those indicators in the charts module, your custom system will suddenly return different results in a backtest!

If you want you can download the EDS files for free, please see the EDS Code Section of our website. Soon we will post Rich's custom EDS indicator code in the same area.


Monday, October 23, 2006

The Little Book That Surprised Me

Joel Greenblatt, hedge fund manager and professor at the Columbia Business School, recently published a short book about a value investing strategy that even teenagers can understand without any prior knowledge of finance, technical analysis, or the stock market.

The book is called: The Little Book That Beats The Market.

I'm surprised at the elegant simplicity of the book and the apparent success of the "magic formula" that Greenblatt explains. The formula is not a complicated multi-factor finance model but rather a three step process of ranking all the stocks by size and then by two fundamental ratios based on traditional value investing principles. The book is funny, light-hearted, and really easy to read. It would make a great gift for any young person who wants to learn how to invest or who just doesn't know what to do with extra investment money.

The Little Book That Beats The Market is not just for greenhorns: For experienced investors Greenblatt includes all the details of his study's methodology in the appendix. For me, the appendix helped because throughout the beginning of the book I remained skeptical until he explained the details of how he constructed the "magic formula's" database and how he dealt with typical data mining issues such as survivorship bias and look-ahead bias.

After being convinced that the strategy probably works at least moderately well over a long period of time (it is NOT a short-term trading strategy), I decided to check out the book's website that provides current rankings for the "magic formula." The book contains the extremely simple instructions on how to use the formula to actually beat the market over a long period of time.

Overall, the book (and accompanying website) were well worth the money. I highly recommend it to anyone interesting in investing. Those interested in value investing should also check out the classic value investing bible The Intelligent Investor and perhaps The Little Book of Value Investing as recently reviewed by experiglot.com.


Wednesday, October 18, 2006

Most Active FOREX Market Times

After reading Kathy Lien's informative article, "Around the Clock Trading: Day Trading the Currency Market" in the October 2006 issue of SFO Magazine, I decided to make a chart of the Asian, European, and U.S. FOREX trading hours, their overlaps, and the times economic data is usually released in each market:

Click on table to enlarge:

In the original Excel file, I created an identical chart on another tab in Pacific Standard Time. Here's the original Excel file with both time zone charts:

FOREX Markets Trading Hours Excel Chart.xls

This information would be useful for determing the best times to day trade the FOREX market. The most money can usually be made when the biggest market participants are in the game.



A Primer on FOREX for Stock Traders

Last week I attended the 17th annual AIQ seminar at Lake Tahoe in Nevada. I have been attending the AIQ seminars as both a student and as a presenter since the mid 1990’s and this year’s presentations were among the best I have seen. I participated in the Traders’ Panel and also helped attendees with AIQ EDS coding of their trading ideas.

Steve Hill, CEO of AIQ Systems, presented a primer on FOREX trading. Most attendees are stock traders so his presentation was a valuable primer on the ins and outs of trading FOREX. The advantages of trading FOREX or foreign currency pairs include:

• Extreme liquidity
• 24 hour trading
• Small spreads
• No commissions
• Extremely high leverage available (100:1)
• Very few currency pairs to follow

A currency pair, such as the Euro & US Dollar, symbol EURUSD, is just the exchange rate with the first listed currency being the base currency and the second being the counter or quote currency. FOREX is traded in 100,000 units of the base currency. So if you buy one unit of EURUSD you are buying 100,000 Euros and simultaneously selling the equivalent amount in U.S. Dollars. The minimum unit of movement is 1 pip, which usually is worth $10. A one pip move is equal to a 1/10000th change in the exchange rate price (0.0001) for an exchange rate like EURUSD, where the minimum movement is .0001. This is the norm, but with some cross rates, such as USDJPY, the pip amount is the smallest amount the rate can move, in this case .01. Although there are no commissions, there is a cost to trade based on the bid to ask spread which the broker keeps. The spread is usually 3 pips so it costs about $30 to trade one unit of FOREX per side or $60 round trip. As I am writing this, the EURUSD is quoted at 1.2531, which means that I must pay $1.2531 for each Euro if I want to change dollars for Euros. One unit of FOREX on this pair is worth $125,310 and to buy this you need a minimum in your FOREX account of $1,253. FOREX brokers will automatically close out your positions if your account equity drops too low (there are no margin calls).

The following are 60 minute and daily charts and a quote screen for three FOREX pairs:

(Click to enlarge.)

The EURUSD move on the daily chart from 1.2800 (9/22/06) to the current value of 1.2531 (10/18/06) is a negative 269 pip move worth $2,690.

Number of Pips (269) = (1.2800 – 1.2531)*10000
Total Amount ($2,690.00) = [(1.2800 – 1.2531)*10000]*$10 per pip

Lets says you use a formula that you will never be more leveraged than 5 times the minimum margin requirement, selling the EURUSD at 1.2800 on 9/22/06 would have made $2,690 on a deposit of $6,400 (5 x $1,280) for a 42% profit in 19 days.

I am primarily a stock trader but I have traded futures of all types. My current interest in futures and FOREX is to develop an auto trading system that could be used in conjunction with my Tradestation account. The idea behind auto trading and mechanical system trading in general is to spend time developing and testing a complete system (more on this later) and then use the automatic trade entry and exit feature to allow the system to run continuously with minimal trader intervention. I don’t like spending my working hours watching a chart screen, so auto trading appeals to me. Trading systems are much like casino games where the good ones have an edge for the house. The longer and more often that a casino game is played, the odds or edge will come out and favor the house. Applying this concept to trading systems that have an edge (meaning the winning trades make more than the losing trades lose), FOREX would have a great advantage over stock trading or e-mini futures trading because the overnight markets are just as active as the day sessions whereas in stocks there is no overnight market and in e-mini futures, the market is usually very inactive in the overnight sessions. In auto trading FOREX, we could run our systems(s) 24 hours a day with almost no monitoring. More opportunities plus a system edge equals more profits.


Monday, October 16, 2006

ULTRA 9.0 Market Timing Software

For the past few months, I have been using a software product called ULTRA Market Timing Software (version 9.0). So far it has proved to be a useful tool in testing an infinite number of strategies in a simple way. Here I briefly review some of its features and ways in which I've used it.

Features of ULTRA

Aside from the basic charts it generates, ULTRA 9.0 is not about fancy graphics and charts:

(Click to enlarge.)

The power of ULTRA 9.0 lies in its ability to run many iterations of optimization runs and customize a system or combination of systems in many ways. What it lacks in aesthetics, it makes up for in power and flexibility. For example, if I have an existing trading system that I have created with another software package, I can export that system's buy and sell dates to a text file and use it in combination with systems that come with ULTRA 9.0.

ULTRA 9.0 comes with the ability to perform speedy daily downloads of important market data such as Open, High, Low, Close for the major indices (NDX, SP, RUT, DOW), the COT (Commitment of Traders) report data, NYSE advances and declines, treasury bill and bond rates, sentiment data (Public vs. Specialist Short Sales), CBOE Put/Call Ratio, the VIX (volatility index), and prices for metals and oil.


Once I have several signal files for individual systems, I can use an optimizer to help me choose appropriate weights for each of the individual systems. I can also optimize the percentage to go long or short depending on the signals of the individual systems:

20% buy signals; -25% short.
40% buy signals; 25% long.
60% buy signals; 50% long.
80% buy signals; 100% long.
100% buy signals; 200% long (on margin).

I'm still learning how to correctly use the signal file optimizer (an add-on) but so far it has saved me a lot of time in refining my existing seasonality model for trading the NDX and S&P500. Right now I'm waiting for ULTRA 9.0 to finish an optimization run of 77760 iterations (or permutations) of different weights for a composite strategy I developed.

In ULTRA 9.0, I am able to optimize and customize the individual systems that come with the program. Some of them are not very sophisticated by themselves but the synergy of the individual systems together may have some real potential. As always, I think it's necessary to have a hypothesis as to why a particular combination of systems might work before letting the optimizer go to work (and erroneously lead you to the conclusion that you would have been able to make 100% a year through a freak outlier trade).

I can test an individual system, a composite strategy (combination of systems), or a broad portfolio of composites on an imported data file or on one of the built-in and regularly updated indices such as the NDX, DOW, RUT, or S&P500. Similarly, there are three levels of optimizers: you can optimize the parameters of an individual system, the weights of a number of systems for a composite strategy, or the allocation percentages for a portfolio of strategies. For example, you might have a bond trading strategy that uses 5 individual systems, a NDX trend following strategy that uses 5 different systems, and a S&P500 strategy that uses yet another 5 individual systems. I can use the portfolio optimizer to determine the optimal amount to allocate to each of the 3 strategies, the composite optimizer to determine the weights for the individual systems within each composite, and the system optimizer to determine the parameters for each system.


After doing many analyses and optimizations with ULTRA Market Timing, I've found that I must examine the results carefully. For instance, one particular optimization may have a 900% CARWI (Compound Annual Return While Invested) but only make a 0.1% CAR (Compound Annual Return) during the test period. This case arises when the system only took one short trade; therefore, the system was only invested for a few days out of a 50 year test period. As I write this, I'm running an optimization whose results I plan to export to Excel and then create new sorting variables. I might divide the CAR by the CARWI, sort on that new variable, and then do a secondary sort on the Ulcer Index.

Overall, I'm enjoying the power ULTRA affords me in making market timing models even though it is somewhat time-consuming. The only downside is that it is not always that intuitive to learn without the accompanying manual. However, if you read and learn the contents of the relatively short manual, you will find a very powerful tool in your hands.


Please note that I do not have any commercial or financial arrangement with ULTRA Financial Systems, Inc. If you're interested in learning more about the software you can visit their website

Monday, October 09, 2006

Seasonality in the S&P 500? A TASC article reexamined

Does monthly seasonality exist in the S&P 500 and other stock indices? These days, everyone seems to believe it does but I wanted to make sure. Some technical analysts were not so convinced back in the early 1990s. For my recent research on the seasonality of the the stock market indices, I have been reading old articles from 1990s issues of Technical Analysis of Stocks and Commodities magazine.

Because of a few statistics classes I took, one article piqued my interest more than others; the author used t-tests and their resulting p-values to determine if any given month in the S&P 500's history was significantly different (that is, statistically different from random) from any other month in the year over the history of the index.

If you have the old issues you can follow along: Technical Analysis of Stocks & Commodities V. 10:8 (339-343): Detecting Seasonality by Lewis Carl Mokrasch, Ph.D.

In his article, Dr. Mokrasch describes the exact Excel layout and formulas he used in examining the seasonality of the S&P. He finds "no evidence for the so-called summer rally or the November to April stock swing." I was curious and skeptical enough to repeat his Excel layout because I had performed my own seasonality analysis in Excel for the major stock market indices only a few weeks earlier and showed vastly different results than those of Mokrasch. My results indicated that there are at least large visual differences in the average returns of certain months and weeks of the year. The old adage of "Sell in May; don't come back till Labor Day," actually would have tended to work most of the years since 1950 according to my analysis.

After a few hours of mimicking Mokrasch's Excel worksheet, I soon discovered why he found no significant differences between the months: The t-tests he performed were comparing the average of one given month (say, all the Januarys from 1961-1990) to the total average of any given month across the entire period tested (the average of all the 480 months from 1961-1990). While this is statistically and mathematically valid, I reasoned that in order to test for monthly seasonality, I needed to compare each month's average to every other month's average, not to the total average of the whole period. For example, wanting to know whether January's average significantly differs from September's average will give you a much different t-statistic and p-value than will comparing January's average to the average of all the months from 1961-1990.

Upon discovering this flaw, I tested each month's average to all of the other individual month's averages (i.e. January compared to February, January compared to March, January compared to April etc.). These results show that there was a very significant difference between many of the individual months. The following chart shows the probabilities that the difference between the averages of any two months is due to chance using Mokrasch's test period of 1961-1990.

(Click to enlarge.)

Therefore, in arguing my case, lower p-values are better; in science, p-values below .05 are generally accepted as "significant." For easy visual examination, I have turned on conditional formatting in Excel so that the darker blue cells stick out as the most significant. As you can see, November, December, January in particular significantly differ from many other months. Here I confirm that September is significantly different from November, December, and January, and show that there are many other significant differences.

If we increase our sample to 1950-2005, and the seasonal effect is still there, we should see even lower p-values. Here's the same chart but with a larger sample:

(Click to enlarge.)

So the answer to the question in the title is an emphatic YES: there is statistically significant seasonality in the S&P 500.

This goes to show that it pays to examine others' results carefully before accepting them as fact. (You should examine mine carefully too! If you have questions, please e-mail me at paul@tradersedgesystems.com or leave a comment.)

To Mokrasch's credit, I should add that his methodology was otherwise very reasoned; the fact that he properly detrended the data and that he used statistical inference testing to examine seasonality in the first place demonstrates his understanding of the issues at hand.


Saturday, October 07, 2006

Traders Edge Systems - First Post to Our Blog

Our goal is to provide readers with relatively concise and practical information about the stock market and trading. We plan to post on a weekly basis or more frequently if we have something special to talk about. We hope you will add us to your RSS Reader if you find our commentary useful.

Our team is composed of two different traders: Rich and Paul. We recently launched our website, http://www.tradersedgesystems.com/.

Rich & Paul