Thursday, September 10, 2009
8:26:26 PM EDT

Trading 'Systems' (Part 3)

by
Leigh Stevens

I'll go more in depth in my final article into how trading systems might be developed and back tested with certain system development and testing (STAD) software. The STAD software I use is TradeStation which has been preeminent in this area for many years. I don't rely on trading systems but I pay attention to the ones that 'test' well in terms of what side of the market they're on.

After this explanation and examples, I'll revisit the two RSI-related trading systems I've been exploring as to how each is positioned. One trade strategy or system is long and one short.

The one short is bucking this current upswing and this can and will be the case when there isn't a stop-loss exit rule built in. I wanted to just let these systems go on without being stopped out with the idea to later test the 'best' or optimal stop points to cut down losing periods and improve profitability.

Articles 1 and 2 on this subject can be seen via the Option Investor.com home page by clicking on the upper Trader's Corner tab and scrolling down.

Trading systems can be broadly broken down into ones that use:

1. technical indicators

2. chart patterns

3. a combination of both methods.

The validity of each approach stems from a basic principle of technical analysis: the knowledge that market cycles repeat and are identifiable. The sample systems I described recently might be 'applied to' or tested on intraday data but are not any different in construction than ones applied to daily or weekly charts although the input values for indicators will vary. The concept is that a trade strategy or 'system' calculates a certain number of 'bars' or trading periods, whether this is 5, 10 or 60 minutes, or the same number of days or weeks.

INDICATOR-BASED TRADING SYSTEMS

A popular technical indicator class, that of oscillators, is the Relative Strength Index or RSI. In the past it has been hard to identify how well the RSI worked in terms of its use as a buy or sell 'signal'. A rule-based trading system using the RSI is demonstrated here as written in the TradeStation programming Language they call Easy Language:

What is seen below may all look 'greek' to you or some kind of geek-speak, but it's not all that complex. Number 1 is to define some terms or trade inputs. Number 2 is to define a condition involving those inputs. Lastly, the trading rules are defined below: one is the "BUY RULE" and the other is the "SELL SHORT" rule. The sell short rule in options will typically be to buy puts. It doesnâ€™t much matter, the trade strategy or 'system' is generating a sell signal and you decide how you will attempt to profit from the projected decline.

A common use of the RSI indicator is to buy an index, a stock or whatever financial instrument when the RSI is registering an oversold or overbought condition; e.g., buying below 30 and selling above 70. However, because markets can stay at overbought or oversold readings for some time, the system shown above takes a position only when the RSI crosses ABOVE 30 or BELOW 70; i.e., when the RSI is RETREATING from an extreme. Early exit may be desirable if the RSI moves back into those extreme readings. Such a move is an alternative exit signal and is the way that the system above is written.

PATTERN RECOGNITION SYSTEMS

Most investors and traders that analyze charts based on technical analysis principles will tell you that they are looking for clues to future market direction based on particular patterns that they have found meaningful. For example, we take notice of any period of a few days duration when an index or stock begins making higher daily highs or lower daily lows, relative to the preceding trade period or periods.

It can be quite meaningful, in terms of predicting a good-sized advance in the indexes or stocks you follow, when there are at least 3 days of higher highs. The trading system rule that defines this 'condition' can be quite simple.

First is to define the condition we are looking for: a high greater than (>) the high of one [1] bar ago and that the high of 1 bar ago is also greater than the high of two [2] bars ago and the high of 2 bars ago is greater than all the high of three [3] bars ago: ALL conditions must be true. The reverse situation applies to a series of lows less than (
These system 'rules' can be written in a shorthand form within the STAD application, such as in TradeStationâ€™s Easy Language as:

If Condition1 {is met} then buy this bar on close; If Condition2 {is met} then sell {short} this bar on close.

"If condition1" means that there is a fulfillment of the rules making up Condition1. This is about as simple as a trading system gets. Exit in the above system is triggered only by the reverse conditions and there is always a position in the market, at least absent the addition of a stop-loss or exiting 'rule'.

Entire trading systems and very profitable ones at that, are sometimes constructed this simply. The software application usually then triggers an audible and visual alert when a trading system applied to an index or stock is triggered; e.g., when you download your end of day data or during the day when trading in real time with a live data feed.

STOPS AND EXITS

There can be rules to exit long if there is a 'key downside reversal' and exit short positions if there was a 'key upside reversal'. You can also build in stop protection and test the results of different size stops; e.g., exit your OEX options if, after entry, there is an adverse move of 5 points.

An exit is also assumed if a position contrary to the original is triggered. If the trading system is long and short conditions are met, selling triggers both an exit and a new position on the sell side, whether that is a short (e.g., of QQQQ) or buying Index puts.

Creating the systems rules is only part of the process of creating profitable trading systems. A trading strategy should have components that govern:

1. entering the market

2. exiting the market while capturing profits

3. exiting the market in order to minimize losses

The above three components often involve three different rules and corresponding 'signals' when the conditions (the system rule or rules) are met. For example, if you create a signal' or trade rule that enters the market based on a momentum indicator, you add a 'trailing' stop signal that will capture profits and a stop-loss exit signal that will limit losses.

A trailing stop is one where the rule is that a stop is in place that 'trails' the current price by some amount; e.g., 5 points in OEX. An initial stop might be 3 points, and then once the Index has moved in your favor, a trailing stop condition kicks in. Again, these are common elements of trading systems but, there are no rules to say what rules have to be in your trading system!

Once there is a well-defined set of rules to enter and exit positions and perhaps a system of risk protection or stops (exits), it is then necessary to see how well the ideas comprising the systems performed in the past. This is basically WHY you have to have defined rules: only by defined rules, can the STAD software 'apply' the system to a market; e.g., show the results of the system for the last X number of years of price history.

Testing involves applying the system to as much price history as can find; ideally, 5 or 10 years or more. Optimization of a rule-based system is often applied here. Optimization is a computerized test to determine WHICH variables (e.g., which specific moving average or averages) resulted in the most profitable or the most consistent profits for the back period being examined.

Or, to use our above example, which length setting of RSI works best along with which specific overbought or oversold extreme is the most profitable as the trigger point for trade entry. What the software does is test all possible combination of lengths and overbought/oversold extremes, or the combination that showed the greatest profit for the period tested. For example, the outcome may be to use a 17 period RSI and sell after the RSI retreats from a reading above 75 and buy when the RSI indicator rebounds from an extreme below 25.

MORE ADVANCED

Such techniques as 'walk-forward' optimization can guard against the tendency to select only variables in indicator or pattern-recognition systems that fit past conditions, but that may not work as well going forward. The walk-forward optimization technique involves testing some period for the most profitable system inputs, then applying those inputs for a later period and adjusting the values and then testing 'forward' again.

Regardless of the rules and markets, one of the things that has to be on your checklist when studying results is why did the losing trades lose money? How are they different from the winning trades? It's important to scrutinize the losing trades and investigate what happened on each occasion. The software applications that have well-developed systems testing and development (STAD) capabilities have templates and tools that allow the study of all these aspects of trading system results.

Analysis of the biggest losing trade is a starting point to see how a system doesnâ€™t work, so there are no 'holes' in the system rules though which a trade could slip and cause significant losses or more that the maximum you are willing to take.

A system should be studied on two levels:

1. As a trading strategy that gives positive trading results or
the net results of the strategy over time

And

2. At the trade-by-trade level to determine is the individual trades are 'normal' compared to one another and to the group. For this type of analysis to be correct, all trade results need to be comparable to one another.

Since we are working in the financial world, this means that we should see all our results in terms of dollars (or monetary units). For example, itâ€™s not correct to compare the return on investment of buying 100 shares of a 10-dollar stock with buying 100 shares of a 100-dollar stock. The comparison would only make sense if buying or selling some set dollar amount of each; e.g., $10,000.

SUMMARY OF THE TRADING SYSTEM APPROACH

Regardless of whether you have any interest or inclination to use trading systems now or ever, it is useful to know that there is an option to supplement (or substitute) what is typically the more subjective and personal methods we use to make market decisions. I find that the more investing and trading experience that I have, the easier it is becomes to define what may be sound 'rules' or conditions that need be met to get into a stock or other market.

Moving from the stage of ideas that 'may be' profitable to back-testing these rules is a fascinating and worthwhile process that serves as a reality check. Often, through the results of back testing, it becomes apparent that even with a promising system, slight changes will result in an investing or trading method that has even greater profit potential.

Systems testing and development might be something you are not immediately attracted to, but could be something that is useful after a lengthily experience in using technical analysis. This was the case with me and I thought I would never warm to the approach of a 'mechanical system'.

DIFFERENT RSI VALUE 'TRIGGERS'= DIFFERENT CURRENT RESULTS

If you read my last (9/1) Trader's Corner article or my most recent Index Trader column (9/5), I described two similar trading systems, both indicator-related but applied to the hourly Nasdaq 100 (NDX) and the hourly QQQQ tracking stock.

The trading strategy I tested was to short the market (e.g., by buying puts) when the RSI got overbought in terms of the 21-hour RSI and then crossed UNDER that same overbought RSI 'threshold' value. Conversely, the strategy was to buy the market (e.g., buy stock or calls) when the RSI dipped under its RSI oversold threshold level, but waiting to get long when the indicator then crossed ABOVE that level. The idea being to take a position only when the index was just coming out of an overbought condition or just coming out of an oversold state.

I started with the idea that the 'overbought' threshold value was 70 and the 'oversold' level was 30, which are the common default overbought/oversold levels. Both systems were profitable for the period tested. I had only 2 years and 9 months of intraday data to test.

I then 'optimized' for the most profitable RSI levels to use in terms of profit for the period. Optimization is when your testing software, in my case TradeStation, tests the various indicator (this was an indicator based system) 'trigger' points from say 60 to 80 on the upside, 45 to 25 for the lower oversold zone and picks the most profitable trade trigger levels.

The test results indicated two different sets of RSI trigger points: one set most profitable for QQQQ and another set for NDX. You would think these values would be the same but they werenâ€™t.

I allowed the system to go long or short multiple times IF there was a trade entry 'signal' in the same direction. The strategy was long until it was short and vice-versa. No stops. Optimization results for the NDX index simply indicated a cumulative point value gained or loss.

A number of NDX call or put positions taken over several weeks is problematic in terms of seeing the 'real world' results of put or call entry (e.g., At The Money strikes) and holding them through a losing period. I assume that if expiration came, one would have to roll into another strike and month to stay in the indicated position. The software I work with doesn't allow a ready test of something as complex as option premium erosion and added commission costs of having to roll into new positions in order to stay long or short.

What was instructive about the two strategies was that the RSI trigger values were different enough so that the current positions are opposite ones. In QQQQ, my RSI Long-Short trading strategy is currently long 300 shares and has a substantial unrealized gain. The NDX 'system' is now short 4 'positions' and way underwater.

Obviously the use of stop-loss protection should be considered. Devising, testing and seeing where these two trade strategies are now was for me more of demo of how trading systems are set up and the various things that need to be considered.

The QQQQ trade strategy results reflect most closely its accurate potential as I could build in stock commission costs and I didn't have to assume that option positions were rolled over. I built in some trade execution 'slippage' also. An account of at least $21,000 for QQQQ was indicated to be able to trade this system. It was hard to figure how big an NDX options account was needed. In a bull market like the present one, the RSI doesn't get to such oversold extremes. This is why more years of data would be of value to show more bull market periods in order to figure what the RSI downside extremes should be to get long or buy calls.

Results of the current open positions of the RSI long-short trading system is shown below. Even without an exiting stop-loss 'input' this trading system has been promising and I'll do some more work with it. I have less anxiety about staying long or short, with the market against me, when I don't have a time to expiration to concern me and am in the less volatile situation of the QQQQ stock. Without the leverage of options positions makes sticking with this trading system a little easier perhaps also.

A similar system, same rules, seen below with the NDX only with a downside trigger level in the RSI just low enough to not get long on this big run up. This system would appear to have run amok so to speak. This is the way a trading system can appear when there are no exit (stop-loss) points built in so that large losses don't have to be carried before (hopefully) the trade system swings to profitable again.

The use of '69' and '31' as the trigger points for entry into calls or puts is not working well it appears once we've gotten into such a strong bull market, relative to the nearly 3-year test period. This system worked well in some past market cycles. We'll see how this plays out. Having a longer set of data to test for best trade 'triggers' should help also. With a suitable initial exiting stop or 'trailing' stop the results of this strategy could be improved. Trading systems can be fascinating to work with as a tool.