Working Money magazine.  The investors' magazine.


Article Archive | Search | Subscribe/Renew | Login | Free Trial | Reader Service



Step-By-Step System Design

01/18/06 01:03:17 PM PST
by Rudy Teseo

You can design your own trading system — here's how.

At our MetaStock user meetings, I have found there are more members who would like to design a trading system but haven't than there are members who have. I was asked to make a presentation on this subject, and this article represents the gist of that presentation.

I started by reminding everyone that a word processor does not an author make (did Shakespeare have a computer?), nor does a spreadsheet a financial analyst make. You have to be able to do with pencil and paper whatever it is you want the computer to do. The computer is a tool that makes the job easier and quicker — it does not do the job for you.

When I asked the group attendees to describe the first steps of their systems, two of the six wannabes could not state in simple English what they wanted the system to do. Step 1? The four who were able to state their objectives did not know how to tell their computers to run the system. Step 2?

There are many steps to take and decisions to make to get to this phase of designing your trading system. But just to make sure we're all on the same page, let's define this system. There are many definitions, but the simplest is a mechanical program that generates buy and sell signals according to a set of rules without intervention from the investor. I'll classify the programs as one of two types: passive, wherein the program produces buy and sell signals and you then have to manually place orders with your broker; and active, wherein the program itself automatically places the orders. A caution for both types of programs: a lot can happen between the time you write your program and the moment when conditions are met. You could have a trade executed that you no longer want.

First, you must decide the type of market you want to design a system for. Will it be a trending market or a trendless (sideways) market, a reversal market, or a breakout market? This decision will depend upon your investing/trading style:

· Trending — A well-defined trend, up or down, the longer the better

· Trendless (sideways or consolidating) — With prices bouncing back and forth between support and resistance

· Reversal — Looking for Ws and Ms, and, of course, the parabolic (stop and reverse)

· Breakout — Gap openings

Dig out your Technical Analysis From A To Z and refresh yourself on what indicators are used in which markets: Which lead and which lag? You may love the stochastic, but it can give a great many false signals in a trending market. Likewise, the moving average convergence/divergence (MACD) is not very useful in a flat market. Your aim is to put together a suite of indicators that will give you reliable buy and sell signals under the conditions of the market you've chosen.

We can't discuss the 100 or so indicators available, but you are probably already using some combination of indicators that give you visual cues for decision-making, so you can build on those. Let's review a few examples:

Trending Market
· Moving average crossovers
· MACD crossing the signal line
· DMI+ crossing DMI-

Trendless (support and resistance)
· Stochastic slow %K crossing slow %D
· RSI crossing a threshold (below 30 or over 70)
· Price breaking out of a channel

· Gap opening
· Increase in the difference between two moving averages

Considering the market you are going to invest/trade in, you will have to compare each indicator's function to decide which ones you will combine into your template. Consider this as a preliminary. If you find that your first template needs no tweaking or refining, it will be a first. My favorite at the moment (it may change) combines the parabolic (PAR), the directional movement index (DM), and the average directional movement index (ADX). I'll use this in examples later.

Trading literature always tells us to experiment to find the indicators that suit our style and give the signals we want. Perhaps, for the first time, you will start changing parameters to see what difference it makes. For example, the MACD default is: short average=12, long average=26, signal=9. For some time, I have been using MACD with half those values: 6, 13, and 4.5. I get quicker reversals, which sometimes makes me think I have a leading indicator, but I also occasionally get whipsawed. I know of one program that uses 4, 13, and 8, respectively. I don't know where those parameters came from, but the author evidently has had good results.

The next steps convert the template you have designed into English (our original step 1). Your system syntax will use the IF... THEN logic. You may have already used this in Excel, which uses the IF-THEN-ELSE logic. Say you have a portfolio manager spreadsheet and want to indicate whether a stock has been held for a long or short period. In the cell next to the security, you would enter "If this stock has been held more than 366 days, then print an 'L' in this cell, else print an 'S.'" Your system statements will not have the Else option, however.

The system is written in two parts, the first of which is the Setup. This is a list of conditions that must be met before any further action can be taken. The second part is the Entry. This is a statement of how you will enter the market. The setup tells you that the gun is cocked; all conditions are right for your entry. The entry pulls the trigger. Keep in mind that too many conditions may result in no entry signal being given. Let's examine a few possible setups.

Here are three possible setups:

Trend-Following System
· If the 20DSMA crosses above the 50DSMA
then (one condition)
· If the PAR switches from short to long and RSI is above 35 then... (two conditions)
· If DMI+ crosses above DMI- and ADX is above 25 and MACD is above its signal line then... (three conditions)

Trendless System
· If RSI yesterday is below 30 and RSI today is above 30 then
· If slow K is below 20 and crosses above slow D then

Breakout System
· If today's open is higher than yesterday's high then
· If the current bar's range is greater than the average range of the last three bars then

I'll use my template as an example of a setup that may never occur. My system depends upon two conditions, both occurring while a third is in effect. If the PAR is currently long, I want a buy signal if DMI+ crosses above DMI-, indicating the possible start of an uptrend. However, I also want the ADX to be equal to or greater than 25 to assure that the uptrend is a strong one. This system has worked very well most times, but I have missed some good moves because the ADX did not exceed 25 until the trend was well under way.

Remember, no indicator works the way the books say they will all the time.

Each of these setups alerts you to a bullish configuration that signals a probable uptrend. Now you have to decide how you want to enter the market. All these examples are for long entries:

1 Buy the next bar at today's high plus 1 (make sure that the uptrend is continuing)
2 Place a buy stop at N (don't buy unless the price reaches N which is higher than the current price)
3 Buy the next bar if there's a gap opening (looking for a positive breakout)
4 Buy at market after three consecutive higher closes or
Buy at a limit price of N (looking for a pullback)

Be aware you can write an entry that will never be filled and cause you to miss a great move. For example, you may never have a gap opening but the price can go to the moon. Likewise, there may not be a pullback and the price may get away from you. Not getting three consecutive closes is no guarantee that the price is not going higher. Your entry should guarantee that you will capture every price move that the system is designed for.

Note: From here on, the information pertains to all users, not just MetaStock users.

This is the tough one. How do you instruct the computer to execute your commands? First of all, your charting software must have this capability built in. It must have a library of reserved words, conditions, and commands that the program recognizes. It must allow the writing of IF-THEN statements. It should have some system of displaying signals on your charts. Whether it is a passive or active system depends upon the program you are using.

The general form of the syntax will be the same for most programs; however, the symbols and abbreviations used will be different, and the syntax of one program will not be recognized by another, which means they cannot be interchanged.

Here's an example of a stochastic crossover trading system logic:

If slow %D (period 14) and slow %K (14) cross above 20, then buy the next bar at market.

TradeStation syntax
Input: Length(14) IF SlowD(Length) and SlowK(Length) cross above 20
Then Buy next bar at market

MetaStock syntax
Enter Long Ref( Stoch(5,3), -1) <= 20 AND Stoch(5,3) > 20

Note that TradeStation syntax follows the English structure almost word for word. MetaStock's code is not as intuitive. However, neither can be written without following the user guide. Note also that TradeStation has a "crosses above" command, whereas MetaStock compares yesterday's stochastic (the -1) to today's. You will find that you don't have to do much typing, however. Most programs have a function menu listing all the symbols, commands, and indicators available. You click on an indicator and then paste it into the dialog box.

Finally, when it comes to designing a trading system — and knowing how to make it work — it's easier done than said. Just try it.

Rudy Teseo is a private securities, options, and currency trader, and has taught classes in option trading and stock charting. He can be reached at

Achelis, Steven B. [2000]. Technical Analysis From A To Z, McGraw-Hill.

Current and past articles from Working Money, The Investors' Magazine, can be found at

Rudy Teseo

Rudy Teseo is a private investor who trades stocks, options, and currencies. He has taught classes in technical analysis and option trading. He may be reached at

E-mail address:

Comments or Questions? Article Usefulness
5 (most useful)
1 (least useful)


S&C Subscription/Renewal

Request Information From Our Sponsors 

DEPARTMENTS: Advertising | Editorial | Circulation | Contact Us | BY PHONE: (206) 938-0570

PTSK — The Professional Traders' Starter Kit
Home — S&C Magazine | Working Money Magazine | Advantage | Online Store | Traders’ Resource
Add a Product to Traders’ Resource | Message Boards | Subscribe/Renew | Free Trial Issue | Article Code | Search

Copyright © 1982–2021 Technical Analysis, Inc. All rights reserved. Read our disclaimer & privacy statement.