Uploaded by Ivan Murall Roca

Omega Research Trading Systems: Volume 9

advertisement
VOLUME 9
© 1999. OMEGA RESEARCH, INC. MIAMI, FLORIDA.
Information in this document is subject to change without notice.
THE TRADING SYSTEMS IN THIS BOOK ARE EXAMPLES ONLY, AND HAVE BEEN INCLUDED SOLELY FOR
EDUCATIONAL PURPOSES. OMEGA RESEARCH DOES NOT RECOMMEND THAT YOU USE ANY SUCH TRADING
SYSTEM, AS THE USE OF ANY SUCH TRADING SYSTEM DOES NOT GUARANTEE THAT YOU WILL MAKE
PROFITS, INCREASE PROFITS, OR MINIMIZE LOSSES. THE SOLE INTENDED USES OF THE TRADING SYSTEMS
INCLUDED IN THIS BOOK ARE TO DEMONSTRATE THE WAYS IN WHICH EASYLANGUAGE CAN BE USED TO
DESIGN PERSONAL TRADING SYSTEMS AND TO SHOW SOME EXAMPLES OF HOW CERTAIN POPULAR, WELLKNOWN TRADING STRATEGIES MAY BE INCORPORATED INTO PERSONAL TRADING SYSTEMS. OMEGA
RESEARCH, INC. IS NOT ENGAGED IN RENDERING ANY INVESTMENT OR OTHER PROFESSIONAL ADVICE.
IF INVESTMENT OR OTHER PROFESSIONAL ADVICE IS REQUIRED, THE SERVICES OF A COMPETENT
PROFESSIONAL SHOULD BE SOUGHT.
Copyright © 1999 Omega Research Inc. All rights reserved. No part of this publication may be reproduced, stored in a
retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise,
without prior written permission of Omega Research, Inc. Printed in the United States of America.
TradeStation® and SuperCharts® are registered trademarks of Omega Research, Inc. EasyLanguage, Portfolio Maximizer,
PaintBar, ShowMe and SystemBuilder are trademarks of Omega Research, Inc. Microsoft is a registered trademark of
Microsoft Corporation and MS-DOS, Windows, and Excel are trademarks of Microsoft Corporation. DBC Signal and BMI
are trademarks of Data Broadcasting Corp. Price data supplied courtesy of Global Market Information, Inc.
Contents
INTRODUCTION
Welcome to Volume 9 .........................................................................................................5
Chapter 1:
Double Your Fun ...............................................................................................................11
Chapter 2
LUXOR .............................................................................................................................29
Chapter 3
No Hurry............................................................................................................................39
Chapter 4
OBV Revisited ..................................................................................................................49
Chapter 5
Red Rover, Red Rover.......................................................................................................61
Chapter 6
Skinny Dipper....................................................................................................................71
Chapter 7
International Index Composite System ............................................................................81
Chapter 8
Swinger..............................................................................................................................91
Chapter 9
Traffic Jam.......................................................................................................................103
Chapter 10
RadarScreen™ 2000i Indicator ......................................................................................113
Appendix A:
Common Exits .................................................................................................................119
Appendix B
Volume in Review ...........................................................................................................127
Index...................................................................................................................................128
INTRODUCTION
Welcome to Volume 9
W
elcome to Volume 9 of the Omega Research System Trading & Development
Club. This issue features 9 Systems and a RadarScreen 2000i Indicator for you
to study and experiment with. As always, each system comes with at least one
suggestion for improvement. We hope you will accept our challenge to improve these
systems and to make them your own.
Trading stocks and commodities profitably and comfortably is a difficult challenge for most
people starting out in the markets. We could easily devote an entire STAD Club volume to
discussing the main obstacles, conundrums, and paradoxes confronting the trader. A long list of
decisions must be made before the aspiring trader can function effectively in the markets. Here
are some examples: Am I a discretionary trader or a systematic trader? Long-term trader, shortterm trader, or daytrader? A commodity trader, stock trader, options trader, or all three?
Trendfollower or countertrend trader? A technician, a fundamentalist, or both? An aggressive
trader or a conservative one? Do I use trailing stops or profit targets? Do I specialize in one
market or diversify into many markets? Of course, the list could go on and on.
At Omega, we believe that one of these questions has a hard-and-fast answer that would benefit at
least 999 of every 1,000 traders. The question is the first one on the list: "Am I a discretionary trader
or a systematic trader?" We strongly recommend that you answer, "Systematic trader!" The 9 new
systems in this issue are designed to help you learn more about systematic trading so that you can
improve our systems and modify them to suit your own trading beliefs and objectives.
Volume 9 features a wide variety of proven technical indicators for you to work with over the
next few months. These indicators include Displaced Moving Averages, Triangular Moving
Averages, Delayed Channel Breakouts, and Weighted On-Balance Volume. Also in this issue,
you'll find new systems from two of our teammates at Omega Research - Gaston Sanchez from
Product Management and Hans Stimming from Quality Assurance. Gaston's indicator uses
Omega's new RadarScreen to find profitable trading opportunities, while Hans' system exploits
the intermarket relationships of the international equities markets.
Finally, don't forget to join us on the STAD Club Forum at www.omegaresearch.com. Your new
password is included with this volume.
IMPORTANT NOTICE: The trading systems in this book are examples only, and they have
been included solely for educational purposes. Omega Research does not recommend that
you use any such trading system, as the use of any such trading system does not guarantee
that you will make profits, increase profits, or minimize losses. The sole intended use of the
trading systems included in this book are to demonstrate the ways in which EasyLanguage
can be used to design personal trading systems and to show some examples of how certain
popular, well-known trading strategies may be incorporated into personal trading systems.
6
Contents at a Glance
Omega Research System Trading and Development Club - Volume 9
Contents at a Glance
! Chapter 1: Double Your Fun
! Chapter 2: LUXOR
! Chapter 3: No Hurry
! Chapter 4: OBV Revisited
! Chapter 5: Red Rover, Red Rover
! Chapter 6: Skinny Dipper
! Chapter 7: International Index Composite System
! Chapter 8: Swinger
! Chapter 9: Traffic Jam
! Chapter 10: RadarScreen™ Indicator
! Appendix A: Common Exits
! Appendix B: Volume in Review
! Index
Additional Educational Services
Omega Research is committed to enhancing individual trading potential through quality education. To learn more about system
trading, an Omega Research product, or EasyLanguage, visit our web site at www.omegaresearch.com or call (800) 439-7995
(outside US 305-485-7000) and ask about the following educational services:
Workshops
Omega Research offers a variety of workshops on Omega Research 2000i products and technical analysis. Workshops are an
excellent way to learn how to use the products, learn about technical analysis and system trading and/or EasyLanguage. Spend a
day with a Product Training Specialist and exchange ideas with other users like yourself. All workshops provide a 100%
satisfaction guarantee. Call now for more information or to register — space is limited!
EasyLanguage Resource Center
One of the best ways to learn is by example, and the EasyLanguage Resource Center on our web site is an excellent source of
examples. In this Resource Center, we list all the analysis techniques — indicators and trading systems — published in the
Technical Analysis of Stocks and Commodities magazine, as well as popular analysis techniques worth taking a look at. Access to
this Resource Center is free of charge. Feel free to download and review any of the analysis techniques and their descriptions. Our
web site address is www.omegaresearch.com.
Getting Started
To begin reviewing your systems, transfer the analysis techniques into your TradeStation® library and then apply the system you
want to review to a chart. Use the System Report to view the system results and take a look at the EasyLanguage instructions by
opening the system in the PowerEditor™.
To transfer the analysis techniques into TradeStation:
1. Place the System Trading and Development Club CD in the CD-ROM drive.
2. Start the PowerEditor. In Windows, click Start, choose Programs, choose Omega
Research (OMGA) and choose EasyLanguage PowerEditor.
Obtaining Technical Support
Introduction
7
3. In the PowerEditor, use the File - Import and Export menu sequence.
4. Select the Import EasyLanguage Archive File (ELA and ELS) option and click NEXT.
5. Click Scan.
6. In the Enter drive letter to scan edit box, enter the drive letter for your CD-ROM drive
(normally D), and click OK.
7. Choose STAD8.ELS from the list and click NEXT.
8. Below the Analysis Types box choose the Select All button and click NEXT.
9. Below the Available Analysis Techniques box choose the Select All button and click
FINISH.
10. Once the files are transferred and verified, a dialog box appears informing you that the
transfer was performed successfully. Click OK.
For your convenience, the names of the systems in this volume all begin with STAD9 (although the signals will not have this prefix). You
can now open the systems in the PowerEditor and view the EasyLanguage instructions and/or apply them to a chart in TradeStation. You
can remove your CD from the CD-ROM drive and store it in a safe place. As you apply the systems and work with them, refer to this
book for detailed explanations of the systems and the EasyLanguage used to create them. For instructions on applying systems and
viewing the System Report, please refer to your TradeStation User's Manual.
Note to SuperCharts® Users: To transfer the systems into SuperCharts, use the Tools - QuickEditor menu sequence and select Transfer.
Keep in mind, however, that although you can apply the systems in SuperCharts, you will not be able to view the EasyLanguage
instructions in the QuickEditor. This is because the systems were designed in the PowerEditor. Also, if you are using SuperCharts End
of Day, some of the systems will not apply as they are designed for intraday trading. Since the purpose of the Club is to provide you
with a learning tool, and viewing the EasyLanguage instructions is an essential part of this learning process, the use of this club for
SuperCharts users is limited.
Note to TradeStation or SuperCharts 3.x Users: The systems for the Club were designed using TradeStation 2000i. As such, some of
the features used, such as automatic drawing of trendlines and/or text, are not available in previous versions of TradeStation (or
SuperCharts). An effort is made to provide a variety of systems that incorporate both long standing and new features; however, keep in
mind that as new features are developed, we will naturally want to showcase and educate users on these features; therefore, users of the
most recent version of our software will be able to make the most use of the Club.
Obtaining Technical Support
Depending on your question, there are two resources at your disposal: the EasyLanguage Support Department and the STAD Club
E-Mail Address.
EasyLanguage Support Department
The EasyLanguage Support Department provides EasyLanguage support via fax and is designed to help you troubleshoot an
analysis technique or trading system you are currently working on. For example, if you are incorporating a trading system from the
Club into your own and have a question about the implementation, the EasyLanguage Support Department can answer it.
Please keep in mind that while this department can answer any EasyLanguage question, it cannot answer questions about the STAD
Club specifically, such as the theory behind a system in the Club, why a system was developed a certain way, or why the system is not
performing as you expect it to, etc.
Fax Number: (305) 485-7598
E-Mail Address: easylang@omegaresearch.com
8
Benefits of System trading
Omega Research System Trading and Development Club - Volume 9
Be sure to include the following information in your fax or e-mail:
! Name
! Security Block or Customer ID Number
! Telephone Number
! Fax Number
! Product you own
! EasyLanguage instructions you are working on
! Detailed description of your problem
Please allow 48 hours for a response.
STAD Club E-Mail Address
Another resource at your disposal is the STAD Club e-mail address.
Please realize that when you send a message to this e-mail address, you will not receive a response directly; your message will be
reviewed and the answer incorporated into the next volume of the STAD Club, when applicable. Therefore, if you need technical
support on EasyLanguage, please use the above fax number or e-mail address.
stadclub@omegaresearch.com
Please send any comment, suggestion, or question regarding the systems in the Club to the STAD Club e-mail address, and in each
subsequent volume we will publish the most common suggestions and questions.
Benefits of System Trading
There are at least five major benefits of trading in a systematic manner as opposed to trading in a discretionary manner:
1. You’ll have a system that is compatible with your own personality and trading style — a system that you are comfortable with and
that you can follow.
2. You will eliminate overly emotional trading and reduce the stress of constantly making subjective, spur-of-the-moment trading
decisions.
3. You will have objective entry and exit criteria that have been validated by historical testing of quantifiable data.
4. You will know the maximum peak-to-valley drawdown that your system has experienced in the past, and you can make sure that you
are adequately capitalized (both financially and psychologically) to withstand another worst-case drawdown.
5. You will gain confidence in both your system and yourself, thus strengthening your ability to follow your system and to trade in a
highly disciplined manner.
As you continue to become more proficient as a systems trader, you will almost certainly discover even more benefits of a systematic
approach.
Getting Ideas For Systems
We can easily think of at least five great ways to get ideas for trading systems. You’ll probably come up with at least a few more. Here’s
our quick list:
1. SuperCharts and TradeStation’s built-in indicators, ShowMeTM studies, PaintBarsTM, and systems
2. Trading As A Business by Charlie Wright (available from Omega Research)
3. Jack Schwager’s Complete Guide to Designing and Testing Trading Systems (12 videos, CD, manual; available from Omega
Research)
Introduction
Getting Ideas for Systems
9
4. OmegaWorld (June, 2000, New York City)
5. And, of course, Omega System Trading & Development Club (ten new trading ideas with manual and CD, published six times per
year. Club members also receive a password for Omega’s STAD Club online forum.)
Once we’re convinced that systems trading is more likely to generate consistent profits than discretionary trading, and once we have an
idea for a trading system, how do we progress from an idea to a complete system?
Building a Trading System
We hope the following ten-step plan will prove useful:
1. Write your trading idea as a ShowMe study. Scroll through several years of data to develop a sense of how your idea performs.
2. Write a very simple system based on your idea. For example, you could write a system that enters a position based on your idea and
exits the position automatically after n-days. Alternatively, you could write a stop-and-reverse system that uses your idea to enter,
exit, and reverse positions.
3. Design a setup for your system. A setup alerts you that a trading opportunity has developed. Setups don’t get you into a trade, but
they do tell you that market conditions have become favorable for a trade. An example of a buy setup is a market posting two
consecutive closes above a moving average. An example of a sell setup is the Relative Strength Index (RSI) crossing from above 70
to below 70.
4. Design an entry for your system. An entry is the criterion that must be met after a setup for a trade to be initiated. An example of a
buy entry is a market rallying one average daily range above yesterday’s close. An example of a sell entry is a market’s decline
below the previous week’s low.
5. Design an exit for your system. An exit is the criterion by which a trade is closed out. Trailing stops, profit targets, and exit
conditions will account for most of your system’s exits.
A trailing stop is set below the current price for a long position and above the current price for a short position. When you are in a long
position, you raise the trailing stop as the market trades higher to lock in profits; while short, you lower the trailing stop as the market
trades lower, locking in profits.
An alternative to exiting on a trailing stop is exiting at a profit target. A profit target closes out a trade when the price reaches a
specified objective. One example of a profit-target exit is to close out a position on the second close above the high of the entry day.
Another example is to automatically close out a trade when open profits equal three times the initial risk on the trade.
An exit condition gets you out of a trade when a market no longer justifies an open position. Good traders do not always rely on stops
to exit their trades. If the technical condition that got you into a trade (e.g. a rising moving average) is no longer in effect, you should
exit the trade immediately rather than waiting for your stop to be hit.
6. Select the data on which you will test your system. For example, you might choose to test your system on continuous, back-adjusted
data on U.S. Treasury Bonds from January, 1978 through December, 1997.
7. Divide the test data into five equal parts. Since you are going to test your system on 20 years of data, each part consists of four years.
The first four years (01/02/78 - 12/31/81) are reserved for the backward test, and the last four years (01/02/94 - 12/31/97) are
reserved for the forward test. The middle 12 years (01/02/82 - 12/31/93) are the data on which you will test and optimize your
system.
8. Test and optimize your system on the large, middle section of data. To evaluate the results of testing and optimizing, you should
consider several factors including equity curve, net profit, percent profitable, profit factor (dollars won per dollar lost), average trade,
and maximum drawdown.
9. Backward and forward test your system on the out-of-sample data you reserved. The test results will probably not be as good as the
results on the data for which your system was optimized. However, for your system to be tradable, the backward and forward tests
should yield favorable results. Your system is unlikely to perform better in the future than it did on the out-of-sample data. Check
your system’s performance on the same key factors that you evaluated during your test of the sample data (equity curve, net profit,
percent profitable, profit factor, average trade, and maximum drawdown).
10. Trade your system with consistency, confidence, and courage.
CHAPTER 1:
Double Your Fun
M
oving averages are the most widely used of all technical indicators. Omega Research
software offers several types of moving averages including adaptive, displaced,
exponential, simple, triangular, and weighted. The Double Your Fun system employs a
displaced moving average (DMA) to identify setups to buy and sell. We named the system
Double Your Fun because it requires a double penetration of the DMA before an entry setup is
complete. Joe DiNapoli of Coast Investment Software, Inc., in Sarasota, Florida, first showed us
this promising idea.
A DMA differs from other types of moving averages by plotting its average a specified number
of bars into the future rather than plotting the average on the bar for which it was calculated. A 5
x 3 DMA of closes, for example, adds the most recent 5 closes, divides by 5, and then plots the
average 3 bars into the future. Many technical analysts believe that DMA's generate fewer false
signals than other types of moving averages do, while still providing timely signals to buy and
sell.
In the Double Your Fun system, we try to reduce false signals ("whipsaws" or "whiplashes") by
displacing the moving average and by requiring a second crossover (on a closing basis) within a
specified number of bars of the first crossover. The second crossover completes the setup to buy
or sell. The actual entry point for a long position is one point above the high of the bar that
provided the second close above the DMA; the entry point for a short position is one point below
the low of the bar that provided the second close below the DMA. The second crossovers and the
actual entries must occur within a specified number of bars, or the setup is cancelled.
The exit for Double Your Fun is a trailing stop. For a long position, we'll trail a stop at the lowest
low of the past n bars; for a short position, we'll trail a stop at the highest high of the past n bars.
Initially the stop will limit our possible loss on the trade. As the trade moves in our favor, the
stop will lock in profits while still allowing our profits to grow if the trend continues.
12
Defining Our Trading Rules
Omega Research System Trading and Development Club - Volume 9
Defining Our Trading Rules
In Double Your Fun, we defined long and short setups, entries, and trailing stops. We also calculated
a displaced moving average. The default values for this system are a 5-bar simple moving average
displaced 5 bars, an entry setup in effect for 4 bars, a first qualifier of 3 bars, a second qualifier of 5
bars, and a trailing stop of 5 bars. The setups, entries, and trailing stops are described next.
Long Setup
a) Calculate a displaced moving average.
b) Identify a close above the DMA.
c) Identify a close below the DMA within n bars of the close above the DMA.
d) Identify a second close above the DMA within n bars of the close below the DMA.
Short Setup
a) Calculate a displaced moving average.
b) Identify a close below the DMA.
c) Identify a close above the DMA within n bars of the close below the DMA.
d) Identify a second close below the DMA within n bars of the close above the DMA.
Long Entries
a) Buy at one point above the high of the bar that provided the second close above the DMA.
b) The setup to buy is in effect for n bars.
Short Entries
a) Sell at one point below the low of the bar that provided the second close below the DMA.
b) The setup to sell is in effect for n bars.
Long and Short Exits
a) Exit a long position at the n- bar low.
b) Exit a short position at the n- bar high.
Chapter 1
Designing & Formatting
Double Your Fun
Designing & Formatting
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
EasyLanguage System Components: Double Your Fun (STAD9: Double Fun)
System Inputs (STAD9: Double Fun)
INPUT
Trailing_Stop_Length
DEFAULT
5
Show_Text
True
Avg_Length
5
Avg_Displacement
5
Entry_Setup
4
DMA_Cross_1_Setup
3
DMA_Cross_2_Setup
5
DESCRIPTION
Number of bars used in the calculation of the
Trailing Stop
True/False Input to determine if next Stop
price will be displayed on the chart
Number of bars used in the calculation of the
Moving Average
Number of bars that the Moving Average will
be displaced
Number of bars within which an order can be
placed after a confirmed setup
Number of bars for which the first DMA
crossover is valid
Number of bars for which the second DMA
crossover is valid
Signal Components:
1. Double Your Fun
2. DMA Stop
3. Trailing Stop LX
4. Trailing Stop SX
EasyLanguage Signal: Double Your Fun:
Inputs: AvgLength(5), AvgDisplace(5), EntrySetup(4), SetupQ1(3), SetupQ2(5);
Variables: DMA(0), BuySetup(False), SellSetup(False), BuyPrice(0), SellPrice(0), BuyCount(0),
SellCount(0);
DMA = Average(Close, AvgLength)[AvgDisplace];
{Buy Setup}
If Close Crosses Above DMA Then Begin
If MRO(Close Crosses Below DMA, SetupQ2, 1) <> -1 Then
If MRO(Close Crosses Above DMA, 50, 2) - MRO(Close Crosses Below DMA,
SetupQ2, 1) <= SetupQ1 Then Begin
13
14
Designing & Formatting
Omega Research System Trading and Development Club - Volume 9
BuySetup = True;
BuyPrice = High;
BuyCount = 0;
End;
End;
{Sell Setup}
If Close Crosses Below DMA Then Begin
If MRO(Close Crosses Above DMA, SetupQ2, 1) <> -1 Then
If MRO(Close Crosses Below DMA, 50, 2) - MRO(Close Crosses Above DMA,
SetupQ2, 1) <= SetupQ1 Then Begin
SellSetup = True;
SellPrice = Low;
SellCount = 0;
End;
End;
{Long Entry}
If BuySetup AND BuyCount <= EntrySetup Then Begin
If MarketPosition = 1 Then
BuySetup = False
Else Begin
BuyCount = BuyCount + 1;
Buy Next Bar at BuyPrice + 1 Point Stop;
End;
End
Else
BuySetup = False;
{Short Entry}
If SellSetup AND SellCount <= EntrySetup Then Begin
If MarketPosition = -1 Then
SellSetup = False
Else Begin
SellCount = SellCount + 1;
Sell Next Bar at SellPrice + 1 Point Stop;
End;
End
Else
SellSetup = False;
Signal Inputs (Double Your Fun)
INPUT
AvgLength
DEFAULT
5
AvgDisplace
5
EntrySetup
4
SetupQ1
SetupQ2
3
5
DESCRIPTION
Number of bars used in the calculation of the
Moving Average
Number of bars that the Moving Average will be
displaced
Number of bars within which an order can be placed
after a confirmed setup
Number of bars for which the first DMA crossover is valid
Number of bars for which the second DMA crossover
is valid
Chapter 1
Designing & Formatting
Double Your Fun
Signal Variables (Double Your Fun)
VARIABLE
DMA
BuySetup
SellSetup
BuyPrice
SellPrice
BuyCount
DEFAULT
0
False
False
0
0
0
SellCount
0
DESCRIPTION
[Numeric] Holds the value of the Displaced Moving Avg
[True/False] Indicates the existence of a Buy Setup
[True/False] Indicates the existence of a Sell Setup
[Numeric] Price at which the Long Entry is placed
[Numeric] Price at which the Short Entry is placed
[Numeric] Number of bars that have occurred in the
Buy Setup
[Numeric] Number of bars that have occurred
in the Sell Setup
Setup
During the setup, the Displaced Moving Average is calculated and assigned to the variable DMA.
DMA = Average(Close, AvgLength)[AvgDisplace];
If the Close crosses above the DMA, the MRO Function is used to determine if the required setup
crosses have occurred within the specified setup period. First, we determine if the Close has crossed
below the DMA within the last 'SetupQ2' bars. If a value greater than '-1' is returned by the first
MRO, we then move to the second setup criteria. In this step, the number of bars since the Close
crossed below the DMA is subtracted from the number of bars since the last time the Close crossed
above the DMA. If the calculated value is within the specified setup period 'SetupQ1', a valid buy
setup is defined. This is done by setting the 'BuySetup' to True, setting the 'BuyPrice' to the High of
the current crossover bar, and resetting the 'BuyCount' to 0.
If Close Crosses Above DMA Then Begin
If MRO(Close Crosses Below DMA, SetupQ2, 1) <> -1 Then
If MRO(Close Crosses Above DMA, 50, 2) - MRO(Close Crosses Below DMA,
SetupQ2, 1) <= SetupQ1 Then Begin
BuySetup = True;
BuyPrice = High;
BuyCount = 0;
End;
End;
If the Close crosses below the DMA, the MRO Function is used to determine if the required setup
crosses have occurred within the specified setup period. First, we determine if the Close has crossed
above the DMA within the last 'SetupQ2' bars. If a value greater than '-1' is returned by the first
MRO, we then move to the second setup criteria. In this step, the number of bars since the Close
crossed above the DMA is subtracted from the number of bars since the last time the Close crossed
below the DMA. If the calculated value is within the specified setup period 'SetupQ1', a valid sell
setup is defined. This is done by setting the 'SellSetup' to True, setting the 'SellPrice' to the Low of
the current crossover bar, and resetting the 'SellCount' to 0.
15
16
Designing & Formatting
Omega Research System Trading and Development Club - Volume 9
If Close Crosses Below DMA Then Begin
If MRO(Close Crosses Above DMA, SetupQ2, 1) <> -1 Then
If MRO(Close Crosses Below DMA, 50, 2) - MRO(Close Crosses Above DMA,
SetupQ2, 1) <= SetupQ1 Then Begin
SellSetup = True;
SellPrice = Low;
SellCount = 0;
End;
End;
Long Entry
If a valid 'BuySetup' has occurred and the number of bars since the Buy setup was initiated falls
within the 'EntrySetup' period, the Long Entry process is initiated. To begin, if the market position is
already Long (indicated by a MarketPosition of 1), the 'BuySetup' is automatically set to False, and
the Long Entry process is aborted. If the current position is not Long (flat or short), the 'BuyCount' is
incremented by one (to keep track of the bars that have been included in the long entry setup), and a
Buy order is placed at the 'BuyPrice' plus 1 point. In the event that either of the initial criteria was
False (BuySetup or the BuyCount greater than EntrySetup), no order is placed and the 'BuySetup' is
automatically set to False.
If BuySetup AND BuyCount <= EntrySetup Then Begin
If MarketPosition = 1 Then
BuySetup = False
Else Begin
BuyCount = BuyCount + 1;
Buy Next Bar at BuyPrice + 1 Point Stop;
End;
End
Else
BuySetup = False;
Short Entry
If a valid 'SellSetup' has occurred and the number of bars since the Sell setup was initiated falls within
the 'EntrySetup' period, the Short Entry process is initiated. To begin, if the market position is already
Short (indicated by a MarketPosition of -1), the 'SellSetup' is automatically set to False and the Short
Entry process is aborted. If the current position is not Short (flat or long), the 'SellCount' is
incremented by one (to keep track of the bars that have been included in the short entry setup) and a
Sell order is placed at the 'SellPrice' minus 1 point. In the event that either of the initial criteria was
False (SellSetup or the SellCount greater than EntrySetup), no order is placed, and the 'SellSetup' is
automatically set to False.
If SellSetup AND SellCount <= EntrySetup Then Begin
If MarketPosition = -1 Then
SellSetup = False
Else Begin
SellCount = SellCount + 1;
Sell Next Bar at SellPrice - 1 Point Stop;
End;
End
Else
SellSetup = False;
Chapter 1
Designing & Formatting
Double Your Fun
17
EasyLanguage Signal: DMA Stop
Inputs: AvgLength(5), AvgDisplace(5);
Variables: DMA(0);
DMA = Average(Close, AvgLength)[AvgDisplace];
If MarketPosition = 1 Then
ExitLong Next Bar at DMA - 1 Point Stop;
If MarketPosition = -1 Then
ExitShort Next Bar at DMA + 1 Point Stop;
Signal Inputs (DMA Stop)
INPUT
AvgLength
DEFAULT
5
AvgDisplace
5
DESCRIPTION
Number of bars used in the calculation of the
Moving Average
Number of bars which the Moving Average will
be displaced
Signal Variables (DMA Stop)
VARIABLE
DMA
DEFAULT
0
DESCRIPTION
[Numeric] Holds the value of the Displaced Moving Avg
Setup
The Setup for this signal consists simply of the calculation of the Displaced Moving Average.
DMA = Average(Close, AvgLength)[AvgDisplace];
Long Exit
When a Long position is taken, as indicated by a market position equal to 1, a Long Exit Stop order is
placed at the displaced Moving Average value, minus 1 point.
If MarketPosition = 1 Then
ExitLong Next Bar at DMA - 1 Point Stop;
Short Exit
When a Short position is taken, as indicated by a market position equal to -1, a Short Exit Stop order
is placed at the displaced Moving Average value, plus 1 point.
If MarketPosition = -1 Then
ExitShort Next Bar at DMA + 1 Point Stop;
18
Designing & Formatting
Omega Research System Trading and Development Club - Volume 9
EasyLanguage Signal: Trailing Stop LX
Inputs: Length(3), ShowText(True);
Variables: OrderPrice(0), StopText(0);
OrderPrice = LowestFC(Low, Length);
ExitLong ("Trl") Next Bar at OrderPrice Stop;
If ShowText AND LastBarOnChart Then
StopText = ShowLongStop(OrderPrice);
Signal Inputs (Trailing Stop LX)
INPUT
Length
ShowText
DEFAULT
3
True
DESCRIPTION
Number of bars used in the calculation of the Trailing Stop
True/False Input to determine if next Stop price will
be displayed on the chart
Signal Variables (Trailing Stop LX)
VARIABLE
OrderPrice
DEFAULT
0
StopText
0
DESCRIPTION
[Numeric] Holds the value of the lowest Low calculation
at which the order will be placed
[Numeric] The Variable to which the ShowLongStop
Function is assigned.
Setup
The Trailing Stop uses the lowest Low calculation to determine the price at which the Exit order
should be placed. This value is calculated and assigned to the 'OrderPrice' Variable.
OrderPrice = LowestFC(Low, Length);
Long Exit
For each bar a Long Exit Stop order is placed at the 'OrderPrice', which represents the lowest Low for
a specified period.
ExitLong ("Trl") Next Bar at OrderPrice Stop;
Chapter 1
Designing & Formatting
Double Your Fun
19
Additional Parameters
If the 'ShowText' Input is TRUE, and the current bar is the last bar on the chart, the 'ShowLongStop'
Function is utilized to place text and an arrow on the chart at the Trailing Stop price. This indication
is only placed on the chart for open orders.
If ShowText AND LastBarOnChart Then
StopText = ShowLongStop(OrderPrice);
EasyLanguage Signal: Trailing Stop SX
Inputs: Length(3), ShowText(True);
Variables: OrderPrice(0), StopText(0);
OrderPrice = HighestFC(High, Length);
ExitShort ("Trl") Next Bar at OrderPrice Stop;
If ShowText AND LastBarOnChart Then
StopText = ShowShortStop(OrderPrice);
Signal Inputs (Trailing Stop SX)
INPUT
Length
ShowText
DEFAULT
3
True
DESCRIPTION
Number of bars used in the calculation of the Trailing Stop
True/False Input to determine if next Stop price will
be displayed on the chart
Signal Variables (Trailing Stop SX)
VARIABLE
OrderPrice
DEFAULT
0
StopText
0
DESCRIPTION
[Numeric] Holds the value of the highest High calculation
at which the order will be placed
[Numeric] The Variable to which the ShowShortStop
Function is assigned.
Setup
The Trailing Stop uses the highest High calculation to determine the price at which the Exit order
should be placed. This value is calculated and assigned to the 'OrderPrice' Variable.
OrderPrice = HighestFC(High, Length);
20
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Short Exit
For each bar, a Short Exit Stop order is placed at the 'OrderPrice', which represents the highest High
for a specified period.
ExitShort ("Trl") Next Bar at OrderPrice Stop;
Additional Parameters
If the 'ShowText' Input is TRUE, and the current bar is the last bar on the chart, the 'ShowShortStop'
Function is utilized to place text and an arrow on the chart at the Trailing Stop price. This indication
is only placed on the chart for open orders.
If ShowText AND LastBarOnChart Then
StopText = ShowShortStop(OrderPrice);
Testing & Improving
We tested Double Your Fun on daily data for Sears and the British Pound from 1/2/84 to 5/7/99. For
Sears, we tested the long side only and deducted $.13 per share for slippage and $.05 per share for
commission. For the British Pound, we tested both the long and short sides and deducted $40 per
contract for slippage and $10 per contract for commission.
First, let's look at the system's performance on Sears. The optimized values are a 9-bar simple
moving average displaced 4 bars, an entry setup in effect for 4 bars, a first qualifier of 3 bars, a
second qualifier of 4 bars, and a trailing stop of 5 bars. The bar chart [Figure 1 - Sears bar chart]
shows a 9 x 4 DMA applied to daily data for Sears. The upward-pointing arrows indicate entries, and
the downward-pointing arrows indicate exits. The 3 most recent trades were all profitable. Double
Figure 1 - Sears bar chart
Chapter 1
Testing & Improving
Double Your Fun
Your Fun [Figure 2 - System Report] earned $1,572 (per 100 shares) on 33 trades, with 45% of the
trades profitable and an average trade of $47.00. The average winning trade was 2.33 times as large
as the average losing trade. The profit factor of 1.94 means that the system earned $1.94 for each
$1.00 it lost. The system let profits run by staying in winning trades an average of 19 bars, while
cutting losses short by exiting from the average losing trade in only 4 bars.
Figure 2 - System Report
The Equity Curve [Figure 3 - Equity Curve graph] started out poorly, roughly breaking even (after
deductions for slippage and commission) on the first 20 trades. From trade 21 to trade 33, however,
the system earned over $1,500 (per 100 shares).
Figure 3 - Equity Curve graph
21
22
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
The Average Profit by Month graph [Figure 4 - Average Profit By Month graph] shows the system
earning profits in 7 months and incurring losses in 5 months. We believe that a really good system
should perform better, with almost all months profitable when averaged over the length of the test
period (in this case, 15 years). The Total Trades graph [Figure 5 - Total Trades graph] shows just one
Positive Outlier (a trade more than 3 standard deviations greater than the average winning trade).
We'd like to see at least one more Positive Outlier among the 33 trades in the 15-year test period.
Figure 4 - Average Profit By Month graph
Figure 5 - Total Trades graph
Chapter 1
Testing & Improving
Double Your Fun
23
The Maximum Favorable Excursion graph [Figure 6 - Maximum Favorable Excursion graph] shows
that only one losing trade (symbolized by a downward-pointing triangle) had a run-up of more than
$300. In other words, the system did a pretty good job of locking in at least a modest profit once a
trade moved favorably.
Next, let's see how the system performed on the British Pound. The optimized values are a 3-bar
simple moving average displaced 6 bars, an entry setup in effect for 3 bars, a first qualifier of 3 bars, a
second qualifier of 7 bars, and a trailing stop of 6 bars.
Figure 6 - Maximum Favorable Excursion graph
The daily bar chart [Figure 7 - British Pound bar chart] shows a very profitable trade with a 3-bar
moving average displaced 6 bars into the future. The System Report [Figure 8 - System Report]
shows that Double Your Fun produced $69,798 in net profit on 97 trades. 43% percent of the trades
were profitable, and the average win was 3.48 times as large as the average loss. The average trade
(wins and losses) earned $719 after deducting $50 per trade for slippage and commission. The system
won $2.66 for each $1.00 it lost (Profit Factor). If the account size required to trade this system is
calculated at $10,268 (the maximum intraday drawdown of $7,288 plus $3,000 margin), the system
yielded a Return on Account of 678% over the 15-year test period.
The Equity Curve [Figure 9 - Equity Curve graph] shows a gain of almost $70,000 on the first 60
trades but a relatively flat performance on trades 61 to 97. However, we were pleased to see the
system making a new equity high on the last trade of the test.
The Underwater Equity Curve [Figure 10 - Underwater Equity Curve graph] is designed to portray a
very pessimistic view of a trading system. Each small vertical bar extending above the zero line
represents a new "high water mark" or new equity peak. Because the bars are not drawn to scale,
their significance is minimized on this graph. The equity drawdowns (for this indicator, the
percentage decline below the most recent monthly equity high), however, are drawn to scale, so the
drawdowns appear much worse than they are. The worst drawdown in the 15-year test period was
less than 12%. Although the magnitude of the drawdowns wasn't bad, the system spent too much
time between new equity peaks. In other words, although the system wasn't giving back unacceptable
amounts of profit it had earned, it was taking too long to produce new equity highs. A solution that
usually reduces drawdown and increases the number of new equity highs is to trade a diversified
portfolio of markets or to trade with more than one system.
24
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Figure 7 - British Pound bar chart
Figure 8 - System Report
Chapter 1
Testing & Improving
Double Your Fun
Figure 9 - Equity Curve graph
Figure 10 - Underwater Equity Curve graph
25
26
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
The Average Profit by Month graph [Figure 11 - Average Profit By Month graph] shows that 8
months were profitable when the monthly results were averaged over the length of the test period.
Only 2 months (January and April) really lost money, while 2 other months (August and December)
just about broke even after slippage and commission.
Figure 11 - Average Profit By Month graph
Maximum Favorable Excursion [Figure 12 - Maximum Favorable Excursion graph] shows that the
system did a good job of protecting profits once a trade moved in its favor. The vertical axis indicates
the final profit or loss on each trade, while the horizontal axis depicts each trade's maximum run-up in
profits. The upward-pointing triangles represent winning trades; the downward-pointing triangles
losing trades. Only 3 trades ended up with small losses after achieving more than $2,000 in open
profits.
Figure 12 - Maximum Favorable Excursion graph
Chapter 1
Suggestions for Improvement
Double Your Fun
Suggestions for Improvement
27
This system could probably be improved by including additional exit strategies. The only exit
currently employed is a trailing stop. Try adding a breakeven stop and a stop that tightens once a
trade has accumulated larger-than-average profits. For example, move the stop to breakeven when the
trade is ahead by 2 average true ranges. Then, when the trade is ahead by at least 8 average true
ranges, move the stop to a point below the 2-bar low (for a long position) or a point above the 2-bar
high (for a short position).
CHAPTER 2
LUXOR
O
ur Luxor system employs the technique of pyramiding to increase profits in a strongly
trending market. Since a typical market (stock or commodity) is in a trending mode only
about 15 to 25 percent of the time, traders need to maximize returns during trends.
Pyramiding (adding shares or contracts to a position after the initial position is established) is the
most common method traders use to take full advantage of trending moves.
Luxor identifies setups for new trades by the crossing of two moving averages — a fast one and
a slow one. Of course, there are many types of moving averages; Luxor is the first system in
STAD Club to use Triangular Moving Averages, a new indicator in TradeStation 2000i.
The purpose of the Triangular Moving Average (TMA) is to increase the smoothing of the price
data without also increasing the lag time between prices and the indicator. TMAs begin with the
calculation of a simple arithmetic average of prices (the close is the price field most commonly
averaged). Then, the TMA indicator calculates a simple arithmetic average of the first average.
The length of each average is equal to one more than half the value specified as the input length.
A 20-bar TMA, for example, first calculates an 11-bar simple arithmetic average; then, it
calculates an 11-bar average of the first average. The resulting average of the average is usually
plotted as a line in the same subgraph as the price data.
After the two TMAs are calculated, we wait for the fast average (a 5-bar average, for example) to
cross above the slow average (a 20-bar average, for example) for a buy setup or for the fast
average to cross below the slow average for a sell setup. The setup is in effect until the fast
average crosses the slow average in the opposite direction. In the case of a setup to buy, we enter
a long position at the high of the setup bar plus one point; after a setup to sell, we enter a short
position at the low of the setup bar minus one point. Our initial and trailing stops are set at the
slow TMA minus one point for a long position and at the slow TMA plus one point for a short
position.
The pyramiding feature of our Luxor trading system uses the fast TMA and the ADX indicator
(Average Directional Index) to identify pyramiding opportunities. The fast TMA tells us when a
market has retraced a little so that we can add contracts or shares at a more favorable price; the
ADX tells us when a market is in a strong trend that can be exploited by adding contracts
or shares.
30
Defining Our Trading Rules
Omega Research System Trading and Development Club - Volume 9
Here are Luxor's rules for pyramiding: When in a long position, if the high of the current bar is less
than the fast TMA, and ADX is rising, then buy at the fast TMA plus one point. To qualify as rising,
ADX must be greater than it was on the bar the same number of bars ago as the length of the fast
TMA. For example, if we're using a length of five bars for the fast TMA, the ADX must be greater
than it was five bars ago. When in a short position, if the low of the current bar is greater than the
fast TMA, and ADX is rising, then sell at the fast TMA minus one point. If we're using a five-bar
fast TMA, ADX must be greater than it was five bars ago to qualify as rising. The default value for
the maximum number of pyramid entries is three per trade.
Stops for the positions that were added with our pyramiding strategy are identical to the stops for our
initial positions. In an uptrend, the stops are set one point below the slow TMA; in a downtrend, the
stops are set one point above the slow TMA.
Defining Our Trading Rules
In this system, we defined long and short setups, entries, pyramiding conditions, and exits. We also
calculated the fast and slow Triangular Moving Averages and the ADX. The setups, entries,
pyramiding conditions, and exits are described next.
Setups
a) The setup for a long position is the fast TMA crossing above the slow TMA. The long setup
remains in effect while the fast TMA is above the slow TMA.
b) The setup for a short position is the fast TMA crossing below the slow TMA. The short setup
remains in effect while the fast TMA is below the slow TMA.
c) The long setup for a pyramid position is that the high of the current bar is below the fast TMA, and
ADX is greater than it was n-bars ago.
d) The short setup for a pyramid position is that the low of the current bar is above the fast TMA, and
ADX is greater than it was n-bars ago.
Entries
a) The long entry is one point above the high of the setup bar; the long pyramid entry is one point
above the fast TMA. The default value for the maximum number of long pyramid entries is 3.
b) The short entry is one point below the low of the setup bar; the short pyramid entry is one point
below the fast TMA. The default value for the maximum number of short pyramid entries is 3.
Exits
a) The initial and trailing stops for long positions are one point below the slow TMA.
b) The initial and trailing stops for short positions are one point above the slow TMA.
Chapter 2
Designing & Formatting
LUXOR
Designing & Formatting
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
EasyLanguage System Components: LUXOR (STAD9: LUXOR)
System Inputs (STAD9: LUXOR)
INPUT
Fast_Length
DEFAULT
5
Slow_Length
20
ADX_Length
14
DESCRIPTION
The number of bars used to calculate the Fast
(Short Term) Triangular Moving Average
The number of bars used to calculate the Slow
(Long Term) Triangular Moving Average
The number of bars used to calculate the ADX
(Average Directional Index) value
Signal Components:
1. LUXOR
EasyLanguage Signal: LUXOR
Inputs: FastLength(5), SlowLength(20), ADXLength(14);
Variables: FastTAvg(0), SlowTAvg(0), ADXVal(0), ADXSetup(False), LongSetup(False),
ShortSetup(False), BuySetup(False), SellSetup(False);
{Variables are defined}
FastTAvg = TriAverage(Close, FastLength);
SlowTAvg = TriAverage(Close, SlowLength);
ADXVal = ADX(ADXLength);
{Basic Setup Criteria are established}
LongSetup = FastTAvg > SlowTAvg;
ShortSetup = FastTAvg < SlowTAvg;
ADXSetup = ADXVal > ADXVal[FastLength];
{Entry Setup Criteria tested}
BuySetup = LongSetup AND ADXSetup AND High < FastTAvg;
SellSetup = ShortSetup AND ADXSetup AND Low > FastTAvg;
{Long Entry}
If (LongSetup AND MarketPosition <> 1) OR (BuySetup AND CurrentContracts < 3) Then Begin
If MarketPosition <> 1 Then
Buy Next Bar at High + 1 Point Stop
Else
Buy Next Bar at FastTAvg + 1 Point Stop;
End;
31
32
Designing & Formatting
Omega Research System Trading and Development Club - Volume 9
{Short Entry}
If (ShortSetup AND MarketPosition <> -1) OR (SellSetup AND CurrentContracts < 3) Then Begin
If MarketPosition <> -1 Then
Sell Next Bar at Low - 1 Point Stop
Else
Sell Next Bar at FastTAvg - 1 Point Stop;
End;
{Long & Short Exits}
If MarketPosition = 1 Then
ExitLong Next Bar at SlowTAvg - 1 Point Stop;
If MarketPosition = -1 Then
ExitShort Next Bar at SlowTAvg + 1 Point Stop;
Signal Inputs (LUXOR)
INPUT
FastLength
DEFAULT
5
SlowLength
20
ADXLength
14
DESCRIPTION
The number of bars used to calculate the Fast
(Short Term) Triangular Moving Average
The number of bars used to calculate the Slow
(Long Term) Triangular Moving Average
The number of bars used to calculate the ADX
(Average Directional Index) value
Signal Variables (LUXOR)
VARIABLE
FastTAvg
DEFAULT
0
SlowTAvg
0
ADXVal
ADXSetup
LongSetup
ShortSetup
BuySetup
SellSetup
0
False
False
False
False
False
DESCRIPTION
[Numeric] Holds the value of the Fast (Short Term)
Triangular Moving Average
[Numeric] Holds the value of the Slow (Long Term)
Triangular Moving Average
[Numeric] Holds the value of the ADX calculation
[True/False] Indicates if there is a valid ADX setup
[True/False] Indicates if there is a valid Long setup
[True/False] Indicates if there is a valid Short setup
[True/False] Indicates if there is a valid Buy Setup
[True/False] Indicates if there is a valid Sell Setup
Chapter 2
Designing & Formatting
LUXOR
33
Setup
We begin the Setup by defining the most commonly used values as Variables. The three values that
are defined are the Fast (Short Term) Triangular Moving Average, the Slow (Long Term) Triangular
Moving Average, and the Average Directional Index (ADX) value.
FastTAvg = TriAverage(Close, FastLength);
SlowTAvg = TriAverage(Close, SlowLength);
ADXVal = ADX(ADXLength);
Next we establish the basic Setup criteria. The Long side setup is TRUE if the Fast Triangular
Average is greater than the Slow Triangular Average. The Short side setup is TRUE if the Fast
Triangular Average is less than the Slow Triangular Average. The ADX setup is TRUE if the ADX
value is greater than the ADX value of 'FastLength' bars ago. Each of these criteria will be utilized to
establish valid Buy and Sell setups.
LongSetup = FastTAvg > SlowTAvg;
ShortSetup = FastTAvg < SlowTAvg;
ADXSetup = ADXVal > ADXVal[FastLength];
The Buy Setup is valid if the 'LongSetup' and 'ADXSetup' are both TRUE. In addition, a valid Buy
Setup requires that the High of the current bar be below the Fast Triangular Average value. For a
valid Sell Setup both the 'ShortSetup' and the 'ADXSetup' must be TRUE. In addition, the Sell Setup
also requires that the Low of the current bar be greater than the Fast Triangular Average value.
BuySetup = LongSetup AND ADXSetup AND High < FastTAvg;
SellSetup = ShortSetup AND ADXSetup AND Low > FastTAvg;
Long Entry
To generate a Long Entry order, one of two pairs of criteria must be met. The first criteria is that the
'LongSetup' is TRUE, and the current market position is NOT Long (the 'MarketPosition' is NOT 1).
These criteria would open the door to the first Long position of this pyramiding system. Assuming
that the above criteria are both TRUE, we would then check again that the 'MarketPosition' is not
equal to '1'. The reason that this criteria is evaluated again is because we will generate one type of
order (the initial position order) if the current market position is not already Long, and an alternate
order (the pyramiding system order) if the market position is already long. Therefore, at this point a
Long Entry Stop order would be placed 1 point above the High of the current bar. The other group of
criteria for an order to be placed requires that the 'BuySetup' be TRUE and that the number of
outstanding contracts is less than 3. If both of these criteria are TRUE, we then evaluate the current
market position. If the current position is Not Long, a Long Entry Stop order is placed one point
above the High of the current bar. If the current position is already Long, a pyramiding system order
is placed as a Long Entry Stop at the Fast Triangular Average value plus 1 point.
If (LongSetup AND MarketPosition <> 1) OR (BuySetup AND CurrentContracts < 3) Then Begin
If MarketPosition <> 1 Then
Buy Next Bar at High + 1 Point Stop
Else
Buy Next Bar at FastTAvg + 1 Point Stop;
End;
34
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Short Entry
To generate a Short Entry order, one of two pairs of criteria must be met. The first criteria is that the
'ShortSetup' is TRUE and the current market position is NOT Short (the 'MarketPosition' is NOT -1).
These criteria would open the door to the first Short position of this pyramiding system. Assuming
that the above criteria are both TRUE, we would then check again that the 'MarketPosition' is not
equal to '-1'. The reason that this criteria is evaluated again is because we will generate one type of
order (the initial position order) if the current market position is not already Short, and an alternate
order (the pyramiding system order) if the market position is already Short. Therefore, at this point, a
Short Entry Stop order would be placed 1 point below the Low of the current bar. The other pair of
criteria for an order to be placed requires that the 'SellSetup' be TRUE and that the number of
outstanding contracts is less than 3. If both of these criteria are TRUE, we then evaluate the current
market position. If the current position is Not Short, a Short Entry Stop order is placed one point
below the Low of the current bar. If the current position is already Short, a pyramiding system order
is placed as a Short Entry Stop at the Fast Triangular Average value minus 1 point.
If (ShortSetup AND MarketPosition <> -1) OR (SellSetup AND CurrentContracts < 3) Then Begin
If MarketPosition <> -1 Then
Sell Next Bar at Low - 1 Point Stop
Else
Sell Next Bar at FastTAvg - 1 Point Stop;
End;
Exits
If a Long position is taken, as indicated by a 'MarketPosition' of '1', a Long Exit order is generated at
1 point below the Slow Triangular Average value. If a Short position is taken, as indicated by a
'MarketPosition' of '-1', a Short Exit order is generated at 1 point above the Slow Triangular Average
value.
If MarketPosition = 1 Then
ExitLong Next Bar at SlowTAvg - 1 Point Stop;
If MarketPosition = -1 Then
ExitShort Next Bar at SlowTAvg + 1 Point Stop;
Testing & Improving
We tested Luxor on daily data for the Deutsche-Mark (DM) futures contract and Microsoft (MSFT).
For the DM, we tested both the long and short sides, deducting $40 per contract for slippage and $10
per contract for commission. For MSFT, we tested the long side only, in lots of 100 shares, deducting
$.13 per share for slippage and $.05 per share for commission.
First, let's see how Luxor performed on the DM. The optimized values are a 5-bar fast Triangular
Moving Average (TMA), a 30-bar slow TMA, a 12-bar ADX, and a maximum of 3 entries per
position (the initial entry and 2 pyramid entries). The bar chart [Figure 1 - DM bar chart] displays a
successful series of entries and a profitable exit, based on a 5-bar fast and 30-bar slow TMA.
The System Report [Figure 2 - System Report] shows that Luxor generated profits of $85,546 per
contract on 382 trades. Only 32% of the trades were winners, but the average winner was 3.15 times as
large as the average loser. After deducting for slippage and commission, the average trade earned $223.
Chapter 2
Testing & Improving
LUXOR
Figure 1 - DM bar chart
Figure 2 - System Report
35
36
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
The system lets profits run by staying in winning trades an average of 28 bars, while it cut losses
short in an average of only 5 bars. The Profit Factor of 1.52 means that the system made $1.52 for
each $1.00 it lost. Luxor's Equity Curve [Figure 3 - Equity Curve graph] shows that the system
performed very well for its first 200 trades and then treaded water until recently. Currently, equity has
resumed its climb and has risen to a new equity peak.
Figure 3 - Equity Curve graph
Luxor's Average Profit by Month graph [Figure 4 - Average Profit By Month graph] reveals that the
system produced profits in 9 months and suffered losses in 3 months, when monthly results are averaged
over the test period. The Total Trades graph [Figure 5 - Total Trades graph] demonstrates the importance
of positive outliers (trades more than 3 standard deviations greater than the average trade). Luxor's 8
positive outliers in the DM were largely responsible for the system's good net results.
Figure 4 - Average Profit By Month graph
Chapter 2
Testing & Improving
LUXOR
37
Figure 5 - Total Trades graph
Next, let's look at Luxor's performance on Microsoft (MSFT). The optimized values are a 7-bar fast
Triangular Moving Average (TMA), a 50-bar slow TMA, an 18-bar ADX, and a maximum of 4
entries (at 100 shares each) per position. The bar chart [Figure 6 - MSFT bar chart] illustrates a
recent series of trades in MSFT. Note how our system's pyramiding technique took advantage of the
steady uptrend.
Figure 6 - MSFT bar chart
38
Suggestions for Improvement
Omega Research System Trading and Development Club - Volume 9
The System Report [Figure 7 - System Report] indicates that Luxor won $8,482 on 81 trades.
Only 36% of the trades were profitable, but the average winner was a hefty 6.37 times the size of the
average loser. The largest winning trade ($2,082) far exceeded the largest losing trade ($355), and the
average trade (wins and losses) earned $104. The Profit Factor indicates that Luxor won $3.55 for
every $1.00 it lost.
Figure 7 - System Report
Suggestions for Improvement
We're pleased with both the initial entries and the pyramid entries of this system. Luxor's
performance could probably be improved, however, with some enhancements to the exit strategy.
Currently, the only exit is a close below the slow moving average (for a long position) or a close
above the slow moving average (for a short position). We recommend experimenting with a bar-ofentry stop, a breakeven stop, and additional trailing stops to strengthen this system.
CHAPTER 3
No Hurry
I
n several well-researched books about systems trading, the authors note that simple pricechannel breakouts tend to outperform all other popular entry techniques, suggesting that nothing is more bullish than a stock or commodity making a new n-bar high, nothing more bearish
than a new n-bar low. Buying and selling breakouts guarantees that a trader will participate in
every major trend in the markets he or she follows. If that seems an overly optimistic statement,
consider that a market can't embark on a significant new uptrend without exceeding recent prior
highs or begin a substantial new downtrend without penetrating recent prior lows.
Unfortunately, there's also a disadvantage to trading breakouts. Let's use a 20-bar price channel
as an example. Although every bull market must make a new 20-bar high, not every new 20-bar
high results in a sustained bull market; similarly, a bear market must make a new 20-bar low, but
not every 20-bar low makes a bear market.
Markets trend up or down (as opposed to fluctuating within a trading range) only 15 to 20 % of
the time. Therefore, a market rallying to a new 20-bar high may be more likely to decline than to
continue higher immediately; a market declining to a new 20-bar low may be more likely to stage
a rally than to continue lower without interruption.
To turn a profit, a price-channel breakout (or any other trend-following strategy) must a) win
enough money when it catches a trend to cover all the small losses it incurs while seeking a trend,
b) must win enough money to pay for slippage, commission, and the other costs of trading, and c)
must win enough money in excess of a and b to justify the trader's time and effort and the very
real risks inherent in financial speculation.
Not surprisingly, traders search for ways to improve the basic price-channel breakout strategy. In
our No Hurry system, we try to reduce the size and frequency of "whipsaw" losses by trading
breakouts from a price channel that starts a number of bars in the past. For example, we could
buy 1 point above the 5-bar high of a channel that began 20-bars ago, or we could sell short 1
point below the 7-bar channel that began 25-bars ago. We named the system No Hurry because
we aren't in a hurry to initiate a trade as the market breaks above or below the extremes of the
current channel. Instead, we wait to buy or sell breakouts from a channel a number of bars in the
past. Often, the reward-to-risk ratio offered by the No Hurry channel is more favorable than the
ratio offered by the current channel. By basing our entries on a channel breakout that occurred a
number of bars in the past, we can specify a shorter channel length than if we acted on breakouts
of the current channel. For example, instead of buying 1 point above a 30-bar channel and risking to 1 point below the 30-bar channel, we can buy 1 point above a 5-bar channel that began 25
bars ago and risk to 1 point below the 5-bar channel.
40
Defining Our Trading Rules
Omega Research System Trading and Development Club - Volume 9
To build our system, we specified default values for the length of the channel and for the number of
bars in the past on which we'd base our signals to buy or sell. Then we added an initial protective
stop, a breakeven stop, and a trailing stop. No Hurry's default values are a 20-bar price channel
delayed by 15 bars, a 10-bar average true range (ATR), a 3-ATR protective stop, a 2-ATR breakeven
stop, and a 5-ATR trailing stop.
Defining Our Trading Rules
In No Hurry, we defined long and short entries and stops. We also calculated a price channel and
delayed it by a specified number of bars. Our trading rules are described next.
Long and Short Entries
a) Buy at 1 point above the highest high of the last 20 bars, starting 15 bars ago.
b) Sell at 1 point below the lowest low of the last 20 bars, starting 15 bars ago.
Long Exits
a) Exit a long position at 1 point below the lowest low of the last 20 bars, starting 15 bars ago.
b) Exit a long position at the initial protective stop, the breakeven stop, or the trailing stop.
Short Exits
a) Exit a short position at 1 point above the highest high of the last 20 bars, starting 15 bars ago.
b) Exit a short position at 1 point above the highest high of the last 20 bars, starting 15 bars ago.
Designing & Formatting
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
EasyLanguage System Components: No Hurry (STAD9: No Hurry)
System Inputs (STAD9: No Hurry)Signal Components:
INPUT
Trailing_ATRs
DEFAULT
5
ATR_Length
10
Protective_ATRs 3
Breakeven_ATRs 2
Channel_Length 20
Channel_Delay 15
DESCRIPTION
The number of Average True Ranges that are risked
from the highest/lowest price of the position
The number of bars used to calculate the Average
True Range value
The number of Average True Ranges that are risked
in the position
The number of Average True Ranges that are
used to determine the position breakeven floor value
The number of bars used to calculate the high/low channel
The number of bars used for the displacement of
the channel
Chapter 3
Designing & Formatting
No Hurry
Signal Components
1. Delayed Chan BrkOut
2. ATR Protective Stop
3. ATR Breakeven Stop
4. ATR Trailing Stop
EasyLanguage Signal: Delayed Chan BrkOut:
Inputs: ChanLength(20), ChanDelay(15);
Variables: UpperChan(0), LowerChan(0), PositionFlag(0);
{Channel Calculation}
UpperChan = Highest(High, ChanLength)[ChanDelay];
LowerChan = Lowest(Low, ChanLength)[ChanDelay];
{Position direction variable assignment}
If MarketPosition = 1 Then
PositionFlag = 1;
If MarketPosition = -1 Then
PositionFlag = -1;
{System Entries}
If PositionFlag <> 1 AND MarketPosition <> 1 Then
Buy Next Bar at UpperChan + 1 Point Stop;
If PositionFlag <> -1 AND MarketPosition <> -1 Then
Sell Next Bar at LowerChan - 1 Point Stop;
Signal Inputs (Delayed Chan BrkOut)
INPUT
ChanLength
ChanDelay
DEFAULT
20
15
DESCRIPTION
The number of bars used to calculate the high/low channel
The number of bars used for the displacement of
the channel
Signal Variables (Delayed Chan BrkOut)
VARIABLE
UpperChan
LowerChan
PositionFlag
DEFAULT
0
0
0
DESCRIPTION
[Numeric] Holds the value of the displaced upper channel
[Numeric] Holds the value of the displaced lower channel
[Numeric] Indicates the direction of the most
current/most recent position
41
42
Designing & Formatting
Omega Research System Trading and Development Club - Volume 9
Setup
The first thing we do is to establish the channel, the basis for our signal. The upper channel value is
calculated using the 'Highest' function, then, the displaced calculation is assigned to the variable
'UpperChan'. The lower channel value is calculated using the 'Lowest' function, then, the displaced
calculation is assigned to the variable 'LowerChan'.
UpperChan = Highest(High, ChanLength)[ChanDelay];
LowerChan = Lowest(Low, ChanLength)[ChanDelay];
The 'PositionFlag' variable is used to keep track of the direction of the current or most recent position.
It does not reflect flat positions. Thus, when a Long position is taken, as indicated by a market
position of '1', the 'PositionFlag' variable is also assigned a value of '1'. The purpose of this is to
prevent multiple Long entries from being triggered consecutively. The handling of Short positions is
analogous.
If MarketPosition = 1 Then
PositionFlag = 1;
If MarketPosition = -1 Then
PositionFlag = -1;
Long Entry
In order for a Long Entry order to be placed, two criteria must be met. The current 'MarketPosition'
and the 'PositionFlag' variable must not be equal to 1. Since this system alternates between Long and
Short entries, requiring that both criteria are met assures that two of the same type of order do not
occur consecutively. The order is filled when the price breaks out above the upper channel value, plus
1 point.
If PositionFlag <> 1 AND MarketPosition <> 1 Then
Buy Next Bar at UpperChan + 1 Point Stop;
Short Entry
In order for a Short Entry order to be placed, two criteria must be met. The current 'MarketPosition'
and the 'PositionFlag' variable must not be equal to -1. Since this System alternates between Long
and Short entries, requiring that both criteria are met assures that two of the same type of order do not
occur consecutively. The order is filled when the price breaks out below the lower channel value
minus 1 point.
If PositionFlag <> -1 AND MarketPosition <> -1 Then
Sell Next Bar at LowerChan - 1 Point Stop;
EasyLanguage Signal: ATR Protective Stop
** See Common Stops Appendix A
EasyLanguage Signal: ATR Breakeven Stop
** See Common Stops Appendix A
EasyLanguage Signal: ATR Trailing Stop
** See Common Stops Appendix A
Chapter 3
Testing & Improving
No Hurry
43
Testing & Improving
We tested No Hurry on daily data for IBM and Crude Oil from 1/2/1984 to 5/7/99. For IBM, we
tested the long side only and deducted $.13 per share for slippage and $.05 per share for commission.
For Crude Oil, we tested both the long and short sides and deducted $40 per contract for slippage and
$10 per share for commission.
Let's look at our system's performance on IBM. The optimized values are a 40-bar price channel
delayed by 15 bars, a 10-bar average true range (ATR), a 4-ATR protective stop, a 2-ATR breakeven
stop, and a 4-ATR trailing stop.
The bar chart [Figure 1; IBM bar chart] shows the two most recent trades. In October, the system
bought 100 shares of IBM at 1 point above the 40-bar price channel (delayed 15 bars) and about 4
months later exited on a trailing stop. After IBM formed a small quadruple bottom, the system bought
again 1 point above the channel and exited on the last bar of the test data.
Figure 1 - IBM bar chart
No Hurry earned $13,127 (per 100 shares) on 37 trades, with 51% profitable and an average trade of
$354. The largest winning trade was $3,319 compared to a largest losing trade of only $643. Our
system let profits run by staying in winning trades an average of 58 bars, while cutting losses short by
exiting losing trades in an average of only 17 bars. The profit factor (dollars won per dollar lost) was
exceptional at 3.74 [Figure 2; System Report].
The Equity Curve [Figure 3; Equity Curve graph] shows that the No Hurry system, unfortunately, was
in no hurry to generate large profits quickly. The system was only marginally profitable after the first
25 trades, but it performed strongly for the remainder of the test period and accrued significant profits.
Average Profit by Month [Figure 4; Average Profit By Month graph] shows that the system posted 9
winning months versus only 3 losing months when monthly returns are averaged over the
15-year test period.
44
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Figure 2 - System Report
Figure 3 - Equity Curve graph
Chapter 3
Testing & Improving
No Hurry
Figure 4 - Average Profit By Month graph
Figure 5 - Maximum Favorable Excursion graph
Maximum Favorable Excursion is illustrated in Figure 5 [Figure 5; Maximum Favorable Excursion
graph]. The dollar amount of the profit or loss for each trade is plotted on the vertical axis, while
each trade's run-up in dollars is plotted on the horizontal axis. Upward-pointing triangles depict
winning trades; downward ones, losing trades. The MFE graph shows that all trades that moved at
least $1,000 in our favor were eventually closed out with a profit. The system did a good job of
cutting losses short, letting profits run, and exiting without giving back a lot of open profits.
45
46
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Now, let's evaluate No Hurry's performance on Crude Oil. The optimized values are a 10-bar price
channel delayed by 15 bars, a 15-bar average true range (ATR), a 4-ATR protective stop, a 2-ATR
breakeven stop, and a 5-ATR trailing stop.
Figure 5 is a daily bar chart of Crude Oil with a 10-bar price channel delayed 15 bars [Figure 6;
Crude Oil bar chart]. Going long 1 contract in March of this year, the system had earned $5,649 in
open profits as of May 7th, the last day of the test data. The overall performance numbers [Figure 7;
System Report] are encouraging: No Hurry accumulated $64,024 in net profit on 93 trades. 41% of
the trades were profitable, with a ratio of average win to average loss of 3.53 and an average trade of
$688. The system won $2.44 for each $1.00 it lost.
Figure 6 - Crude Oil bar chart
Figure 7 - System Report
Chapter 3
Testing & Improving
No Hurry
47
The Annual Trading Summary [Figure 8; Annual Trading Summary] shows that the system lost
money in only 2 years (1984 and 1991) during the 15-year test period. The Equity Curve [Figure 9;
Equity Curve graph] rises throughout the 15 years with only minor equity dips. Taking the bar-by-bar
view of equity, [Figure 10; Equity Chart By Bar graph] rather than the trade-by-trade view, reveals a
similar steady equity climb. Figure 11 is Monthly Rolling Net Profit, a snapshot of the system's
equity taken on the last trading day of each month [Figure 11; Monthly Rolling Net Profit graph].
Here, MNRP confirms the system's consistent results.
Figure 8 - Annual Trading Summary
Figure 9 - Equity Curve graph
48
Suggestions for Improvement
Omega Research System Trading and Development Club - Volume 9
Figure 10 - Equity Chart By Bar graph
Figure 11 - Monthly Rolling Net Profit graph
Suggestions For Improvement
Three possible ways to improve this system come readily to mind: first, require that ADX (average
directional index) be above 25 and rising at the time of the delayed channel breakout and on the
current bar. This will ensure that the market is not only breaking out but that it is also in a trending
mode. Second, add a filter requiring price confirmation of the breakout. For example, in an uptrend,
you could require the market to surpass the n-bar high by a multiple of the average true range rather
than only by 1 tick. Third, add a time filter. In a downtrend, for example, you could require the
market to close below the close of the breakout bar for the next 1 or 2 bars.
CHAPTER 4
OBV Revisited
I
n STAD Club issue 2, we published a system based on the On-Balance Volume indicator
(OBV). For this issue, we improved OBV by including a measure of buying and selling
power in its calculation. We call the enhanced indicator Weighted OBV (WOBV) and the
system OBV Revisited.
The original OBV indicator was created many years ago by Joe Granville, a popular and influential stock-market guru. He computed a running total of daily volume for each stock he was following, adding the day's volume to the total if the stock closed higher than the previous day's
close and subtracting the day's volume if the stock closed lower than the previous day's close.
Joe taught that new highs in the price of a stock were suspect if they were unaccompanied by
new highs in his OBV indicator. The original indicator has continued to work well to the current
time.
One of the appealing features of OBV is its simplicity — add today's volume to a running total if
the stock closes higher, subtract it if the stock closes lower. The ease of calculation was a big
plus in the years before personal computers when technical analysts maintained their indicators
with paper, pencil, and slide rule.
Of course, no indicator is perfect. OBV has been criticized for assigning a plus or minus to the
day's entire volume when the stock may have closed only 1/8th above or below the previous day's
close. Obviously, no day is 100% bullish or 100% bearish.
The Weighted OBV indicator (WOBV) is designed to take into account each day's range and its
movement from the open to the close. The formula for WOBV is as follows:
WOBV = ((Close - Open) / (High - Low)) x Volume
After constructing WOBV, we calculate its 20-bar simple moving average. When WOBV crosses
above the moving average, we have a buy setup; when it crosses below, we have a sell setup.
When a buy setup is in effect, we place an order to buy 1 point above the high of the setup bar
and maintain it there until our entry price is hit or the setup is cancelled (WOBV crossing below
its moving average would, of course, negate the buy setup). In the case of a setup to sell, we
place an order to go short 1 point below the low of the setup bar and keep it there until it's hit or
the setup is cancelled.
50
Defining Our Trading Rules
Omega Research System Trading and Development Club - Volume 9
Upon entering a position, we place a protective stop, a breakeven stop, and a trailing stop. When
long, we also exit if WOBV crosses below its moving average; when short, we also exit if WOBV
crosses above its moving average.
For our OBV Revisited system, we specified the following default values: 25 for the moving average
of OBV, 20 for the average true range (ATR) length, 4 ATR's for the initial protective stop, 3 ATR's
for the breakeven stop, and 4 ATR's for the trailing stop.
Defining Our Trading Rules
In OBV Revisited, we defined long and short entries and stops. We also calculated WOBV and its
simple moving average. Our trading rules are described next.
Long and Short Setups
a) A long setup is in effect when WOBV crosses above its simple moving average.
b) A sell setup is in effect when WOBV crosses below its simple moving average.
Long and Short Entries
a) Long entry is 1 point above the high of the setup bar.
b) Short entry is 1 point below the low of the setup bar.
Long and Short Exits
a) Exit longs 1 point below the initial protective stop, the breakeven stop, or the trailing stop. Also
exit longs if WOBV crosses below its moving average.
b) Exit shorts 1 point above the initial protective stop, the breakeven stop, or the trailing stop. Also
exit shorts if WOBV crosses above its moving average.
Chapter 4
Designing & Formatting
OBV Revisited
Designing & Formatting
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
EasyLanguage System Components: OBV Revisited (STAD9: OBV Revisited)
System Inputs (STAD9: OBV Revisited)
INPUT
Trailing_ATRs
DEFAULT
4
ATR_Length
20
Protective_ATRs 4
Breakeven_ATRs 4
OBV_Avg_Length 25
DESCRIPTION
The number of Average True Ranges that are risked
from the highest/lowest price of the position
The number of bars used to calculate the Average
True Range value
The number of Average True Ranges that are risked in
the position
The number of Average True Ranges that are used
to determine the position breakeven floor value
Number of bars within which a order can be
placed after a confirmed setup
Signal Components:
1. OBV Weighted
2. ATR Protective Stop
3. ATR Breakeven Stop
4. ATR Trailing Stop
EasyLanguage Signal: OBV Weighted:
Inputs: AvgLength(25);
Variables: WOBV(0), SMA(0), BuySetup(False), SellSetup(False), LEPrice(0), SEPrice(0);
If Range <> 0 Then
WOBV = WOBV + (((Close - Open) / Range) * Volume);
SMA = Average(WOBV, AvgLength);
If WOBV Crosses Above SMA Then Begin
BuySetup = True;
LEPrice = High;
SellSetup = False;
ExitShort This Bar on Close;
End;
51
52
Designing & Formatting
Omega Research System Trading and Development Club - Volume 9
If WOBV Crosses Below SMA Then Begin
SellSetup = True;
SEPrice = Low;
BuySetup = False;
ExitLong This Bar on Close;
End;
If MarketPosition = 1 Then
BuySetup = False;
If MarketPosition = -1 Then
SellSetup = False;
If BuySetup Then
Buy Next Bar at LEPrice + 1 Point Stop;
If SellSetup Then
Sell Next Bar at SEPrice - 1 Point Stop;
Signal Inputs (OBV Weighted)
INPUT
AvgLength
DEFAULT
25
DESCRIPTION
Number of bars within which a order can be placed
after a confirmed setup
Signal Variables (OBV Weighted)
VARIABLE
WOBV
DEFAULT
0
SMA
0
BuySetup
False
SellSetup
False
LEPrice
0
SEPrice
0
DESCRIPTION
[Numeric] Holds the value of the weighted On
Balance Volume
[Numeric] Holds the value of the Smoothed weighted
On Balance Volume
[True/False] Flag which indicates if a valid Buy
Setup exists
[True/False] Flag which indicates if a valid Sell
Setup exists
[Numeric] Holds the High price from when the
WOBV crossed above the SMA
[Numeric] Holds the Low price from when the
WOBV crossed below the SMA
Chapter 4
Designing & Formatting
OBV Revisited
53
Setup
We begin the signal with the calculation and assignment of the Weighted On Balance Volume
(WOBV) and the Smoothed WOBV. The WOBV is only calculated if the Range is not equal to zero,
since a portion of the overall calculation is divided by the Range. The smoothed WOBV is assigned to
the variable SMA.
If Range <> 0 Then
WOBV = WOBV + (((Close - Open) / Range) * Volume);
SMA = Average(WOBV, AvgLength);
If the Weighted On Balance Volume crosses above the Smoothed WOBV any Short position is
completely closed out and a Long position setup is initiated. To indicate the start of a Long setup, the
'BuySetup' flag is set to TRUE. The High of the bar on which the crossover occurred is assigned to
the 'LEPrice' variable. This value will be used as the price basis for the Long entry. The 'SellSetup'
Variable is set to FALSE, thus ending the Short position setup period. In addition, the ExitShort is
used to exit any existing short positions on the Close of the current bar.
If WOBV Crosses Above SMA Then Begin
BuySetup = True;
LEPrice = High;
SellSetup = False;
ExitShort This Bar on Close;
End;
If the Weighted On Balance Volume crosses below the Smoothed WOBV any Long position is
completely closed out and a Short position setup is initiated. To indicate the start of a Short setup, the
'SellSetup' flag is set to TRUE. The Low of the bar on which the crossover occurred is assigned to
the 'SEPrice' Variable. This value will be used as the price basis for the Short entry. The 'BuySetup'
Variable is set to FALSE, thus ending the Long position setup period. In addition, the ExitLong is
used to exit any existing long positions on the Close of the current bar.
If WOBV Crosses Below SMA Then Begin
SellSetup = True;
SEPrice = Low;
BuySetup = False;
ExitLong This Bar on Close;
End;
Once a position has been established in either direction (Long or Short), the setup for that direction is
canceled. Thus, if the market position is '1' (Long), the 'BuySetup' Variable is set to FALSE. If the
market position is '-1' (Short), the 'SellSetup' Variable is set to FALSE.
If MarketPosition = 1 Then
BuySetup = False;
If MarketPosition = -1 Then
SellSetup = False;
54
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Long Entry
While the 'BuySetup' Variable is TRUE, a Long Entry Stop order is placed at the 'LEPrice', plus 1
point.
If BuySetup Then
Buy Next Bar at LEPrice + 1 Point Stop;
Short Entry
While the 'SellSetup' Variable is TRUE, a Short Entry Stop order is placed at the 'SEPrice', minus 1
point.
If SellSetup Then
Sell Next Bar at SEPrice - 1 Point Stop;
EasyLanguage Signal: ATR Protective Stop
** See Common Stops Appendix A
EasyLanguage Signal: ATR Breakeven Stop
** See Common Stops Appendix A
EasyLanguage Signal: ATR Trailing Stop
** See Common Stops Appendix A
Testing & Improving
We tested OBV Revisited on weekly data for Johnson & Johnson (JNJ) from 1/2/1984 to 5/7/1999
and on daily data for British Pound futures for the same dates. For JNJ we tested the long side only
and deducted $.13 per share for slippage and $.05 per share for commission. For the British Pound,
we tested both the long and short sides and deducted $40 per contract for slippage and $10 per
contract for commission.
Let's see how well our system performed on JNJ. The optimized values are a 30-bar average of
WOBV, an ATR length of 15, an initial protective stop of 4 ATR's, a breakeven stop of 3 ATR's, and a
trailing stop of 4 ATR's.
The JNJ bar chart [Figure 1; JNJ bar chart] shows a timely signal to buy, a very effective exit, and a
quick re-entry when the uptrend showed signs of resuming. The lower window of the chart contains
the WOBV indicator (drawn as a histogram) and its 30-bar (in this case, 30-week) simple moving
average.
OBV Revisited earned $6,226 (per 100 shares) on 21 trades when applied to the JNJ weekly chart.
57% of the trades were profitable with an average winner of $610 and an average loser of only $121.
The system let profits run for an average of 43 weeks for winning trades, while it cut losses short by
exiting losing trades in only 6 weeks. The average win was 5.02 times as big as the average loss, and
the system earned $6.70 (Profit Factor) for each $1.00 it lost. [Figure 2; System Report]
Chapter 4
Testing & Improving
OBV Revisited
Figure 1 - JNJ bar chart
Figure 2 - System Report
55
56
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
The Annual Trading Summary [Figure 3; Annual Trading Summary] lists the results of each year's
trading for OBV Revisited. The system lost money in 3 years but made money in 12 years. The most
recent losing year was 1993. The Equity Curve (not shown) reveals a substantial gain of over $1,000
on the first 6 trades but a forfeiture of about half that amount by trade 14. Trades 15 to 21, however,
earned profits of about $6,000.
Figure 3 - Annual Trading Summary
Figure 4 - Underwater Equity Curve graph
Chapter 4
Testing & Improving
OBV Revisited
57
As usual, the Underwater Equity Curve [Figure 4; Underwater Equity Curve graph] looks worse than
it is. The equity decline from 1991 to 1995 was only about 3%. Its duration was more serious than its
magnitude. All subsequent drawdowns were very minor. The Average Profit by Month [Figure 5;
Average Profit By Month graph] was nearly perfect, posting 11 profitable months when averaged over
the 15-year test period, compared to only 1 losing month.
Figure 5 - Average Profit By Month graph
58
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Let's turn our attention to OBV Revisited's performance on the British Pound. The optimized values
are a 30-bar average of WOBV, an ATR length of 25, an initial protective stop of 4 ATR's, a
breakeven stop of 3 ATR's, and a trailing stop of 4 ATR's.
The bar chart [Figure 6; British Pound bar chart] illustrates a good short entry and a spectacular exit
just 1 bar off the major bottom. Our system earned $99,930 on 227 trades with 37% profitable.
The largest winner ($21,012) was about 5 times the size of the largest loser ($4,212), and the average
trade (wins and losses) made $440. Winners were held for an average of 26 bars; losers were dropped
after an average of only 6 bars.
Figure 6 - British Pound bar chart
OBV Revisited's Equity Curve [Figure 7; Equity Curve graph] depicts strong performance until about
trade 138 and relatively flat performance thereafter. Average Profit by Month [Figure 8; Average
Profit By Month graph], however, shows that the system was reasonably consistent, winning in 9
months per year on average through the 15-year test period and losing in only 3 months.
Chapter 4
Testing & Improving
OBV Revisited
Figure 7 - Equity Curve graph
Figure 8 - Average Profit By Month graph
59
60
Suggestions For Improvement
Omega Research System Trading and Development Club - Volume 9
Suggestions For Improvement
Applied to the British Pound, our system has been treading water from trade 138 to trade 227 (the
most recent trade). When a system that produced excellent results in the past has been floundering for
so long, we like to re-optimize its values.
Remember that we consider optimization to be a fine-tuning of our systems. Sometimes even an excellent
trading system gets out-of-tune with the way a market has been trading recently. Re-optimizing OBV
Revisited on more current data should improve its performance for the foreseeable future.
CHAPTER 5
Red Rover, Red Rover
T
his system is named for a game many of us played when we were kids. The relevance
(tenuous at best, but we like the name) is that the game involved forming two lines facing each
other about 100 feet apart. The objective was to prevent kids on the opposing team from
breaking through your line. In our Red Rover trading system, we calculate 2 lines, one of support
and one of resistance, and enter a new position when prices break through one of the lines.
The first step in building the system is to calculate a weighted close for the current bar. To do
this, add the bar's high, low, and 2 times the close; then divide the total by 4. Next, to get the
resistance line for the next bar, multiply the weighted close by 2 and then subtract the low.
Finally, to get the support line for the next bar, multiply the weighted close by 2 and then subtract
the high.
Here's an example: say the current bar has a high of 1478, a low of 1374, and a close of 1472.
Add 1478 + 1374 + 1472 + 1472 (again) for a total of 5796. Divide 5796 by 4 for a weighted
close of 1449. To get the resistance line, multiply 1449 by 2 (2898) and subtract 1374.
Resistance equals 1524. To get the support line, multiply 1449 by 2 (2898) and subtract 1478.
Support equals 1421.
For the next bar, we'll buy at 1525 (one point above resistance) or sell at 1420 (one point below
support). The idea behind the system is that when a market is strong enough to rally through
resistance or weak enough to decline through support, we should enter a trade in the direction of
the penetration.
Red Rover is a stop-and-reverse system. If support is penetrated first, buy on a reversal to 1 point
above resistance and risk to 1 point below the low of the current bar. If resistance is penetrated first,
sell on a reversal to 1 point below support and risk to 1 point above the high of the current bar.
If long on the close, set the next bar's protective stop at the support line calculated for the bar
minus 1 point. If short on the close, set the next bar's protective stop at the resistance line
calculated for the bar plus 1 point.
The profit-target exit for a long-side Red Rover trade is determined by adding a multiple of the
average true range (ATR) to the entry price. The target for a short-side trade is determined by
subtracting a multiple of the ATR from the entry price. Each day in a long position, attempt to
take profits at the target and set your stop 1 point below the support line; each day in a short
position, attempt to take profits at the target and set your stop 1 point above the resistance line.
62
Defining Our Trading Rules
Omega Research System Trading and Development Club - Volume 9
Defining Our Trading Rules
In Red Rover, we defined long and short entries, stops, and profit targets. We also calculated a weighted
close, a support line, a resistance line, and an ATR. The system's default values are an ATR of 10 bars and
a profit target of the entry price plus or minus n times the ATR. The entries, stops, and profit targets are
described next.
Long and Short Entries
a) Buy at 1 point above resistance.
b) Sell at 1 point below support.
Long and Short Stops
a) Exit long at support minus 1 point.
b) Exit short at resistance plus 1 point.
Long and Short Exits
a) Exit long at entry price plus n times the ATR.
b) Exit short at entry price minus n times the ATR.
Designing & Formatting
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
EasyLanguage System Components: Red Rover, Red Rover
(STAD9: Red Rover)
System Inputs (STAD9: Red Rover)
INPUT
Profit_Target_ATRs
DEFAULT
2
ADX_Length
10
DESCRIPTION
The number of Average True Ranges
that are used to specify the
Profit Target value
The number of bars used to calculate the ADX
Chapter 5
Designing & Formatting
Red Rover, Red Rover
Signal Components:
1. Red Rover
2. ATR Profit Target
EasyLanguage Signal: Red Rover:
Variables: WAvgPrice(0), Resistance(0), Support(0);
{Calculation of Variables}
WAvgPrice = (High + Low + (Close * 2)) / 4;
Resistance = (WAvgPrice * 2) - Low;
Support = (WAvgPrice * 2) - High;
{Signal Entries}
If MarketPosition <> 1 Then
Buy Next Bar at Resistance + 1 Point Stop;
If MarketPosition <> -1 Then
Sell Next Bar at Support - 1 Point Stop;
Signal Inputs (Red Rover)
NONE
Signal Variables (Red Rover)
VARIABLE
WavgPrice
DEFAULT
0
Resistance
Support
0
0
DESCRIPTION
[Numeric] Holds the value of the Weighted Average
calculation
[Numeric] Holds the calculation of the Resistance level
[Numeric] Holds the calculation of the Support level
Setup
The Setup consists of the calculation and assignment of essential values. The first value that is
calculated is the Weighted Average Price (WAvgPrice). This value is calculated by adding the High,
Low, and twice the Close, then dividing the value by 4. The 'Resistance' level is calculated by
multiplying the Weighted Average Price by 2, then subtracting the Low from the result. Finally, the
'Support' level is calculated by multiplying the Weighted Average Price by 2, then subtracting the
High from the result.
WAvgPrice = (High + Low + (Close * 2)) / 4;
Resistance = (WAvgPrice * 2) - Low;
Support = (WAvgPrice * 2) - High;
63
64
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Long Entry
If the current position is not Long, as indicated by a market position that is not equal to 1, a Long
Entry Stop order is placed at the Resistance level, plus 1 point.
If MarketPosition <> 1 Then
Buy Next Bar at Resistance + 1 Point Stop;
Short Entry
If the current position is not Short, as indicated by a market position that is not equal to -1, a Short
Entry Stop order is placed at the Support level minus 1 point.
If MarketPosition <> -1 Then
Sell Next Bar at Support - 1 Point Stop;
EasyLanguage Signal: ATR Profit Target
** See Common Stops Appendix A
Testing & Improving
We tested the long side of Red Rover on daily and weekly data for the S&P 500 futures contract
going back 15 years. We deducted $40 per trade for slippage and $10 per trade for commission.
Let's look at our system's performance on the daily S&P first. The optimized values are a 7-bar ATR
length and a 3-ATR profit target. The daily bar chart [Figure 1; S&P daily bar chart] shows recent
long entries and exits. Red Rover earned $182,797 on 888 trades [Figure 2; System Report]. 45% of
the trades were profitable, and the average win was 1.76 as large as the average loss. The average
trade won $205.
Figure 1 - S&P daily bar chart
Chapter 5
Red Rover, Red Rover
Testing & Improving
65
Figure 2 - System Report
The Annual Trading Summary [Figure 3; Annual Trading Summary] shows that our system earned a
profit in 12 of the 15 years tested (it lost in 1984, 1987, and 1994). The Equity Curve [Figure 4;
Equity Curve graph] portrays the system's struggle to stay in positive territory through the first 300
trades and its tremendous climb to almost $200,000 by the end of the test period.
Figure 3 - Annual Trading Summary
66
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Figure 4 - Equity Curve graph
Figure 5 is the Underwater Equity Curve [Figure 5; Underwater Equity Curve graph]. The worst
drawdown, which occurred in 1987, was about 17%; the next worst drawdown was only about 13% in
1998. Average Profit by Month [Figure 6; Average Profit By Month graph] was exceptionally strong
— 11 months won money while only one month (August) lost money — when monthly returns were
averaged over the 15-year test period.
Figure 5 - Underwater Equity Curve graph
Chapter 5
Red Rover, Red Rover
Testing & Improving
67
Figure 6 - Average Profit By Month graph
Red Rover's performance on weekly data was encouraging also. The weekly optimized values were
identical to the daily values with one exception: tests on the weekly data included a $3,000 moneymanagement stop; tests on the daily data employed no money-management stop. Figure 7, the weekly
bar chart, displays the system's recent trades [Figure 7; S&P weekly bar chart]. Winners were kept an
average of 3 bars, while losers were cut short after only 1 bar.
Figure 7 - S&P weekly bar chart
68
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
The Performance Summary shows that Red Rover applied to weekly data earned $87,257 on 186
trades for an average trade of $469 [Figure 8; System Report]. 43% of the trades were profitable,
and the ratio of average win to average loss was 1.94 to 1. The system made $1.46 for each $1.00
it lost. Figure 9, the Equity Curve, reveals that Red Rover hovered around the $20,000 profit
plateau for about 160 trades before exploding to $100,000 in profits by trade 180 [Figure 9; Equity
Curve graph].
Figure 8 - System Report
Figure 9 - Equity Curve graph
Chapter 5
Red Rover, Red Rover
Testing & Improving
69
Average Profit by Month [Figure 10; Average Profit By Month graph] shows that only 8 months were
profitable when monthly performance was averaged over the length of the test period, compared to 11
profitable months for the daily data. The Total Trades graph [Figure 11; Total Trades graph] highlights
the importance of Positive Outlier trades in a trend-following system. The 3 Positive Outliers (trades
more than 3 standard deviations above the average trade) are represented by the 3 filled circles near
the right edge of the graph and far above the line representing the average trade.
Figure 10 - Average Profit by Month graph
Figure 11 - Total Trades graph
70
Suggestions for Improvement
Omega Research System Trading and Development Club - Volume 9
Red Rover's monthly results are displayed in Figure 12 [Figure 12 - Monthly Net Profit graph].
Profitable months, of course, extend above the zero line, while losing months extend below zero.
Note that our system's monthly results became more volatile beginning in 1997 — the biggest
winning months and the biggest losing months all occurred within the last 3 years.
Figure 12 - Monthly Net Profit graph
Suggestions for Improvement
Although Red Rover takes relatively quick profits at a fixed target, its entries are trend-following (as
opposed to counter-trend), buying on a breakout above resistance and selling short (although only the
long side was tested for the S&P) on a breakdown below support. Consider adding the ADX (Average
Directional Index) to this system, requiring it to be above 25 and rising (greater than it was 1 bar ago)
for a trade to be initiated. Use the PDI and MDI lines (+ Directional Index and - Directional Index) to
determine the trend: if PDI is greater than MDI, the trend is up; if MDI is greater than PDI, the trend
is down. Only take Red Rover trades in the direction of the trend.
CHAPTER 6
Skinny Dipper
O
ur Skinny Dipper system enters a trade in the direction of the short-term and long-term trends
after identifying a setup pattern called a naked close. A naked close is a close outside the
previous bar's high-low range, a close settling above the previous bar's high or below the previous
bar's low. We call it a naked close because the close is not "covered" by the previous bar's range.
In Skinny Dipper, we use 2 exponential moving averages (EMA's) to tell us the short-term and longterm trends. For a bullish setup, the close must be above both EMA's but below the previous bar's
low; for a bearish setup, the close must be below both EMA's but above the previous bar's high.
With a buy setup in effect, we place an order good for 1 bar only to go long at 1 point above the high
of the naked-close bar. After entering a new long position, we place a bar-of-entry protective stop.
When the trade moves in our favor, we place a breakeven stop, a trailing stop, and a limit order to
take profits at our entry price plus a multiple of the average true range (ATR).
The conditions for an entry on the short-side of the market are reversed. First, we monitor for a close
below the short-term and long-term moving averages but above the previous bar's high. Then, we
place an order good for 1 bar only to sell short at 1 point below the low of the naked-close bar. As
soon as we're filled on a new short position, we place a protective stop for the bar of entry. Then,
when the trade moves in our favor, we place a breakeven stop, a trailing stop, and a limit order to take
profits at our entry price minus a multiple of the ATR.
Why do we choose to go long after a close below the previous bar's low and to go short after a close
above the previous bar's high? Here's the logic behind the system: first, we only enter a position in
the direction of both the short-term and long-term trends. Despite the naked close in the opposite
direction of the trade we want to take, we're trading with the trend on both a short-term and long-term
basis. Second, we don't automatically buy or sell as soon as an entry setup is in place. In an uptrend,
we will buy only if the market rallies above the high of the naked-close bar on the very next bar; in a
downtrend we will sell only if the market declines below the low of the naked-close bar on the very
next bar. This strategy works because we're requiring the market to do something unusual to prove its
strength or weakness before we enter a new position. We've identified a market that is strong enough
to rally immediately above the high of a naked down-close bar or weak enough to decline
immediately below the low of a naked up-close bar.
For our Skinny Dipper system, we specified the following default values: a 50-bar long-term EMA, a
15-bar short-term EMA, a 10-bar ATR, a 2-ATR initial protective stop, a 2-ATR breakeven stop, and
a 4-ATR profit target.
72
Defining Our Trading Rules
Omega Research System Trading and Development Club - Volume 9
Defining Our Trading Rules
In Skinny Dipper, we defined long and short setups, entries, stops, and profit targets. We also
calculated long-term and short-term EMA's and the ATR. Our trading rules are described next.
Long and Short Setups
a) A long setup is in effect for 1 bar only when the close is above both EMA's but below the previous
bar's low.
b) A short setup is in effect for 1 bar only when the close is below both EMA's but above the previous
bar's high.
Long and Short Entries
a) Long entry is 1 point above the high of the naked down-close bar.
b) Short entry is 1 point below the low of the naked up-close bar.
Long and Short Exits
a) Exit longs at 1 point below the initial protective stop, the breakeven stop, or the trailing stop. Exit
on a limit order at the profit target.
b) Exit shorts at 1 point above the initial protective stop, the breakeven stop, or the trailing stop. Exit
on a limit order at the profit target.
Chapter 6
Designing & Formatting
Skinny Dipper
Designing & Formatting
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
EasyLanguage System Components: Skinny Dipper (STAD9: Skinny Dipper)
System Inputs (STAD9: Skinny Dipper)
INPUT
Protective_ATRs
DEFAULT
2
ATR_Length
10
Breakeven_ATRs
2
Profit_Target_ATRs
4
Long_Term_Average
50
Short_Term_Average
15
DESCRIPTION
The number of Average True Ranges that
are risked in the position
The number of bars used to calculate
the Average True Range value
The number of Average True Ranges that
are used to determine the position
breakeven floor value
The number of Average True Ranges that
are used to specify the Profit Target value
The number of bars used to calculate
the long-term or "slow" exponential
moving average
The number of bars used to calculate
the short-term or "fast" exponential
moving average
Signal Components:
1. Skinny Dipper
2. ATR Breakeven Stop
3. ATR Profit Target
4. ATR Protective Stop
EasyLanguage Signal: Skinny Dipper:
Inputs: LongTermAvg(50), ShortTermAvg(15);
{Setup}
Condition1 = Close > XAverage(Close, LongTermAvg);
Condition2 = Close > XAverage(Close, ShortTermAvg);
Condition3 = Close < Low[1];
{Long Entry}
If Condition1 AND Condition2 AND Condition3 Then
Buy Next Bar at High[1] + 1 Point Stop;
73
74
Designing & Formatting
Omega Research System Trading and Development Club - Volume 9
Signal Inputs (Skinny Dipper)
INPUT
LongTermAvg
DEFAULT
50
ShortTermAvg
15
DESCRIPTION
The number of bars used to calculate the long-term
or "slow" exponential moving average
The number of bars used to calculate the short-term
or "fast" exponential moving average
Signal Variables (Skinny Dipper)
NONE
Setup
In order for a buy order to be placed, there are 3 basic conditions that must be met. The built-in
Variables 'Condition1', 'Condition2', and 'Condition3' are used to represent these criteria. 'Condition1'
will be TRUE if the current Close is greater than the long-term (Slow) exponential moving average of
the Close. 'Condition2' will be TRUE if the current close is greater than the short-term (Fast)
exponential moving average of the Close. 'Condition3' will be TRUE if the Close is less than the Low
of the previous bar.
Condition1 = Close > XAverage(Close, LongTermAvg);
Condition2 = Close > XAverage(Close, ShortTermAvg);
Condition3 = Close < Low[1];
Long Entry
If the three conditions specified above all return TRUE, a Long Entry Stop order is placed at the High
of the previous bar plus 1 point.
If Condition1 AND Condition2 AND Condition3 Then
Buy Next Bar at High[1] + 1 Point Stop;
The rules for trading the short side are analogous to the rules for the long side. The EasyLanguage
code for both the long and short sides is included in the STAD 9 CD.
EasyLanguage Signal: ATR Breakeven Stop
** See Common Stops Appendix A
EasyLanguage Signal: ATR Profit Target
** See Common Stops Appendix A
EasyLanguage Signal: ATR Protective Stop
** See Common Stops Appendix A
Chapter 6
Testing & Improving
Skinny Dipper
75
Testing & Improving
We tested Skinny Dipper on daily data for Wal-Mart and on Deutsche Mark futures from 1/2/1984 to
4/28/1999. For Wal-Mart, we tested the long side only and deducted $.13 per share for slippage and
$.05 per share for commission. For the Deutsche Mark, we tested both the long and the short sides,
deducting $40 per contract for slippage and $10 per contract for commission.
Let's take a look at our system's performance on Wal-Mart. The optimized values were a long-term
EMA of 70 bars, a short-term EMA of 20 bars, an initial protective stop of 1 ATR, a breakeven stop
of 1 ATR, and a profit target of 10 ATR's.
The Wal-Mart bar chart [Figure 1; Wal-Mart bar chart] shows the purchase of 100 shares in December
of 1998 and the profitable exit in March of 1999. Note that the naked close was above both EMA's
but below the previous bar's low and that the entry was just above the high of the naked-close bar.
The exit occurred when open profits in the trade equaled 10 ATR's.
Figure 1 - Wal-Mart bar chart
Skinny Dipper earned $5,626 (per 100 shares) on 27 trades, with 33% of the trades profitable.
The largest winning trade ($2,232) was 21 times the size of the largest losing trade ($105), and the
average trade (wins and losses) made $208. Our system let profits run on winning trades for an
average of 64 bars but cut losses short in an average of 17 bars. The Profit Factor is one of the
highest we've ever seen at $11.49 gained for each $1.00 lost [Figure 2; System Report].
The Equity Curve [Figure 3; Equity Curve graph] illustrates an important point: trend-following
systems won't make much money when the market lacks major trends; however, a good system won't
lose too much money during the market's trendless phases and will make lots of money when the
market begins to trend well. The graph of Average Profit by Month [Figure 4; Average Profit By
Month graph] shows that the system posted 9 profitable months versus only 3 losing months when the
monthly returns are averaged over the 15-year test period.
76
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Figure 2 - System Report
Figure 3 - Equity Curve graph
Next, let's see how our system performed on the Deutsche Mark. The optimized values are a 40-bar
EMA, a 20-bar EMA, a 10-bar ATR, an initial protective stop of 3 ATR's, a breakeven stop of 3
ATR's, and a profit target of 4 ATR's.
The D-Mark bar chart [Figure 5; D-Mark bar chart] shows the most recent 3 trades. Two were closed
out at their profit target of 4 ATR's, while the last trade exited with a profit on the final bar of
the test period.
Chapter 6
Testing & Improving
Skinny Dipper
Figure 4 - Average Profit By Month graph
Figure 5 - D-Mark bar chart
77
78
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Skinny Dipper earned $37,582 on 112 trades with 46% of the trades profitable and a ratio of average
win to average loss of 1.66. The average trade (wins and losses) made $335 [Figure 6; System Report].
The Annual Trading Summary [Figure 7; Annual Trading Summary] lists the profit or loss for each of
the 15 years in the test period. The system traded profitably in 12 years while losing in only 3. The
Equity Curve [Figure 8; Equity Curve graph] is punctuated by several quick and shallow drawdowns,
but our system continued to make new equity highs to the last day of trading in the test period.
Figure 6 - System Report
Figure 7 - Annual Trading Summary
Chapter 6
Testing & Improving
Skinny Dipper
79
Figure 8 - Equity Curve graph
Figure 9 is a graph of Maximum Adverse Excursion [Figure 9; Maximum Adverse Excursion graph].
The vertical axis displays the dollar amount of profit or loss on each trade; the horizontal axis displays
the maximum drawdown each trade experienced. Note the following: only 1 winning trade
experienced a drawdown of more than $2,000, but 15 losing trades experienced a drawdown greater
than $2,000. This disparity suggests that a stop of about $2,100 would probably improve the system.
Also note that about 12 trades were stopped out at breakeven, compliments of the system's breakeven
stop. Finally, note that a majority of the winning trades experienced worst drawdowns of less than
$1,000. The system's timing was effective — most winners were in good shape throughout the life of
the trade.
Figure 9 - Maximum Adverse Excursion graph
80
Suggestions For Improvement
Omega Research System Trading and Development Club - Volume 9
Suggestions For Improvement
In its current form, Skinny Dipper moves a stop to breakeven but doesn't move it any farther than that to
lock in profits as trades move in our favor. Once the breakeven stop is in place, only 3 possibilities
exist: 1) the trade gets stopped out at breakeven, 2) the trade is reversed from long to short or from short
to long (unlikely), or 3) the trade exits at its profit target. Perhaps adding a trailing stop that takes at
least some profits when the system doesn't reach the profit target would improve the bottom line.
CHAPTER 7
International Index Composite System
by Hans Stimming
January 13, 1999: 9:42 a.m. ET. CnnFn news
"Europe's stock markets extended their losses Wednesday, with banking
stocks suffering especially sharp declines as Brazil's financial woes
flared into full-blown crisis (…). The malaise spread to New York too,
with the Dow Jones shedding about 100 points within minutes
of the open.(…)"
I
n macroeconomic theory, the repeated sequence of economic expansion giving way to temporary decline followed by recovery is known as the business cycle. Business cycles are a central concern for money market analysts. They are felt throughout the entire economy and
directly affect stock prices. History has proven that stock prices are generally procyclical, which
means that they rise in good economic times and decline in economic recessions.
Although US traders tend to focus their concerns on U. S. business cycles, they are by no means
independent from other business cycles throughout the world. In most cases, the cyclical behavior
of key economic variables in international markets is similar and correlated to that described for
the United States.
It's a fact that business cycles are an international phenomenon. All of the major industrial
economies undergo recessions and expansions at about the same time, suggesting that they share
common cycles.
It's a small world and economic crises are no longer isolated events. Our rapidly changing world
is heading toward a globalization of the markets. Due to information systems and communication
enhancements, we can't consider the markets of the world to be secluded entities any more.
Since globalization has such an effect on our markets, why not trade the most important indexes
in the world in accordance with the performance of the Dow Jones, the most significant US
index. That is, if we know that the Dow Jones is experiencing a drop, we should be able to short
the Asian markets waiting for their reaction to the US economy news.
Furthermore, why not take advantage of the time difference between the two markets? For example, there is a 13- hour time differential between the US and Japanese markets. The Japanese
money market opens just 4 hours after the close of the NYSE. Therefore, when the Wall Street
82
Omega Research System Trading and Development Club - Volume 9
market closes at 4:00pm EST, the Japanese are beginning preparations for the opening of their money
market. International markets don't trade at exactly the same session times. Nevertheless, when we
base our systems and trading strategies on them, we don't take into account the overlapping of time.
The closing of the Dow in the US is much more influential in the international markets than is shown
in the raw daily data.
To illustrate how important globalization and time differences have become in today's trading, here is
an example of an e-mail update that thousands of Wall Street Journal readers get every morning:
TOP ASIAN NEWS
from The Wall Street Journal Interactive Edition.
May 5, 1999
Markets closed mixed Wednesday across the Asian-Pacific region as profittaking curbed gains following Wall Street's retreat on Tuesday. Hong Kong
shares edged higher and Indonesian shares hit their highest level since
September 1997.
Market Indexes
Australia All Ordinaries
3041.7 - 1.37%
China DJ China 88
112.94 + 0.34%
Hong Kong Hang Seng
13586.21 + 0.20%
Japan Nikkei
Market Closed for Holiday
Singapore Straits Times
1965.18 + 1.72%
Taiwan Weighted
7572.16 - 0.21%
The Japanese know what a heavily influential factor the American economy is. More than 20 percent
of US exports are directed to Japan.
But how does all this fit into our system development?
Let's start with a very simple system that would buy the Nikkei when the Dow closed up the previous
day and sell it when the Dow closed down. In other words, we will trade the Nikkei daily depending
on the behavior of the Dow Jones on the previous day.
In order to do this, we need to create a chart with two data series. Insert in Data1 the Nikkei Index
since 1/1/98 and in Data2 the Dow Jones for the same date range.
Our EasyLanguage signal will look something like this:
Signal: DJ vs. Nikkei
If Close[1] of Data2 < Close of Data2 Then
Buy Next Bar at Open
Else
Sell Next Bar at Open;
Chapter 7
International Index Composite System
83
Using the Signal above, we will then create a System using SystemBuilder. When applied to the
chart, the system will buy a share of the Nikkei when the Dow (Data2) is in an uptrend. The uptrend
is identified when the Close of one bar ago ([1]), is lower than the current Close. Conversely, when
the Dow (Data2) is in a down trend, that is, when the Close of one bar ago ([1]) is higher than the current Close, the system will short a share of the Nikkei.
Applied to a chart, the results are as follows:
Tokyo Nikkei Dow - Daily
System Report
84
Omega Research System Trading and Development Club - Volume 9
Looking at the System Performance Report we find that this rudimentary system is 61% profitable. It
is not recommended that you trade this system, as it is still under development, and the results are
experimental. Our intention here is to come to a conclusion regarding the correlation of the
international markets.
The system is profitable, but does this mean that there is an influence of the Dow over the Nikkei?
Furthermore, does this mean that there is an interaction between international markets? Certainly, this
is not enough evidence to confirm such a suggestion. We need to procure more information. To
achieve a more accurate interpretation, we could repeat the above process by applying the same
experimental system to other world indexes.
The following is a table of the most important indexes in the world and their System Performance
Report results using the exact same system:
Name
Total
Net Profit
Percent
profitable (%)
Return on
Account (%)
Bovespa Index
TSE 300 Composite
IPC Index
Lima General
(24,971.9)
242.60
689.02
1.67
45
52
55
52
(63.96)
377.29
53.37
167
ASIA/PACIFIC
Australia
All Ordinaries
Hong Kong Hang Seng
Japan
Nikkei 225
Singapore
Straits Times
498.98
1833.55
853.02
(36.20)
49
49
61
49
248.99
64.75
387.10
(16.18)
EUROPE
France
Germany
Italy
Spain
U.K.
1328.96
532.00
53.30
(214.19)
4871.70
49
47
52
42
59
223.49
62.74
9.65
52.91
1245.96
AFRICA/MIDDLE EAST
Israel
TA-100
173.53
South Africa Johannesburg All Share (229.46)
49
53
551.24
(25.40)
AMERICAS
Brazil
Canada
Mexico
Peru
CAC 40
DAX
MIBTel
Madrid General
FTSE 100
From the results, we can draw some important conclusions. There is a tendency for economically
unstable and less developed countries to be less influenced by the Dow Jones. Looking at the results
of countries like South Africa, Brazil, Peru or Singapore, they seem to be less dependent upon global
economic factors. On the other hand, France and the United Kingdom are very profitable when
following the Dow trends, which could indicate that they are more in line with the globalization of the
markets than Brazil and Singapore. We also see big profits in industrialized countries like Hong Kong
and Japan. However, we expected better results from countries like Italy and Spain.
Mexico and Canada are special cases, as the system is based on a difference in the hourly time and the
ability to know the results of the Dow in advance. This is not the case in Mexico and Canada.
Chapter 7
Section Title
International Index Composite System
85
Let's say that we could conclude that the influence of the Dow throughout the world is a fact, and that
that influence is felt even more strongly in developed countries due to a globalization of the markets.
We used the Dow Jones in the previous analysis because it is the most recognizable and highly
publicized index in the world. However, we will switch our analysis to the S&P 500 Index, as it is
more representative of the US economy. Taking this theory a step further, we will create a composite
of the most industrialized countries in the world and build a system to trade an index in the US.
The world's seven largest economies are unified in an international pact called the Group of Seven or
"G7." Members of the G7 are the United States, Germany, Japan, France, the United Kingdom, Italy,
and Canada.
We will create a composite of the six countries' indexes, excluding the US, and use it as an indicator
for trading the S&P.
As a first step, we need a chart with the seven indices' data streams. Notice that the S&P should be
set as data(1) since that is the one we want to trade.
The following are our Data Stream settings:
Data Stream
1
2
3
4
5
6
7
Country
United States
Canada
France
Germany
Italy
Japan
United Kingdom
Index
S&P 500
TSE 300
CAC 40
DAX
MIBTel
Nikkei
FTSE 100
Applied to a chart, the Data Streams look like this:
S&P 500 Stock Index Daily
86
Omega Research System Trading and Development Club - Volume 9
The six data streams (Data2 to Data7) will be elements of our international index composite.
The composite will be created by the following EasyLanguage Function:
Function: Composite
Inputs: W2(NumericSimple),W3(NumericSimple), W4(NumericSimple), W5(NumericSimple),
W6(NumericSimple), W7(NumericSimple);
Variables: Numerator(0), Denominator(1);
Numerator = W2*(Close of Data2) + W3*(Close of Data3) + W4*(Close of Data4) + W5*(Close
of Data5) + W6*(Close of Data6) + W7*(Close of Data7);
Denominator = W2 + W3 + W4 + W5 + W6 + W7;
If Denominator <> 0 Then
Composite = Numerator / Denominator;
Inputs W2 to W7 are the assigned weights to each data stream. We need the weights to perform an
average of each data stream multiplied by its weight. The reason for having the weights as inputs of a
function is the benefit of being able to optimize them when running the system.
Any number of approaches can be used to establish the weights to be assigned to each international
index. One approach would be to assign higher weights to those countries with the strongest
economies (higher GDP). Another approach would be to assign lower weights to those countries
geographically farthest from the US. A third approach, which is the one used in our analysis, is to
assign weights according to the dependence of the US economy on the other country's economy. We
considered that the US would be more dependent on the countries with which it traded the most. We
thought that a good indicator of that dependency would be the export percentage. The following table
includes a column with the percentage of US exports to every country in the G7. The last column
shows the adjusted weights to be used for our composite.
Data Stream
Country
Index
Exports(%)
Adjusted Weight
1
United States
S&P 500
n/a
n/a
2
Canada
TSE 300
22%
.49
3
France
CAC 40
3%
.07
4
Germany
DAX
4%
.09
5
Italy
MIBTel
1%
.02
6
Japan
Nikkei
10%
.22
7
United Kingdom
FTSE 100
5%
.11
Once these weights have been established, we can plot our composite. This is the Plot statement to be
used in EasyLanguage:
Indicator: STAD9: Intl Idx Comp
Variables: W2(.49), W3(.07), W4(.09), W5(.02), W6(.22), W7(.11);
Plot1(Composite(W2, W3, W4, W5, W6, W7), "Composite");
Chapter 7
International Index Composite System
87
S&P 500 Stock Index Daily
Notice that the composite is a derivation of the international markets excluding the US. This means
that the correlation you see between the plots is evidence of market globalization.
Now it's time to use our indicator to build a system. To keep it simple, we will use a Moving Average
2 line System based on the composite indicator.
The definition of Moving Average can be found in the Omega Research Help:
A moving average is an asset's average calculated over a specified period of time. For
example, a 30 bar moving average includes the last thirty bars of an asset's value in its
calculation. The next day, the moving average replaces the earliest bar (which is now the
thirty-first day) with the most recent bar to calculate the current bar's moving average.
Moving averages are often used to obtain a smoothed value of an asset.
The system will apply two moving averages with different lengths to the composite indicator. When
the two moving averages cross, a signal will be triggered. That signal will be a setup. If the setup is
confirmed by a direction in the trend (a stop), we will enter a position.
Here is the EasyLanguage:
Signal: Intl Index Composite
Inputs: W2(.49), W3(.07), W4(.09), W5(.02), W6(.22), W7(.11), FastLength(9), SlowLength(18);
Variables: FastAvg(0), SlowAvg(0);
If W2 + W3 + W4 + W5 + W6 + W7 = 1 Then Begin {just making sure the weights add to 1}
FastAvg = AverageFC(Composite(W2,W3,W4,W5,W6,W7), FastLength);
SlowAvg = AverageFC(Composite(W2,W3,W4,W5,W6,W7), SlowLength);
If CurrentBar > 1 AND FastAvg Crosses Above SlowAvg Then
Buy Next Bar at Close + 1 Point Stop; {the stop confirms the trend}
End;
If CurrentBar > 1 AND FastAvg Crosses Below SlowAvg Then
Sell Next Bar at Close - 1 Point Stop; {the stop confirms the trend}
88
Omega Research System Trading and Development Club - Volume 9
After creating the Signal, we would create a System in SystemBuilder using the two signals below:
• Intl Index Composite
• Last Bar Exit
Applied to our chart the System would look like this:
S&P 500 Stock Index Daily
Optimization was performed on this system for the length inputs of both Moving Averages.
In fact, if you have a fast computer and some free time, you could run an optimization on the six
weight inputs of the composite as well. The results of the optimization were a length of 10 for the fast
moving average, and a length of 9 for the slow moving average.
The results of the system report are as follows:
System Report
Chapter 7
International Index Composite System
Section Title
89
As you can see, the system performance is very acceptable considering the simplicity of the system.
It has a very high winning percentage of 81%. In addition, the Max consecutive losing trades is only
1, and the largest losing trade is less than a third of the total account size required to trade this system.
This means that this system is very comfortable to trade.
We could trade this indicator in more elaborate systems and get very profitable results. In fact, every
system based on a US index could be transformed to trade based on this international composite
indicator. The calculations would indirectly include the market — globalization feature, which is not
to be ignored in trading any longer.
About the author
Hans Stimming, the designer of the International Index Composite System and the author of this
chapter, is a member of Omega Research’s Quality Assurance Team. If you have any questions or
comments for Hans, you may e-mail him at Hans.Stimming@OmegaResearch.com.
CHAPTER 8
Swinger
O
ur Swinger system employs an oscillator and a moving average to trade short-term market
swings. The oscillator measures the market's momentum, while the moving average
measures the market's trend. We want to initiate trades in the direction of the trend as
soon as momentum increases and to exit our trades as soon as momentum decreases.
Our oscillator will be constructed by calculating the difference between two simple moving
averages — a fast average and a slow one. If the fast average is greater than the slower one,
momentum is bullish; if the fast average is less than the slower one, momentum is bearish. When
the difference between the two averages increases, momentum is accelerating; when the
difference decreases, momentum is decelerating.
Momentum is a leading indicator of prices. In other words, momentum usually decreases before
prices reverse their trends. However, momentum is a very sensitive indicator, generating many
false signals. In Swinger, we'll try to decrease the number of false signals by only taking trades
in the direction of the underlying trend. When the moving average identifies an uptrend, we'll
trade the long side of the market; when the market's in a downtrend, we'll trade the short side.
The entry rules are very simple. If the oscillator is greater than it was on the previous bar, and
the close is above the moving average, we'll buy at the market (the open of the next bar). If the
oscillator is less than it was on the previous bar, and the close is below the moving average, we'll
sell short at the market.
Our exit strategy in Swinger attempts to lock in profits while still allowing the market to trend in
our favor. When we're in a long position and the oscillator declines, we'll set a trailing stop at the
lowest low of the last n — bars; when we're short and the oscillator rises, we'll set our stop at the
highest high of the last n — bars. We like this strategy because it requires two things to occur
before we will exit our positions: first, the market's momentum has to dissipate, and second,
prices have to reverse and make a new n-bar low (in an uptrend) or a new n-bar high (in a
downtrend).
92
Defining Our Trading Rules
Omega Research System Trading and Development Club - Volume 9
Defining Our Trading Rules
In this system, we defined both long and short entries and exits. We also did some setup work to
calculate the Simple Moving Average and the Price Oscillator. The setup, entries, and exits are
described next.
Setup
a) Calculate a 50-bar Simple Moving Average of closes.
b) Calculate a Price Oscillator with a slow average of 20 and a fast average of 5.
Entries
a) If the oscillator is greater than it was one bar ago, and the close is above the moving average, then
buy on the open of the next bar.
b) If the oscillator is less than it was one bar ago, and the close is below the moving average, then sell
short on the open of the next bar.
Exits
a) If the oscillator is less than it was one bar ago, exit a long position at the lowest low of the last nbars (default of 3 bars).
b) If the oscillator is greater than it was one bar ago, exit a short position at the highest high of the last
n-bars (default of 3 bars).
Chapter 8
Designing & Formatting
Swinger
Designing & Formatting
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
EasyLanguage System Components: Swinger (STAD9: Swinger)
System Inputs (STAD9: Swinger)
INPUT
Protective_ATRs
ATR_Length
Fast_Length
Slow_Length
Average_Length
HiLo_Bars
DEFAULT DESCRIPTION
4
The number of Average True Ranges that are risked
in the position
10
The number of bars used to calculate the
Average True Range value
5
Number of bars used to calculate the Fast (Short Term)
Moving Average for the Price Oscillator
20
Number of bars used to calculate the Slow (Long Term)
Moving Average for the Price Oscillator
50
Number of bars used to calculate the Moving
Average trend filter
3
Number of bars used to calculate the highest
High and lowest Low for the Trailing Stop
Signal Components:
1. Swing Trader
2. ATR Protective Stop
EasyLanguage Signal: Swing Trader:
Inputs: FastLength(5), SlowLength(20), AvgLength(50), Nbars(3);
Variables: PriceOsc(0), PriceOscAgo(0), AvgFilter(0);
{Variables are defined}
PriceOsc = PriceOscillator(Close, FastLength, SlowLength);
PriceOscAgo = PriceOsc[1];
AvgFilter = Average(Close, AvgLength);
{Long Entry}
If PriceOsc > PriceOscAgo AND PriceOsc < 0 AND Close > AvgFilter Then
Buy Next Bar at Market;
{Short Entry}
If PriceOsc < PriceOscAgo AND PriceOsc > 0 AND Close < AvgFilter Then
Sell Next Bar at Market;
93
94
Designing & Formatting
Omega Research System Trading and Development Club - Volume 9
{Long Exit}
If MarketPosition = 1 Then Begin
If PriceOsc < PriceOscAgo Then
ExitLong Next Bar at Lowest(Low, NBars) Stop;
End;
{Short Exit}
If MarketPosition = -1 Then Begin
If PriceOsc > PriceOscAgo Then
ExitShort Next Bar at Highest(High, NBars) Stop;
End;
Signal Inputs (Swing Trader)
INPUT
FastLength
DEFAULT
5
SlowLength
20
AverageLength
50
Nbars
3
DESCRIPTION
Number of bars used to calculate the Fast (Short Term)
Moving Average for the Price Oscillator
Number of bars used to calculate the Slow (Long Term)
Moving Average for the Price Oscillator
Number of bars used to calculate the Moving
Average trend filter
Number of bars used to calculate the highest High
and lowest Low for the Trailing Stop
Signal Variables (Swing Trader)
VARIABLE
PriceOsc
DEFAULT
0
PriceOscAgo
0
AvgFilter
0
DESCRIPTION
[Numeric] Holds the value of the weighted On
Balance Volume
[Numeric] Holds the value of the smoothed weighted
On Balance Volume
[Numeric] Holds the value of the smoothed weighted
On Balance Volume
Setup
The setup for this signal consists primarily of the calculation of the most commonly used values. The
value of the Price Oscillator, the Price Oscillator Value for the previous bar, and the Average filter are
each calculated.
PriceOsc = PriceOscillator(Close, FastLength, SlowLength);
PriceOscAgo = PriceOsc[1];
AvgFilter = Average(Close, AvgLength);
Chapter 8
Designing & Formatting
Swinger
95
Long Entry
In order for a Long Entry to be triggered, three criteria must be met. First, the Price Oscillator must
be above the Price Oscillator value on the previous bar. Second, the Price Oscillator must be less than
zero. Finally, the Close must be greater than the Moving Average filter value. If all three criteria are
met, a Long Entry order is placed on the Open of the next bar (at Market).
If PriceOsc > PriceOscAgo AND PriceOsc < 0 AND Close > AvgFilter Then
Buy Next Bar at Market;
Short Entry
In order for a Short Entry to be triggered, as in the case of the Long Entry, three criteria must be met.
First, the Price Oscillator must be below the Price Oscillator value on the previous bar. Second, the
Price Oscillator must be greater than zero. Finally, the Close must be less than the Moving Average
filter value. If all three criteria are met, a Short Entry order is placed on the Open of the next bar (at
Market).
If PriceOsc < PriceOscAgo AND PriceOsc > 0 AND Close < AvgFilter Then
Sell Next Bar at Market;
Long Exit
When a Long position is taken, as indicated by a market position of '1', and the Price Oscillator falls
below the Price Oscillator value of the previous bar, a trailing Long Exit Stop order is placed at the
lowest Low of the last 'NBars'.
If MarketPosition = 1 Then Begin
If PriceOsc < PriceOscAgo Then
ExitLong Next Bar at Lowest(Low, NBars) Stop;
End;
Short Exit
When a Short position is taken, as indicated by a market position of '-1', and the Price Oscillator
crosses above the Price Oscillator value of the previous bar, a trailing Short Exit Stop order is placed
at the highest High of the last 'NBars'.
If MarketPosition = -1 Then Begin
If PriceOsc > PriceOscAgo Then
ExitShort Next Bar at Highest(High, NBars) Stop;
End;
EasyLanguage Signal: ATR Protective Stop
** See Common Stops Appendix A
96
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Testing & Improving
We tested the Swinger system on 15 years of daily data for IBM and Coffee futures. For IBM, we
deducted $.05 per share for commission and $.13 per share for slippage. For Coffee, we deducted $10
per contract for commission and $40 per contract for slippage.
The optimized values for IBM are as follows:
ATR Protective ATRs = 3
ATR Length = 10
Fast Length = 9
Slow Length = 30
Moving Average Length = 40
N-bar High/Low = 8
The IBM chart [Figure 1; IBM Bar Chart] depicts an excellent recent trade. Note that we bought 100
shares on the next open after the oscillator increased (to a less negative number) with the close above
the moving average, and that we exited about 3 months later when the oscillator declined (to a less
positive number).
Figure 1 - IBM Bar Chart
The System Report [Figure 2; System Report] tells us that Swinger earned $6,038 (per 100 shares) on
104 trades, with 39% of the trades profitable. The average winner was 2.82 times as large as the
average loser. The system held on to winning trades for an average of 30 bars, while abandoning
losing trades in an average of only 9 bars.
Swinger's Equity Curve [Figure 3; Equity Curve] shows the system hovering around breakeven until
its tremendous surge in IBM's recent bull market.
Chapter 8
Testing & Improving
Swinger
97
Figure 2 - System Report
Figure 3 - Equity Curve
Although excellent profits were available to the patient trader, few (if any) traders would choose to (or
be able to) wait approximately 12 years to realize their profits. The key is to diversify the portfolio so
that some holdings are performing well to compensate for those that are performing poorly at any
given time. The worst total drawdown on a diversified portfolio is usually less than the worst
drawdown on any of its components.
98
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Figure 4 - Average Profit By Month
The graph of Total Trades [Figure 5; Total Trades] emphasizes the impact of positive outliers (trades
more than 3 standard deviations above the average trade). In this case, the 2 recent positive outliers
accounted for a high percentage of the system's total profits in IBM.
Figure 5 - Total Trades
Chapter 8
Testing & Improving
Swinger
99
Next, let's take a look at Swinger's performance on Coffee futures. The optimized values are as
follows:
ATR Protective ATRs = 1
ATR Length = 10
Fast Length = 9
Slow Length = 20
Moving Average Length = 60
N-bar High/Low = 3
The bar chart [Figure 6; Coffee Bar Chart] illustrates a series of trades on the long side of the Coffee
market. Note that the system exited aggressively, but that it also reentered aggressively each time the
upward momentum increased.
Figure 6 - Coffee Bar Chart
The System Report [Figure 7; System Report] tells us that Swinger earned $193,434 on 348 trades,
with 34% of the trades profitable and an average trade of $555. The average winner was 3.74 times
the size of the average loser, and the system gained $1.90 for each $1.00 it lost. With its optimized
protective stop of 1 Average True Range from entry, it's not surprising that Swinger cut losses quickly
— exiting the average losing trade after only 3 bars, while holding on to the average winning trade for
14 bars. The Equity Curve for Coffee [Figure 8; Equity Curve] shows a quick rise to $50,000 in net
profits, a long equity plateau, and a recent explosion to more than $200,000 in net profits per contract.
100
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Figure 7 - System Report
Figure 8 - Equity Curve
Chapter 8
Suggestions for Improvement
Swinger
Suggestions for Improvement
101
At Omega, we believe that almost any trading system can be improved by requiring a 2-step process
to initiate a trade — a setup and a separate entry condition. Swinger currently only has the setup,
entering long, for example, on the next open if the oscillator increases and the close is above the
moving average. Consider adding an entry condition. For example, after a bullish setup, only go long
if prices make a new 2-bar high. As another example, only initiate a new long position after the setup
if the market rallies 75% of an average daily range above the open. The 2-step entry strategy will
filter out many trades that would have been losses without it.
CHAPTER 9
Traffic Jam
W
e call this system Traffic Jam because its entries and exits occur in areas of congestion.
The ADX (Average Directional Index) will tell us when a market is in a congestion
phase. Then we'll wait for the market to reach a high or low extreme within the
congestion. When prices are low, we'll buy; when they're high, we'll sell short. Since we're
betting that the market will continue to trade within its recent congestion area, we'll exit quickly
rather than holding our position and trying to catch a new trend.
To define congestion, we require that ADX be less than 25 and less than it was 3 bars ago.
To identify a low price within the congestion, we look for 3 consecutive down closes (closes
below the previous bar's close); to identify a high price, we look for 3 consecutive up closes.
We enter a long position on the third down-close and a short position on the third up-close.
Our protective stop is set at 3 average true ranges (ATR's) from our entry price. Our exit is on the
close a fixed number of bars after entry (3 bars is the default value).
104
Defining Our Trading Rules
Omega Research System Trading and Development Club - Volume 9
Defining Our Trading Rules
For Traffic Jam, we defined long and short entries, protective stops, and profit targets. We also
calculated ADX and ATR. This system's default values are a 3-bar ATR initial protective stop, a 5-bar
ATR length, a 14-bar ADX length, an ADX level of 25, 3 consecutive down — closes, 3 consecutive
up-closes, a long-exit length of 3 bars, and a short-exit length of 3 bars. The entries, stops, and exits
are described next.
Long Entries
a) Identify an ADX below 25 and less than it was 3 bars ago.
b) Identify 3 consecutive down-closes.
c) Buy on the third down-close.
Short Entries
a) Identify an ADX below 25 and less than it was 3 bars ago.
b) Identify 3 consecutive up-closes.
c) Sell short on the third up-close.
Long and Short Exits
a) Risk 3 ATR's from entry price.
b) Exit on the close of the third bar after entry.
Chapter 9
Designing & Formatting
Traffic Jam
Designing & Formatting
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
EasyLanguage System Components: Traffic Jam (STAD9: Traffic Jam)
System Inputs (STAD9: Traffic Jam)
INPUT
Fixed_Bar_Exit
Protective_ATRs
ATR_Length
ADX_Length
ADX_Level
Consecutive_Up_Closes
Consecutive_Dn_Closes
DEFAULT DESCRIPTION
3
A fixed number of bars at which the system will
exit the current position
3
The number of Average True Ranges that are
risked in the position
5
The number of bars used to calculate the
Average True Range value
14
The number of bars used to calculate the ADX
25
The value of the ADX level, below which is
considered to represent an area of congestion
3
The number of consecutive bars with up Closes
3
The number of consecutive bars with down Closes
Signal Components:
1. Traffic Jam
2. Fixed Bar Exit LX
3. Fixed Bar Exit SX
4. ATR Protective Stop
EasyLanguage Signal: Traffic Jam:
Inputs: ADXLength(14), ADXLevel(25), ConsecDnCloses(3), ConsecUpCloses(3);
Variables: ADXVal(0);
ADXVal = ADX(ADXLength);
{Setup Criteria for System Entries}
Condition1 = ADXVal < ADXLevel AND ADXVal < ADXVal[MaxList(ConsecDnCloses,
ConsecUpCloses)];
Condition2 = CountIf(Close < Close[1], ConsecDnCloses) = ConsecDnCloses;
Condition3 = CountIf(Close > Close[1], ConsecUpCloses) = ConsecUpCloses;
{System Entries}
If Condition1 Then Begin
If Condition2 Then
105
106
Designing & Formatting
Omega Research System Trading and Development Club - Volume 9
End;
Buy This Bar on Close;
If Condition3 Then
Sell This Bar on Close;
Signal Inputs (Traffic Jam)
INPUT
ADXLength
ADXLevel
ConsecDnCloses
ConsecUpCloses
DEFAULT DESCRIPTION
14
The number of bars used to calculate the ADX
25
The value of the ADX level, below which is considered to
represent an area of congestion
3
The number of consecutive bars with up Closes
3
The number of consecutive bars with down Closes
Signal Variables (Traffic Jam)
VARIABLE
ADXVal
DEFAULT
0
DESCRIPTION
[Numeric] Holds the value of the ADX calculation
Setup
The Setup begins with the calculation of the ADX. This calculation is assigned to the variable
'ADXVal'.
ADXVal = ADX(ADXLength);
The built-in Variables 'Condition1', 'Condition2', and 'Condition3' are used to represent the three basic
criteria upon which the Signal is based. 'Condition1' is TRUE if the ADX is below the congestion
level (ADXLevel) and the ADX is less than the ADX value of a prior period. That prior period is
defined by the larger of the 'ConsecDnCloses' and 'ConsecUpCloses' Inputs. 'Condition2' uses the
'CountIf' Function to determine if the specified number of down Closes have occurred. 'Condition3'
also uses the 'CountIf' Function to determine if the specified number of up-Closes have occurred.
Condition1 = ADXVal < ADXLevel AND ADXVal < ADXVal[MaxList(ConsecDnCloses,
ConsecUpCloses)];
Condition2 = CountIf(Close < Close[1], ConsecDnCloses) = ConsecDnCloses;
Condition3 = CountIf(Close > Close[1], ConsecUpCloses) = ConsecUpCloses;
Chapter 9
Designing & Formatting
Traffic Jam
107
Entries
If 'Condition1' is TRUE, indicating a period of congestion, as per the ADX, we evaluate conditions 2 &
3 to determine if there are any orders to be placed. First, 'Condition2' is evaluated to determine if the
specified number of down Closes has occurred. If 'Condition2' is TRUE, a Buy order is placed on the
Close of the current bar. Next, 'Condition3' is evaluated to determine if the specified number of up
Closes has occurred. If 'Condition3' is TRUE, a Sell order is placed on the Close of the current bar.
If Condition1 Then Begin
If Condition2 Then
Buy This Bar on Close;
If Condition3 Then
Sell This Bar on Close;
End;
EasyLanguage Signal: Fixed Bar Exit LX:
Inputs: Length(5);
If BarsSinceEntry = Length Then
ExitLong ("FxBr") This Bar on Close;
Signal Inputs (Fixed Bar Exit LX)
INPUT
Length
DEFAULT
5
DESCRIPTION
A fixed number of bars at which the system will exit
the current Long position
Signal Variables (Fixed Bar Exit LX)
NONE
Long Exit
When the number of bars since the Entry is equal to the value specified by the 'Length' Input, a Long
Exit order is placed at the Close of the current bar.
If BarsSinceEntry = Length Then
ExitLong ("FxBr") This Bar on Close;
EasyLanguage Signal: Fixed Bar Exit SX:
Inputs: Length(5);
If BarsSinceEntry = Length Then
ExitShort ("FxBr") This Bar on Close;
108
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Signal Inputs (Fixed Bar Exit SX)
INPUT
Length
DEFAULT
5
DESCRIPTION
A fixed number of bars at which the system will
exit the current Short position
Signal Variables (Fixed Bar Exit SX)
NONE
Short Exit
When the number of bars since the Entry is equal to the value specified by the 'Length' Input, a Short
Exit order is placed at the Close of the current bar.
If BarsSinceEntry = Length Then
ExitShort ("FxBr") This Bar on Close;
EasyLanguage Signal: ATR Protective Stop
** See Common Stops Appendix A
Testing & Improving
We tested Traffic Jam on daily data for General Motors (GM) and Crude Oil (CL) from 1/3/84 to
4/30/99. For GM, we tested the long side only and deducted $.13 per share for slippage and $.05 per
share for commission. For CL, we tested both the long and short sides, deducting $40 per contract for
slippage and $10 per contract for commission.
Let's see how Traffic Jam performed on GM. The optimized values are a 2-ATR initial protective
stop, a 7-bar ATR length, a 14-bar ADX length, an ADX level of 20, 3 consecutive down-closes, and
a long-exit length of 3 bars. The GM daily bar chart [Figure 1; GM bar chart] shows a series of 4
winning trades. Note that our system entered its long positions on the third consecutive down-close
and exited on the close 3 bars later.
The Performance Summary [Figure 2; System Report] shows that Traffic Jam earned $2,249 (per 100
shares) on 59 trades with 47% of the trades profitable. The average winner was 1.91 times as large as
the average loser, and the system made $1.73 for each $1.00 it lost. Monthly Net Profit [Figure 3;
Monthly Net Profit graph] displays the profit or loss for each month during the 15-year test period.
Note that the 5 most profitable months all occurred between 1997 and 1999.
Chapter 9
Testing & Improving
Traffic Jam
Figure 1 - GM bar chart
Figure 2 - System Report
109
110
Testing & Improving
Omega Research System Trading and Development Club - Volume 9
Figure 3 - Monthly Net Profit graph
Figure 4 shows each trade's Maximum Adverse Excursion [Figure 4; Maximum Adverse Excursion
graph]. The dollar amount of each trade's profit or loss is displayed on the vertical axis, and each
trade's biggest dollar drawdown is displayed on the horizontal axis. The upward-pointing triangles
represent winning trades, the downward ones losing trades. Note that very few winning trades
suffered a drawdown of more than $100 ($1.00 per share), indicating that the system's timing and risk
control were favorable. Maximum Favorable Excursion [Figure 5; Maximum Favorable Excursion
graph] plots each trade's profit or loss on the vertical axis and the biggest dollar run-up on the
horizontal axis. Only a few losing trades experienced run-ups of more than $200, suggesting that the
system didn't let trades with large open profits turn into losses.
Figure 4 - Maximum Adverse Excursion graph
Chapter 9
Testing & Improving
Traffic Jam
111
Figure 5 - Maximum Favorable Excursion
Next, let's take a look at Traffic Jam's performance on Crude Oil. The optimized values are a 2-ATR
initial protective stop, a 3-bar ATR length, a 10-bar ADX length, an ADX level of 20, 3 consecutive
down — closes, 4 consecutive up-closes, a long-exit length of 3 bars and a short-exit length of 2 bars.
Our system earned $7,570 on 19 trades, for an average trade of $398 [Figure 6; System Report] 63% of
the trades were profitable, and the ratio of average win to average loss was 5.18 to 1. These are excellent
results! Better than 6 trades out of 10 were profitable, and the average win was more than 5 times as
large as the average loss. The Profit Factor (dollars won per dollar lost) was also outstanding at 8.89.
Figure 7, the Equity Curve, shows that Traffic Jam had made only about $1,000 through trade 9, but that
it came to life and captured profits of almost $8,000 by trade 19 [Figure 7; Equity Curve graph].
Figure 6 - System Report
112
Suggestions For Improvement
Omega Research System Trading and Development Club - Volume 9
Figure 7 - Equity Curve graph
Suggestions For Improvement
Most of our STAD Club systems include both a setup and a separate entry. For example, a system's
setup could be a close above a 20-bar moving average. The actual entry could be to buy at the high of
the setup bar + 5 points. Entries can reduce the number of "whipsaw" losses by requiring the market
to be heading in the right direction at the time a new trade is initiated. In Traffic Jam, we didn't
specify an entry condition separate from the setup; instead, we just entered the market on the close of
the bar that completed the setup. You can probably improve this system's performance by adding
your own entry requirement to our setup.
CHAPTER 10
RadarScreen™ 2000i Indicator
by Gaston Sanchez
S
canning the market has changed drastically with the emergence of RadarScreen 2000i.
You can now be aware of how the market is changing with regard to your criteria quickly
and easily. RadarScreen 2000i is designed to help you answer the question "What to buy?".
In this chapter, the focus is a RadarScreen 2000i Indicator called STAD9_MarketScanner. This
Indicator is specifically designed to be used with RadarScreen 2000i. The Indicator can instantly
show us what symbols are meeting the established criteria. The criteria are as follows:
• The Fast Moving Average must have crossed above the Slow Moving Average within a
specific number of periods.
• The Volume must be greater than the average Volume by a specified factor.
• The most recent bar must be a Range Leader Plus bar. The Range Leader Plus is defined as
a bar with its midpoint above the previous bar's High, its True Range greater than the
previous bar's True Range, and its Close above its midpoint.
Depending on which criteria are actually TRUE, the return of the Indicator will vary. The
Indicator returns text values for each cell. The text is used to indicate how many of the three
criteria were met and which of the three criteria were met. For example, if two of the above
criteria were met, you might see the following:
where
(2T) is the number of criteria that were TRUE.
(1-2-0) refers specifically to which of the criteria were TRUE.
Thus, in the example above, two of the three criteria were actually TRUE. Specifically, criteria
'1' and '2' were met, but number '3' was not, so a zero was returned in its place.
114
Omega Research System Trading and Development Club - Volume 9
Now, aside from just a text representation of the results, SmartStyling (another new feature from
Omega Research) is used to further differentiate the different levels. For example, if one of the three
criteria is met, the cell background color will be 'Blue'. If two of the criteria are met, the background
color will be 'Cyan', and if all three criteria are met, the background color will be 'Green'.
Incidentally, if none of the criteria are met, the cell background color will be set to 'White'.
RadarScreen 2000i SmartStyling™
Let's take a look at the EasyLanguage used to create the Indicator, then I'll break it down into its
individual components:
EasyLanguage: STAD9_MarketScanner
Inputs: FastLength(9), SlowLength(18), Period(5), VolumeFactor(2);
Variables: Counter(0), Monitor("");
Counter = 0;
Monitor = "";
{Criteria Definition}
Condition1 = MRO(Average(Close, FastLength) Crosses Above Average(Close, SlowLength),
Period, 1) <> -1;
Condition2 = Volume >= Average(Volume, SlowLength) * MaxList(VolumeFactor, 1);
Condition3 = MedianPrice > High[1] AND TrueRange > TrueRange[1] AND Close > MedianPrice;
{Criteria Evaluation}
If Condition1 Then Begin
Counter = Counter + 1;
Monitor = Monitor + "1-";
End
Else
Monitor = Monitor + "0-";
115
Chapter 10 RadarScreen 2000i Indicator
If Condition2 Then
Counter =
Monitor =
End
Else
Monitor =
Begin
Counter + 1;
Monitor + "2-";
Monitor + "0-";
If Condition3 Then Begin
Counter = Counter + 1;
Monitor = Monitor + "3";
End
Else
Monitor = Monitor + "0";
{Plot statements using SmartStyling}
If Counter = 0 Then
Plot1(Monitor, "Scanner", default, White);
If Counter = 1 Then
Plot1("1T - " + Monitor, "Scanner", default, Blue);
If Counter = 2 Then
Plot1("2T - " + Monitor, "Scanner", default, Cyan);
If Counter = 3 Then Begin
Plot1("3T - " + Monitor, "Scanner", default, Green);
Alert("All 3 MarketScanner criteria are TRUE");
End;
Now let's break the Indicator down:
Indicator Inputs (MarketScanner)
INPUT
FastLength
DEFAULT
9
SlowLength
18
Period
5
VolumeFactor
2
DESCRIPTION
Number of periods used in the calculation of the
Fast (short term) Moving Average.
Number of periods used in the calculation of the
Slow (long term) Moving Average
Number of periods for which a Moving Average
crossover is valid
A multiple of the Volume (has a min. value of)
Indicator Variables (MarketScanner)
VARIABLE
Counter
DEFAULT
0
Monitor
""
DESCRIPTION
[Numeric] Holds the accumulation which indicates
how many of the criteria were TRUE
[String] Holds the string value that will appear in the cell
116
Omega Research System Trading and Development Club - Volume 9
First, we need to make certain that the two Variables that keep track of the criteria and the string are
reset at the beginning of each period:
Counter = 0;
Monitor = "";
Each of the criteria is defined and assigned to one of the built-in Conditional Variables. For
'Condition1', we use the MRO (Most Recent Occurrence) Function to determine if the Fast Average
has crossed above the Slow Average within the specified period of bars. For 'Condition2' the Volume
is compared to the Average Volume multiplied by the 'VolumeFactor'. Finally, for 'Condition3', we
make three comparisons to identify a Range Leader Plus bar. The median price (Midpoint) is
compared to the High of the previous period, the True Range is compared to the True Range of the
previous period, and the Close is compared to the current median price.
Condition1 = MRO(Average(Close, FastLength) Crosses Above Average(Close, SlowLength),
Period, 1) <> -1;
Condition2 = Volume >= Average(Volume, SlowLength) * MaxList(VolumeFactor, 1);
Condition3 = MedianPrice > High[1] AND TrueRange > TrueRange[1] AND Close > MedianPrice;
Once we have defined and assigned our criteria, we then need to evaluate each one in order to
determine which are actually TRUE. Each of the Conditional Variables is evaluated. If the
represented criterion is TRUE, then the 'Counter' is incremented by one, and a text value which
represents that criterion is added to the string 'Monitor'. If the criterion is FALSE, a zero is added to
the string 'Monitor', indicating that that particular criterion was not met. This is done for each
conditional variable; Condition1, Condition2, Condition3.
If Condition1 Then Begin
Counter = Counter + 1;
Monitor = Monitor + "1-";
End
Else
Monitor = Monitor + "0-";
If Condition2 Then
Counter =
Monitor =
End
Else
Monitor =
Begin
Counter + 1;
Monitor + "2-";
Monitor + "0-";
If Condition3 Then Begin
Counter = Counter + 1;
Monitor = Monitor + "3";
End
Else
Monitor = Monitor + "0";
Chapter 10 RadarScreen 2000i Indicator
117
Finally we are ready to plot the results. You will notice that there are actually four plot statements, but
they all use 'Plot1'. The reason is that only one of these plot statements will be used per period. The
specific plot statement that is chosen depends directly upon the number of criteria that were met. If
the 'Counter' is equal to '3', indicating that all three criteria are TRUE, an Alert is included after the
plot statement to call attention to the event.
If Counter = 0 Then
Plot1(Monitor, "Scanner", default, White);
If Counter = 1 Then
Plot1("1T - " + Monitor, "Scanner", default, Blue);
If Counter = 2 Then
Plot1("2T - " + Monitor, "Scanner", default, Cyan);
If Counter = 3 Then Begin
Plot1("3T - " + Monitor, "Scanner", default, Green);
Alert("All 3 MarketScanner criteria are TRUE");
End;
You'll notice that the plot statements in the EasyLanguage are probably longer than you may be used
to. The above plot statements contain the additional parameters necessary for SmartStyling. Each
parameter for the plot statements above is described in the example below:
Plot1("1T - " + Monitor, "Scanner", default, Blue);
Where:
("1T - " + Monitor) is the value that is plotted
("Scanner") is the name of the plot
(default) refers to the foreground color. By specifying 'default', we are relegating the text
color to the default grid text color
(Blue) refers to the background color.
This Indicator should prove to be a useful tool in identifying "What to trade", based on the specified
criteria. As you begin to use the Indicator in your analysis, you may find that the addition or
replacement of certain criteria elements may help the Indicator to become better aligned with your
own trading strategy.
About the author
Gaston Sanchez, who designed this indicator and wrote this chapter, is a member of Omega
Research’s Product Management Team.
APPENDIX A:
Common Exits
T
his section defines and explains the stops that are used more than once in the systems presented in this issue. We hope that you will find this single reference chapter to be more
convenient than repeated descriptions of each stop throughout the volume.
EasyLanguage Signal: ATR Protective Stop:
Applicable Systems in this issue:
• STAD9: Traffic Jam
• STAD9: Swinger
• STAD9: Skinny Dipper
• STAD9: OBV Revisited
• STAD9: No Hurry
Signal EasyLanguage:
Inputs: ProtectiveATRs(3), ATRLength(10);
Variable: ATRVal(0);
ATRVal = AvgTrueRange(ATRLength) * ProtectiveATRs;
If MarketPosition = 1 Then
ExitLong Next Bar at EntryPrice - ATRVal Stop;
If MarketPosition = -1 Then
ExitShort Next Bar at EntryPrice + ATRVal Stop;
120
Omega Research System Trading and Development Club - Volume 9
Signal Inputs (ATR Protective Stop):
INPUT
DEFAULT
ProtectiveATRs 3
ATRLength
10
DESCRIPTION
The number of Average True Ranges that are risked in
the position
Length, expressed in bars, used to calculate the
Average True Range
Signal Variables (ATR Protective Stop):
VARIABLE
ATRVal
DEFAULT
0
DESCRIPTION
[Numeric] Holds the value of the Average True Range,
multiplied by the ProtectiveATRs
Setup
In the Setup portion of the signal, the Average True Range is calculated and multiplied by the number
of ProtectiveATRs specified in the Inputs.
ATRVal = AvgTrueRange(ATRLength) * ProtectiveATRs;
Long Exit
When the market position is Long, a Long Exit is placed at the entry price minus the Protective
Volatility Average True Range calculation (ATRVal).
If MarketPosition = 1 Then
ExitLong Next Bar at EntryPrice - ATRVal Stop;
Short Exit
When the market position is Short, a Short Exit is placed at the entry price plus the Protective
Volatility Average True Range calculation (ATRVal).
If MarketPosition = -1 Then
ExitShort Next Bar at EntryPrice + ATRVal Stop;
EasyLanguage Signal: ATR Trailing Stop:
Applicable Systems in this issue:
• STAD9: OBV Revisited
• STAD9: No Hurry
121
Appendix A: Common Exits
Signal EasyLangauge:
Inputs: TrailingATRs(4), ATRLength(10);
Variables: PosHigh(0), PosLow(0), ATRVal(0);
ATRVal = AvgTrueRange(ATRLength) * TrailingATRs;
If MarketPosition = 1 Then Begin
If BarsSinceEntry = 0 Then
PosHigh = High;
If High > PosHigh Then
PosHigh = High;
ExitLong Next Bar at PosHigh - ATRVal Stop;
End;
If MarketPosition = -1 Then Begin
If BarsSinceEntry = 0 Then
PosLow = Low;
If Low < PosLow Then
PosLow = Low;
ExitShort Next Bar at PosLow + ATRVal Stop;
End;
Signal Inputs (ATR Trailing Stop)
INPUT
TrailingATRs
DEFAULT
4
ATRLength
10
DESCRIPTION
The number of Average True Ranges that are risked
from the highest/lowest price of the position
Length, expressed in bars, used to calculate the
Average True Range
Signal Variables (ATR Trailing Stop)
VARIABLE
PosHigh
PosLow
ATRVal
DEFAULT
0
0
0
DESCRIPTION
[Numeric] Holds the value of the position High
[Numeric] Holds the value of the position Low
[Numeric] Holds the value of the Average True Range
multiplied by the number of TrailingATRs
122
Omega Research System Trading and Development Club - Volume 9
Setup
In the Setup portion of the signal, the Average True Range is calculated and multiplied by the number
of TrailingATRs specified in the Inputs.
ATRVal = AvgTrueRange(ATRLength) * TrailingATRs;
Long Exit
When the market position is Long, the Long Exit becomes active. The PosHigh variable is used to
keep track of the highest High of the position. The trailing Stop is placed at the PosHigh value minus
the Trailing ATR calculation.
If MarketPosition = 1 Then Begin
If BarsSinceEntry = 0 Then
PosHigh = High;
If High > PosHigh Then
PosHigh = High;
ExitLong Next Bar at PosHigh - ATRVal Stop;
End;
Short Exit
When the market position is Short, the Short Exit becomes active. The PosLow variable is used to
keep track of the lowest Low of the position. The trailing Stop is placed at the PosLow value plus the
Trailing ATR calculation.
If MarketPosition = -1 Then Begin
If BarsSinceEntry = 0 Then
PosLow = Low;
If Low < PosLow Then
PosLow = Low;
ExitShort Next Bar at PosLow + ATRVal Stop;
End;
EasyLanguage Signal: ATR Breakeven Stop:
Applicable Systems in this issue:
• STAD9: Skinny Dipper
• STAD9: OBV Revisited
• STAD9: No Hurry
123
Appendix A: Common Exits
Signal EasyLanguage:
Inputs: ATRs(4), ATRLength(10);
Variable: ATRVal(0), PosHL(0);
ATRVal = AvgTrueRange(ATRLength) * ATRs;
If BarsSinceEntry = 0 Then
PosHL = Close;
If MarketPosition = 1 Then Begin
If Close > PosHL Then
PosHL = Close;
If PosHL > EntryPrice + ATRVal Then
ExitLong ("1L") Next Bar at EntryPrice Stop;
End;
If MarketPosition = -1 Then Begin
If Close < PosHL Then
PosHL = Close;
If PosHL < EntryPrice - ATRVal Then
ExitShort ("1S") Next Bar at EntryPrice Stop;
End;
Signal Inputs (ATR Breakeven Stop)
INPUT
ATRs
DEFAULT
4
ATRLength
10
DESCRIPTION
The Floor value, the number of Average True Ranges
above the Entry Price at which the Stop becomes
active for the position
Length, expressed in bars, used to calculate the
Average True Range
Signal Variables (ATR Breakeven Stop)
VARIABLE
ATRVal
DEFAULT
0
PosHL
0
DESCRIPTION
[Numeric] Holds the value of the Average True Range
multiplied by the number of TrailingATRs
[Numeric] Holds the value of the highest/lowest
Close of the position
124
Omega Research System Trading and Development Club - Volume 9
Setup
In the Setup portion of the signal, the Average True Range is calculated and multiplied by the number
of 'ATRs' specified in the Inputs.
ATRVal = AvgTrueRange(ATRLength) * ATRs;
On the first bar of the position, when the 'BarsSinceEntry' is equal to 0, the 'PosHL' variable is
assigned the Close value. This resets the tracking of the position highest/lowest Close of the position,
based on the direction of the position.
If BarsSinceEntry = 0 Then
PosHL = Close;
Long Exit
Once a Long position is taken, we must evaluate the highest closing price of the position and the
Floor value established by the Average True Range. First, a comparison between the Close and the
'PosHL' Variable is made. During a Long position the 'PosHL' variable represents the highest Close
of the position. Thus, if the Close is greater than the 'PosHL' value, the Close value is assigned to the
'PosHL' variable as the new highest Close. Next, If the highest Close of the position (PosHL) exceeds
the sum of the 'EntryPrice' and the specified Average True Range (the Floor value), a Long Exit Stop
order is placed at the entry price (breakeven price).
If MarketPosition = 1 Then Begin
If Close > PosHL Then
PosHL = Close;
If PosHL > EntryPrice + ATRVal Then
ExitLong ("1L") Next Bar at EntryPrice Stop;
End;
Short Exit
Once a Short position is taken, we must evaluate the lowest closing price of the position and the Floor
value established by the Average True Range. First, a comparison between the Close and the 'PosHL'
Variable is made. During a Short position the 'PosHL' variable represents the lowest Close of the
position. Thus, if the Close is less than the 'PosHL' value, the Close value is assigned to the 'PosHL'
variable as the new lowest Close. Next, If the lowest Close of the position (PosHL) falls below the
difference between the 'EntryPrice' and the specified Average True Range (the Floor value), a Short
Exit Stop order is placed at the entry price (breakeven price).
If MarketPosition = -1 Then Begin
If Close < PosHL Then
PosHL = Close;
If PosHL < EntryPrice - ATRVal Then
ExitShort ("1S") Next Bar at EntryPrice Stop;
End;
125
Appendix A: Common Exits
EasyLanguage Signal: ATR Profit Target:
Applicable Systems in this issue:
• STAD9: Skinny Dipper
• STAD9: Red Rover
Signal EasyLanguage:
Inputs: ATRs(4), ATRLength(10);
Variable: ATRVal(0), EntryATR(0);
ATRVal = AvgTrueRange(ATRLength) * ATRs;
If BarsSinceEntry = 0 Then
EntryATR = ATRVal;
If MarketPosition = 1 Then
ExitLong ("2L") Next Bar at EntryPrice + EntryATR Limit;
If MarketPosition = -1 Then
ExitShort ("2S") Next Bar at EntryPrice - EntryATR Limit;
If LastBarOnChart Then Begin
value1 = ShowLongStop(EntryPrice + EntryATR);
value1 = ShowShortStop(EntryPrice - EntryATR);
End;
Signal Inputs (ATR Profit Target)
INPUT
ATRs
DEFAULT
4
ATRLength
10
DESCRIPTION
The number of Average True Ranges specified as
the profit target above/below the entry price
Length, expressed in bars, used to calculate the
Average True Range
Signal Variables (ATR Profit Target)
VARIABLE
ATRVal
DEFAULT
0
EntryATR
0
DESCRIPTION
[Numeric] Holds the value of the Average True Range
multiplied by the number of TrailingATRs
[Numeric] Holds the value of the Average True Range
on the first bar of the position
126
Omega Research System Trading and Development Club - Volume 9
Setup
In the Setup portion of the signal, the Average True Range is calculated and multiplied by the number
of 'ATRs' specified for the profit target.
ATRVal = AvgTrueRange(ATRLength) * ATRs;
On the bar of entry for the position, profit target or 'ATRVal' is assigned to the Variable 'EntryATR'.
This variable will be used to establish a constant profit target value, based on the entry price, for that
position.
If BarsSinceEntry = 0 Then
EntryATR = ATRVal;
Long Exit
When the market position is Long, a Long Exit Limit order is placed at the profit target value, the
sum of the entry price and the Average True Range calculation on the bar of entry. Notice that since
this is a profit target exit we are using a Limit order. The Limit order will place an order at a
specified price or higher.
If MarketPosition = 1 Then
ExitLong ("2L") Next Bar at EntryPrice + EntryATR Limit;
Short Exit
When the market position is Short, a Short Exit Limit order is placed at the profit target value, the
difference between the entry price and the Average True Range calculation on the bar of entry. Notice
that since this is a profit target exit we are using a Limit order. The Limit order will place an order at
a specified price or lower.
If MarketPosition = -1 Then
ExitShort ("2S") Next Bar at EntryPrice - EntryATR Limit;
Additional Parameters
This next section of EasyLanguage utilizes the Functions 'ShowLongStop' and 'ShowShortStop' to
place text on the chart, which indicates where the profit target Exit price is located.
If LastBarOnChart Then Begin
value1 = ShowLongStop(EntryPrice + EntryATR);
value1 = ShowShortStop(EntryPrice - EntryATR);
End;
APPENDIX B
Volume in Review
W
e received a question about the Ryan’s Hope system in volume 8. You may recall that
the pullback (in the case of an uptrend) was defined by a close below the close n-bars
ago. Also, to determine if the trend was still intact, the close was compared to the close
a calculated number of bars in the past. Here’s the question:
What if the close n-bars ago was on a spike bar? Maybe we want to average a set of bars
instead. Also, to determine that the trend has not changed because of the pullback, I don’t
think that I should be basing the answer on a particular bar because of spikes.
It certainly might be worthwhile to test the system with a pullback below an average of closes
(in the case of an uptrend) rather than below the close a specified number of bars in the past.
There are, of course, many ways to define a retracement. Another example would be an RSI or
Stochastic declining from above 75 to below 50. If a spike bar doesn’t offer us an entry setup,
keep in mind that we’re referencing the spike bar for one bar only. Perhaps the next bar (or the
bar after that) will identify a retracement.
Regarding our idea to determine the trend by comparing the current close to the close a specified
number of bars in the past, that’s exactly what a Simple Moving Average (SMA) does. If the
current close is greater than the close of 25 bars ago, the SMA will be rising; if the current close
is less than the close of 25 bars ago, the SMA will be falling. Of course, just as there are many
ways to identify a retracement, there are lots of ways to determine the trend. The slope of the
SMA is one example. Another way that we like to define the current trend is by the market’s
most recent breakout to a new n-bar high or breakdown to a new n-bar low. The trend is bullish
if the breakout occurred more recently and bearish if the breakdown occurred more recently.
Thanks for your questions and suggestions!
128
INDEX
Omega Research System Trading and Development Club - Volume 9
INDEX
A
Additional Educational Services .............................................6
EasyLanguage Resource Center..............................................6
Workshops ...............................................................................6
Appendix A .........................................................................119
ATR Breakeven Stop...........................................................122
ATR Profit Target ................................................................125
ATR Protective Stop............................................................119
ATR Trailing Stop ...............................................................120
B
Benefits of Systems Trading ...................................................8
C
Common Exits.....................................................................119
Contents at a Glance ...............................................................6
D
Displaced Moving Averages .................................................11
Double Your Fun System ......................................................11
N
No Hurry System ..................................................................39
O
Obtaining Technical Support...................................................7
EasyLanguage Support Department .................................... 7
STAD Club E-Mail Address ...................................................8
OBV Revisited ......................................................................49
Oscillator ...............................................................................91
P
Price Oscillator......................................................................95
Pyramiding ............................................................................29
R
RadarScreen Indicator .........................................................113
Red Rover System.................................................................62
Resistance................................................................................6
S
EasyLanguage Resource Center..............................................6
EasyLanguage Support Department........................................7
Exits.....................................................................................119
Skinny Dipper System ..........................................................71
STAD Club E-mail Address....................................................8
Stops ....................................................................................119
Support ..................................................................................61
Swinger System.....................................................................91
G
T
E
Getting Ideas for Systems .......................................................8
Getting Started ........................................................................6
I
Importing your work from older versions...............................7
Index....................................................................................128
International Index Composite System .................................81
Introduction .............................................................................5
L
Luxor System ........................................................................30
M
MarketScanner.....................................................................114
Momentum ............................................................................91
Ten-Step Plan for Building a Trading System ........................9
Traffic Jam System..............................................................103
Triangular Moving Averages.................................................11
V
Volume in Review ...............................................................127
W
Weighted On-Balance Volume ..............................................49
Workshops ...............................................................................6
Download