Trading System Special: Testing Your Strategy

Markets and conditions change, volatility fluctuates, and what worked yesterday might not work tomorrow.

https://tickertapecdn.tdameritrade.com/assets/images/pages/md/
9 min read
Photo by

You’re at a fancy French joint. The sommelier recommends three Bordeaux wines, each a great match for your dinner. “Gimme the middle one,” you say without much thought. After all, they’re red, about the same price, and will taste more or less like wine. Who cares, right?

One quick wine pick won’t make or break you. But if you choose a trading strategy like that you could be in for some bitter financial surprises. For example, consider three strategies, each of which had a 10% return in the previous year. They all involved buying and selling stock, and using technical analysis, as well as using stop losses. But they were nowhere near the same. Because all three might have had different risks, and had arrived at that 10% return along different paths.

Maybe one earned just under 1% return per month, every month, for the year. Maybe another was up 40% until a few weeks prior, and then gave back most of the profit very quickly. And maybe the last oscillated up and down 10% every month, and you’re now just seeing the up-10% oscillation before the next down 10%. Wouldn’t it be nice to anticipate and plan for potential variations with actual data and not with a bunch of guesses before committing to a strategy? There is.

Taking Actions: Swirl, Smell, Sip

Three metrics can help you see the various possible paths and make more informed choices.

1. Max drawdown

2. Winning trades/losing trades

3. Sharpe ratio

No guarantees, but using these metrics is another smart way of strategy testing before committing real dollars and getting waiters used to large tips. Let’s lean on thinkorswim® and a spreadsheet to test the strategies.

STEP 1: Mine the data

1. First, fire up your thinkorswim platform and go to the Charts tab. Click the Studies button/icon in the upper-right-hand corner. Then select Edit Studies to get the “Edit Studies and Strategies” box.

2. Click the Strategies tab in the upper-left-hand corner of that box. You’ll see pre-programmed technical studies you can backtest. (See Figure 1.)

undefined

FIGURE 1: FIND THE STRATEGY.

Using the strategy testing tool from thinkorswim takes you the firsts half of the way to determining if a strategy has what you’re looking for. For illustartive purposes only.

3. For this article, load up “Bollinger-BandsLE” and “BollingerBandsSE” by double-clicking their names and hitting the Apply button in the lower-right-hand corner. You should see both buy-and-sell signals that follow the rules set up in those Bollinger Band studies.

4. Refer to Figure 2 and hover your cursor directly over a buy-or-sell signal on the chart and right-click. You should see “Show report” in the drop-down menu.

undefined

FIGURE 2: TEST THE STRATEGY. Once you’ve plotted the strategy on a chart, the next step is to send its data to a spreadsheet to size it up more carefully with a few “go-to” metrics. For illustrative purposes only.

5. A “Strategy Report” box displays the buy-and-sell signals from that strategy along with P/L information we’ll be using in the following metrics.

6. You’ll also see a “Total P/L” number for that strategy. Of course, there’s no guarantee that its past performance will deliver the same future results, but if the P/L is positive, some will use that strategy to signal live trades with real money. At that point, click the “Export file” button in the lower-right-hand corner to dump this strategy data into a spreadsheet for detailed analysis.

Beyond that, you can’t see a lot of information about a strategy just by looking at its total P/L. But at this point, pull out your favorite spreadsheet program to analyze the following three metrics.

STEP 2: Work the spreadsheet

Once you’ve exported the data from Step 1 into your favorite spreadsheet, you’re ready to tackle the metrics.

METRIC 1: MAX DRAWDOWN

Losing money in a trade is like wine that’s turned sour. Unpleasant and gut-scratching at best. But what’s really sorta awful is realizing a nice profit, then giving it all back and more.

Max drawdown is the term that describes loss from the peak value of your account to its lowest subsequent value. For example, your account starts out at $10,000 and a trading strategy earns you $4,000. That takes your account value to $14,000. But the trading strategy has some losing trades equaling $8,000. That takes your account from $14,000 to $6,000. That $8,000 drop is your drawdown, and the max drawdown is the loss in value from the peak to the trough.

Generally, smaller max drawdowns are better than larger max drawdowns. The larger the max drawdown, the more dramatically the value of your account can change.

To reduce drawdown, you may consider experimenting with closer stop-loss prices or profit targets that would cut losses and take in profits more quickly. Doing so, however, might also reduce return.

HOW TO FIND IT: To locate a strategy’s max drawdown, export the data file we created into a spreadsheet. Calculate a running total for the Trade P/L column, which will show the impact of each new trade. Search for the highest value of that running total, then the lowest value after that. The difference is the strategy’s max drawdown.

METRIC 2: WINNING TRADES/ LOSING TRADES

Think about the P/L of two series of five trades. The first series has +$100, +$100, +$100, +$100, -$300, for a total of +$100 (less transaction costs). The second series has -$50, -$50, -$50, -$50, +$300, for a total of +$100 (less transaction costs). The total profit of the two series of trades is the same. But they get there differently.

The first series has four profitable trades and one big losing trade. The second series has four smaller losing trades, and one big winning trade. With the second series, you could face a lot of losing trades, which eats up your trading capital, until you hopefully get a winning trade large enough to offset losses. What if that winner doesn’t come for a long time?

The first series, on the other hand, is more manageable. Of course you don’t want one large loser to wipe out your profits. But you can analyze the strategy to see if something can be improved to avoid a large loss. It can be easier to solve a strategy problem with a few large losing trades, than one with a lot of losing trades and few winners. For example, adding a stop loss to the strategy might reduce the magnitude of the losses.

HOW TO FIND IT: To compare winning to losing trades, count the positive and negative numbers in the Trade P/L column of the spreadsheet you created from Metric 1. Consider the ratio of winners to losers, or the ratio of winners to total trades.

METRIC 3: SHARPE RATIO

Created by Nobel laureate William Sharpe, the Sharpe ratio is used by professional money managers to evaluate funds because it lets them compare strategies with a single number. The Sharpe ratio takes the return of the strategy, subtracts off the risk-free rate, and divides it by the standard deviation of the strategy’s returns. A higher Sharpe ratio can be better than a lower Sharpe ratio. When returns are high and their standard deviation (i.e. risk) is low, the Sharpe ratio is high. So, two strategies might have had the same return. But if strategy A has a standard deviation of returns (risk) that’s half the standard deviation of returns for strategy B, strategy A will have a Sharpe ratio twice as high.

Sharpe lets you compare two strategies, risk adjusted. In other words, for an equal level of risk, how much more return did one strategy provide? A high Sharpe ratio can mean returns were relatively stable—they didn’t fluctuate much from an average level. That can also mean drawdowns were smaller, and the ratio of winning to losing trades was higher.

HOW TO FIND IT

To calculate a simple Sharpe ratio for a strategy in the same spreadsheet, refer to the sidebar below (“How to... Create a Sharpe Ratio”), for details on each of the following four steps.

1. Divide the Trade P/L number by the stock price of the opening trade to get the trade’s return.

2. Calculate the average trade returns by adding up all the returns and dividing by the number of trades.

3. Then calculate the standard deviation of returns.

4. To get the Sharpe ratio, divide the average by the standard deviation.

Once you’ve got all three metrics—max drawdown, winning/losing trades, and Sharpe ratio—you’ll have more of a complete picture. Now, each of these numbers has limitations, so looking at all of them gives you a much fuller picture of the strategy. And one number isn’t necessarily better than another. So you don’t want to change the strategy to improve one metric at the expense of the others.

Print

Do Not Sell or Share My Personal Information

Content intended for educational/informational purposes only. Not investment advice, or a recommendation of any security, strategy, or account type.

Be sure to understand all risks involved with each strategy, including commission costs, before attempting to place any trade. Clients must consider all relevant risk factors, including their own personal financial situations, before trading.

 Backtesting is the evaluation of a particular trading strategy using historical data. Results presented are hypothetical, they did not actually occur and they may not take into consideration all transaction fees or taxes you would incur in an actual transaction.

adChoicesAdChoices

Market volatility, volume, and system availability may delay account access and trade executions.

Past performance of a security or strategy does not guarantee future results or success.

Options are not suitable for all investors as the special risks inherent to options trading may expose investors to potentially rapid and substantial losses. Options trading subject to TD Ameritrade review and approval. Please read Characteristics and Risks of Standardized Options before investing in options.

Supporting documentation for any claims, comparisons, statistics, or other technical data will be supplied upon request.

This is not an offer or solicitation in any jurisdiction where we are not authorized to do business or where such offer or solicitation would be contrary to the local laws and regulations of that jurisdiction, including, but not limited to persons residing in Australia, Canada, Hong Kong, Japan, Saudi Arabia, Singapore, UK, and the countries of the European Union.

TD Ameritrade, Inc., member FINRA/SIPC, a subsidiary of The Charles Schwab Corporation. © 2024 Charles Schwab & Co. Inc. All rights reserved.

Scroll to Top