Skip to content
Prices at 10:30
ChartsView
  1. Home
  2. Blog

How to Backtest a Trading Strategy in MetaStock, Step by Step

How to backtest a trading strategy in MetaStock, step by step

Backtesting means running a set of trading rules over past prices to see how they would have done. It is the quickest way to find out whether an idea has any edge before you put money on it. This guide walks through doing it in MetaStock’s System Tester, step by step, in plain English.

Before you start

You need MetaStock installed with price history for the shares you want to test. If you do not have it yet, the 30-day free trial includes everything below.

Write your rules down first, in words. For example: buy when the close crosses above the 50-day moving average and volume is above its 20-day average; sell when the close crosses back below the 50-day average. If you cannot write it in a sentence, you cannot test it.

Step 1: open the System Tester

In MetaStock, open the Power Console and choose System Tester. You will see a list of ready-made systems. You can test one of those straight away, or click New to build your own.

Step 2: enter your buy and sell rules

A system has four boxes: Buy Order, Sell Order, Sell Short and Buy to Cover. For a simple long-only test, fill in the first two and leave the short ones empty. Our example looks like this:

  • Buy: Cross(C, Mov(C,50,S)) AND V > Mov(V,20,S)
  • Sell: Cross(Mov(C,50,S), C)

C is the close, V is volume, Mov is a moving average and Cross means one line crossing another. The formula language looks odd at first, but there are only a handful of words you need, and the built-in editor lists them all.

Step 3: choose what to test it on

Pick the shares to test. Testing on one share tells you very little. Test on a list of 50 or 100, for example the S&P 500 or a sector list, so the result is not down to luck on one name.

Step 4: set the dates and the money

Choose a date range of at least five years so the test covers both rising and falling markets. Set a starting balance, how much to put in each trade, and a realistic cost per trade. A system that only works with zero costs does not work.

Step 5: run it and read the results

Click Start. When it finishes, the report shows, for each share and overall:

  • Net profit: what it made or lost.
  • Win rate: the share of trades that made money. Many good trend systems win less than half the time and still make money, because the wins are bigger than the losses.
  • Average win and average loss: the ratio between them matters more than the win rate.
  • Biggest drawdown: the worst fall from a peak. If you could not sit through that in real money, the system is not for you.
  • Number of trades: under 30 trades is too few to trust.

Step 6: do not fool yourself

The biggest mistake is tweaking the numbers until the past looks perfect. A 50-day average that becomes a 47-day average because it scored better is curve-fitting, and it will not hold up. Good habits:

  • Test on one set of years, then check the result on years you did not use.
  • Prefer a system that does “fine” across many shares over one that does brilliantly on three.
  • Keep the rules simple. Every extra condition is another way to fit the past.

Step 7: turn it into a scan

Once a system holds up, paste the buy rule into MetaStock’s Explorer. Run it each evening and it lists the shares giving that signal today, which is what you actually trade. Our learn-to-trade guides have more set-ups to try, each with real chart examples.

Affiliate note: ChartsView may earn a commission if you start a MetaStock trial through our link. It does not change the price you pay.

Use the arrow keys to move and Enter to openSearch every page

Share tips