MetaStock – The System Tester

Introduction to The System Tester

The System Tester is probably one of the least understood tools within MetaStock. That said, it can be quite useful for testing different trading systems. By using this tool we can program in our entry and exit conditions, and then be provided with an in depth analysis of the results. Ultimately we can find out if we were to have traded this system, using historical data, would we have made money. Moreover, we can then optimize our system to make it the most profitable it can be.

The System Tester Options

Before trading any system it’s best to know as much as possible about it. So let’s learn to use MetaStock’s primary testing tool, The System Tester.

Select The System Tester by either clicking the dollar symbol on the Standard Toolbar or by selecting it from the Tools drop down menu. This will open the ‘Power Console’ and show the System Tester, shown below:

systemtester1

On the right hand side of this screen within the Power Console, click on the ‘Trade Options’ button.  You should see something like below:

systemtester2

The ‘System Test Options’ dialog allows us to change the way in which our results are shown on the chart, after a simulation has been conducted. Later on in this chapter, we will discuss how the individual trades taken can be represented on a chart.

The ‘Trading Signals’ section allows us to change the colours of the signals that are used to represent various actions (e.g. buying and selling). We can also elect to disable these signals by deselecting the ‘Display Trading Signals’ box.

The ‘Label Signals’ box, when checked, will place additional information accompanying the various signals throughout the chart. Two numbers will appear with each signal. The first number represents how many shares were bought or sold and the second represents the trade number.

The ‘Equity Line’ section allows us to plot an equity line in a new inner window. This represents the change in equity over the simulation. Finally, the ‘Results Cleanup’ section allows you to manage the number of simulation results stored within the System Tester. Using this option, after a set number of simulations have been performed, ou will be prompted to run the ‘Cleanup Wizard’. This allows you to delete system tester results.

Creating a New System Test

Let’s return to creating our own system test.  Back in the Power Console, right mouse click on System Tests X of Y, and select ‘New System’ – the ‘System Editor’ dialog will open, shown below:

systemtester3

Notice there are 7 separate tabs. The ‘General’ tab is where we record the system’s name and enter notes. The ‘Buy Order’, ‘Sell Order’, ‘Sell Short Order’, and ‘Buy to Cover Order’ tabs are where we define our trading rules. In other words, the criterion required to initiate or close a position. The remaining tabs are the ‘Stops’ and ‘Optimization’ tabs, which we’ll cover shortly.

First things first though, from within the ‘General’ tab, enter the name for our system test (i.e. “MetaStockAustralia.com”).  Directly beneath the name there is a notes text box where we can insert any relevant information about our system test.

Some trading systems are designed to go long; others to go short; while some go both long and short. Using the ‘Order Bias’ options, we can identify the bias of our system. Since this example system is primarily a ‘long’ system, set this option to ‘long’.

‘Portfolio Bias’ allows us to further distinguish our system by indicating if it is designed to be tested on a single security or whether it will be tested on multiple securities. In our example, we’ll set this option to ‘Single’.

The final option available in the ‘General’ tab is known as ‘Positions Limit’. This allows us to limit the number of positions our system may open on any one security, at any one time (otherwise known as pyramiding). Although some believe pyramiding to be a successful strategy, others believe that you are taking on more risk by holding a larger position. In our example, we’ll leave this option set to its default value of 1.

Let’s now enter the information into the ‘Buy Order’ tab, as shown below:

C > Mov(C,30,S)
AND Mov(C,30,S) > Mov(C,150,S)
AND C>0.5
AND Mov(C,21,S)*Mov(V,21,S)>300000

This code is pasted into the Formula text box and is shown below:

systemtester4

We can now move onto configuring the other options available within the ‘Buy Order’ tab.

  • Order Type: Allows us to test different order types; this maybe useful if you receive intra-day information. Since we’re testing an end of day system we’ll leave this set to ‘Market.’ When set to ‘market’, trades are executed at the price selected in System Tester Options – Trade Execution.
  • Note: The ‘Limit or Stop Price’ option, directly below the ‘Order Type’, becomes active when a non-market order is selected. We can then enter a formula to determine how the limit or stop price order is calculated.
  • Entry Size: Allows us to incorporate position sizing models into our testing. We can enter the number of shares we want to test. The number can be a dollar amount, a number of units, a percentage of available equity, or a number of units defined by a formula. In our example we’ll leave this option set to ‘Use Default Size.’
  • Expiration: Tells the system, once an order is placed, to close the order at the end of the day or leave it open until another rule closes it. This option applies only when you enter non-market orders (refer to Order Type above). Again, in our example we’ll leave this option set at its default value (i.e. good until cancelled).
  • Strategic Delay: Defines how soon after a signal is received the system actually enters the position. For example, assume we receive an entry signal in the evening after running our explorer – obviously we couldn’t buy on the opening price of this day. We wouldn’t have received the entry signal till the evening. For that reason, we may need to delay our entry to yield accurate results. Obviously the way in which we set this option is more of a personal choice. There are two ways to delay our entry. Before we run our system test we’re given another chance. We’ll configure the delays at this point.

Next we need to enter our ‘Sell Order’ trading rules. A sell order works like a stop, in that when the technical conditions are met, the position is closed.  We shall use a simple moving average stop, using:

C < Mov(C,30,S)

This code is pasted into the Formula text box and is shown below:

systemtester5

The example system we have just entered is primarily a long system. Within MetaStock you can also test short systems by using the ‘Sell Short Order’ and ‘Buy to Cover Order’ tabs. This is achieved in the same way we entered our long system test i.e. all the options are the same.

In addition to our ‘Sell Order’ condition there are five other stops available. These are found within the ‘Stops’ tab. They differ from the ‘Sell Order’ stop in that they are based on the position’s gains/losses. To activate these press the ‘Stops’ tab. This opens the following window:

systemtester6

As mentioned, there are five different stops available. These are breakeven, maximum loss, profit, inactivity minimum change and trailing. Among the stops there are two common options, i.e. the ‘Positions’ & ‘Method’.

  • Positions: This allows us to apply the stops to either ‘longs’, ‘shorts’ or both.
  • Method: This allows us to select the calculation method, i.e. points or percent.

Let’s look at each stop and examine how they work. When we explain these stops, note that we’re applying them to our system which is primarily ‘long’. Remember, when going short, stops work in reverse, i.e. rather than being set below the price, they are set above.

  • Breakeven: This stop closes out the position once our current trade equity falls below the amount of equity that was used to open the trade. Before this can happen the stop must reach a ‘floor level’ (i.e. a set amount at, or above our entry price). Then once two bars have past, the stop becomes active. If the price were then to fall to, or below, a point where we would breakeven, the position is exited. For our system test we will not employ this stop.
  • Maximum Loss: This stop closes out the position if a pre-defined maximum loss is hit. In other words, this allows us to set our maximum draw down on any position. For our system test let us stipulate that a security cannot move more than 15% against us without triggering an exit.
  • Profit: This stop closes out the position if a profit target is reached. For example, we could stipulate if a security makes a 30% profit an exit is triggered. However, since we believe in ‘letting profits run’ we will not employ this stop.
  • Inactivity Minimum Change: This stop closes out the position if a security doesn’t move in a minimum positive direction within a set period of time. Ask yourself the question, “How long am I prepared to let a security move nowhere before I close the position and move on?” For our example, let us stipulate that a security must move 3% in our favour within 60 periods or an exit is signalled.
  • Trailing: This stop works in much the same way as the ATR trailing stoploss that we’ve already set in the ‘Sell Order’. The only difference is that rather than subtracting an ATR multiple from the highest value, we use either a set percentage or set number of points. Since we’ve already employed a trailing stop we will not use this stop.

Your dialog should now look as follows:

systemtester7

When dealing with stops there are a couple of things to note:

  • If the price gaps below a stop level on a long position, MetaStock exits at the open price of the next bar.
  • Stops automatically take entry and exit commissions into account. Thus, MetaStock attempts to close the position so that the stop isn’t exceeded after we pay the exit commission.

to be continued shortly …