Posts Tagged ‘TradeStation’

Wealth Lab vs TradeStation for Back Test

November 27th, 2009 by jackieannpatterson | 4 Comments | Filed in Classes, Outside Products Reviewed

At the Trader’s Expo I watched portions of presentations on two different back test tools: TradeStation and Wealth Lab.   The most striking differences between them were not in functionality but in following.   The TradeStation talk in the exhibition theater area was packed, with people standing to watch.   Wealth Lab was discussed in a private room with very light attendance.

The difference in venue is not the root cause.  The (new) owners of Wealth Lab, Fidelity, restrict access to only customers trading in excess of 130 times per year with Fidelity.  If this limited access is a marketing ploy to get more active traders for Fidelity, I’d hazard a guess that its not working.

Too bad Wealth Lab is kept locked away because it sounds like it has features which are lacking in TradeStation.  Portfolio simulation, for example, is a capability often requested by TradeStation customers which is already available in Wealth Lab.

TradeStation, on the other hand, offers futures and forex which Wealth Lab does not support.  It also appeared as though Wealth Lab required more effort than TradeStation to set up the data for even basic back tests.

 As it stands, I’ve put TradeStation to work for a lot of back tests and didn’t see enough compelling capabilities in Wealth Lab to go through the pain of both switching software and lining up 130 trades per year at Fidelity.

What about you?  Which tools are you using?

Tags: , , ,

MACD Divergences on SPY Since 2001

September 17th, 2009 by JackieAnnPatterson | 5 Comments | Filed in MACD, Technical Strategies

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.

spy_macd_divergences_2002

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.

spy_macd_divergences_2004

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.  

spy_macd_divergences_2009

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 truthaboutmacd.com 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.

Tags: , , , , , , ,

TradeStation Users Group July 11

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

The July meeting of the Trade Station user group will be held at the Los Gatos High School’s community room on Saturday, July 11 at 10:00 am. Our speaker will be one of the members of our group, Jackie Ann Patterson.   Jackie is a stock trader and the editor of BackTesting Report.  She will give us a sneak preview of her Aug 2009 SF Money Show talk titled “The Truth About MACD”.  Drawing on her extensive backtesting of the MACD across 14 years of data on 7147 stocks, Jackie will highlight what worked and what didn’t, and reveal the top mistakes even the experts make when using MACD lines and histogram.   She will apply the lessons learned to several example charts, showing which buy/sell signals resulted in profits over 70% of the time plus how to do even better even with a lower win rate.    To take advantage of the most powerful MACD divergence signals, Jackie will demonstrate the semi-automatic process she uses to scan the markets for high-gain opportunities every evening.   We’ll do this with the latest end-of-day data so we can discuss whatever signals are active and current markets of interest to the audience.   

Hope you can attend this meeting.  Jim

Tags: , ,

My BackTesting Engine Evaluation in 2007

April 9th, 2009 by JackieAnnPatterson | No Comments | Filed in Backtesting Set Up

Before starting the current round of major backtesting, I evaluated several tools to decide which to use.    This article shares the highlights of that endeavor and the main reasons for the outcome.

TradeStation was my incumbent.  By 2007 when I made my last evaluation, I’d had a couple years of experience with it as a charting tool and a backtesting engine.    I’d also used TradeStation Radarscreen to scan the market for opportunities, but found it awkward and slow.   The backtesting had proved reliable but limited to running one stock at a time.     Then TradeStation came out with two critical enhancements:  a means to read in outside data for historical prices, and hooks to automatically process more than one stock per run.

Another favorite tool is Telechartwhich has been my top-down market analysis tool since 2005.    It doesn’t have a backtesting engine.   However, in early 2007 the Worden Bros who make Telechart had just come out with the Blocks Backscanner.    I tried it out extensively and really liked the super support as well as the flexibility.   Its strength is scanning through a huge list of stocks in incredibly fast run time.    But as a very young tool, it didn’t yet have all the features I wanted like independent data sources.  Plus, it was so new  in 2007 that I often felt like a beta tester which is exciting but not what I was looking for to prove out trading strategies.    

I didn’t get past reading the specs on other backtesting tools.    Trading Blox seemed to locked into their own strategies, plus a very high price tag.  I’d previously been exposed MetaStock, struggled with it back in 2004, and was not keen on revisiting it.   I had heard good things about Wealth-Lab but didn’t want to get locked into Fidelity, and didn’t see all the features I wanted there either.

So basically my choice came down to the new Blocks or my old standby TradeStation.   I came to the conclusion that the optimal way to proceed was to rely on each tool’s strengths.    So I use TradeStation for backtesting because I can set up the large-scale, controlled software environment for it.   This gives me a way to prove out a strategy which I do only once per strategy.

Once a strategy is proven and I’m ready to trade it, I usually want to scan the market for opportunities to apply it.   I do this daily, after the market closes, using Blocks 2.0 because it is so very fast at scanning the market.

I recently attended a class on Worden Stockfinder 4.0.  It looks promising –  the Blocks program grown up and renamed.  I’ll review my impressions in another post.

(Backtestingblog is a Worden affiliate, meaning I may be compensated if you buy their product.  Blocks, Stockfinder, Telechart are trademarks of Worden Brothers Inc.   TradeStation is a trademark of TradeStation. TradingBlox is a trademark of Trading Blox. Wealth-Lab is a trademark of Fidelity. MetaStock is a trademark of Equis.)

Tags: , , , , , , ,

Testing the Tester

March 19th, 2009 by jackieannpatterson | No Comments | Filed in Backtesting Set Up

Here’s another mind-numbing task when you are doing your own backtesting:  testing the tester.

This week I was forced to do something I don’t like at all.    I had to upgrade my backtesting software, TradeStation, to a new version in the middle of a set of runs.    But when my computer went whacko, upgrading TradeStation proved to be my only option to restore sanity.

The truth of the matter is that TradeStation hangs intermittently on 2 of my machines.   The other two are fine…so far.   I’ve posted the problem in the forums, taken lots of suggestions, but nothing seems to help for long.   Eventually, TradeStation gives a client access layer error, becomes unresponsive and needs to be shut down.    This leaves 2-3 TradeStation processes running which I manually kill.    Microsoft puts up a little warning box that says terminating a process unexpectedly may cause system instability, or some such.   Mostly its just fine, but do it enough times and Whacko!    I needed to re-install TradeStation and the only version available was one level up.  

In my previous career I had the priviledge of working with one of the best software engineering teams on the planet who’s customers are the best hardware engineering teams on the planet.     Many of those teams would avoid changing versions period.   But in the middle of the project, they really shied away.   When they did upgrade, as a mteer of course, many would run their own regression tests and compare the results between the old and new versions.

For this week’s upgrade, I did regression testing and am happy to report that the results of extensive backtests matched between new and old versions.   Too bad the intermittent failure still matches as well!

Even though it tested out okay this time, there’s always the potential for bugs to be introduced in a version change.   This goes not only for TradeStation but other backtesting engines and other software as well.    This is another important thing for you to think about if you are doing your own backtesting: you need to have a controlled process for introducing new software to make sure that unexpected errors aren’t introduced.

Tags: , ,

BackTesting Moving Averages

March 9th, 2009 by jackieannpatterson | 4 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: , , , , , , , , , , , , , , , , , , , , ,

How To Clean Price Data for Backtesting

December 16th, 2008 by jackieannpatterson | 2 Comments | Filed in Backtesting Set Up

Cleaning data for backtesting is not easy but its very necessary to get meaningful results.    Mis-adjusted price splits can skew the price data and mislead the unwary backtester into thinking they’re found the holy grail when the strategy merely happens to catch the good side of a bad gap.

Here’s the steps to screen out dirty data and produce a clean dataset:

1. Pick at least 3 candidate data vendors.

2. Format the data for comparison.

3. Write a program to do a smart comparison and run it on the 3 candidate data sets.

4. Analyze the mis-compares to see which set is in error.   if 2 of 3 sets agree, assume that’s the correct value and the outlier is wrong.

5. Send feedback to the data vendors so they can fix the errors.

6. Select the set of historical price data to use for backtesting and lock it down to prevent changes during the backtesting.

7. Feed the golden price data to the backtesting engine.

This process took me several weeks of work but was worth it to get accurate results.  There’s little point of going to the work of backtesting if the underlying data is riddled with errors.

Read on for details if you are going to attempt this on your own or if you just want to see what preparations go into serious backtesting. (more…)

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

ATR Trailing Stop Definition

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

The ATR Trailing Stop is one way to limit losses and protect profits. A stop loss order is set a multiple of the Average True Range (ATR) away from the current stock price. As the price moves in the trade’s favor, the stop rachets along with, always calculated from a better closing prices and never from worse closing prices.    This mostly keeps from giving ground once its protected by the stop, except in the case of increasing volatility as measured by the ATR.

Click here for Back Test Performance of Trailing Stops 

Chuck LeBeau popularized the method of trailing a stop loss order a few ATRs below the recent high price for a long trade. This method became known as the Chandelier Stop.    LeBeau’s Book covers other aspects of ATRs.   The best description of the Chandelier exit is in Come Into My Trading Room: A Complete Guide to Trading by Alexander Elder.

The ATR Trailing Stop is also known as a volatility stop.

Extra Insight:

In backtesting, the ATR Trailing Stop reflects each stock’s unique daily price range.  Hence it can fit each stock better than a dollar trailing stop or even a percentage trailing stop.

As with all trailing stops, the ATR trail never exits at the extreme of a movement. Hence it always gives back some of the profits.

The ATR stop amount can be subtracted from either the high, the close, or the low of the day.    Each variation gives slightly different results.    The important concept is to match the stop distance to the stock’s volatility and to move it along with improving prices.

ATR stops are not offered by brokers, to my knowledge.   They are also tedious to calculate by hand.   The only realistic way to use an ATR stop is with software support.   Programmable software packages such as TradeStation can be programmed to display (and backtest!) an ATR stop.   

Click here for BackTesting Reports on Trailing Stops

(Backtesting Blog is an Amazon Associate.)

Last updated 11/11/08.

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

Backtesting Engine Definition

November 6th, 2008 by jackieannpatterson | 1 Comment | Filed in Glossary
TradeStation Backtesting Engine Test Channel Trading

TradeStation Backtesting Engine At Work

The Backtesting Engine is the core software doing the backtest. 

It takes as inputs the historical price data and trading strategies.

The backtesting engine applies the trading strategies to the historical price data to get a series of hypothetical trades and records the results.

The outputs of the backtesting engine are typically performance statistics.    I have added instrumentation to gather additional information about each trade for later analysis.

Many backtesting engines are available commerically.    Well-known platforms include TradeStation, Worden Blocks BackScanner, WeathLab, Amibroker.    Many brokers such as TD Ameritrade offer backtesting engines for their customers.

In spite of the wide availability of software, many traders don’t backtest because of the huge amount of work it takes.    Reading a Backtesting Report is much easier.  :-)

Last updated 11/11/08.

Tags: , , , , , , , ,

Chart Time Scale Definition

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

The Chart Time Scale refers to the amount of time covered by each bar in a price chart. For example, here is a collection of three charts with different time scales for AAPL.

Weekly Chart

Weekly Chart

 

The bars on the weekly chart open with Monday’s opening price and close with Friday’s closing price.

 

 

 

 

Daily Chart

Daily Chart

 

The bars on the daily chart open with each day’s opening price and close with that day’s closing price.   This is the most frequently shown chart time scale.

 

 

 

15 Minute Chart

15 Minute Chart .Daily Chart

 On a 15-minute chart, each bar is 15 minutes wide. The first bar of the day opens with the market open at 9:30am and closes 15 minutes later at 9:45. The next bar opens at 9:45am and closes at 10:00am. This continues throughout the day with 26 bars showing the trading for the 6.5 hour regular session of each day.

Extra Insight:

Since I am using End-of-Day data for backtesting, the corresponding chart time scale is daily.

Different vendors calculate the weekly charts their own ways. TradeStation, shown above, always starts the week on Monday open and ends on Friday close. I believe this is the usual way of doing it. Telechart, however, closes the weekly bar as of the most recent close and uses the open from 5 days ago as the open of the weekly bar. So a weekly chart on a Wednesday in Telechart shows Thursday – Wednesday “weeks” for every bar on the chart all the way back.

Last updated 11/11/08.

Tags: , , ,