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:
On the right hand side of this screen within the Power Console, click on the ‘Trade Options’ button. Â You should see something like below:
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:
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)
This code is pasted into the Formula text box and is shown below:
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:
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:
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:
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 …