100% found this document useful (1 vote)
363 views95 pages

Stad04 PDF

Uploaded by

Yuanxing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
363 views95 pages

Stad04 PDF

Uploaded by

Yuanxing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 95

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, WELL-KNOWN
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 © 1998 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 and ShowMe 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.
)UTZKTZY

/4:85*;):/54ú ìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì é
)UTZKTZYúGZúGú-RGTIKìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì è
'JJOZOUTGRú+J[IGZOUTGRú9KX\OIKYúìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì è
Workshops ............................................................................................................................................... 2
EasyLanguage Resource Center .............................................................................................................. 2
-GZZOTMú9ZGXZKJ ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì è
5HZGOTOTMú:KINTOIGRú9[VVUXZ ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì úç
EasyLanguage Support Department ........................................................................................................ 4
STAD Club E-Mail Address ................................................................................................................... 4

).'6:+8úé ú-KTKXGRú9_YZKSú*K\KRUVSKTZú)UTIKVZYú ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì å


=NGZú/Yú5VZOSO`GZOUT%úììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì ä
=NGZú)GTú(Kú5VZOSO`KJ%úìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì ä
*KZKXSOTOTMúZNKú4[SHKXúULú:KYZYúìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì â
)NUUYOTMúZNKú)XOZKXOGúLUXú(KYZú8KY[RZú ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì â
'\UOJOTMúZNKú5\KXí5VZOSO`GZOUTú:XGVúìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì â

).'6:+8úè ú:XKTJOTMú9_YZKSYú ìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì éé


*OXKIZOUTGRú3U\KSKTZú/TJK^ú9_YZKSú ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì éè
Defining your Trading Rules ................................................................................................................ 13
Designing & Formatting ....................................................................................................................... 13
Testing & Improving ............................................................................................................................. 17
1KRZTKXú)NGTTKRú9_YZKSú ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì éá
Defining your Trading Rules ................................................................................................................ 20
Designing & Formatting ....................................................................................................................... 21
Testing & Improving ............................................................................................................................. 24
2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKSúìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì èå
Defining your Trading Rules ................................................................................................................ 27
OOúúúúúúúúúú)UTZKTZY

Designing & Formatting ...............................................................................................................................28


Testing & Improving ....................................................................................................................................32
.KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú9_YZKSú ìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììçè
Defining your Trading Rules ........................................................................................................................33
Designing & Formatting ...............................................................................................................................34
Testing & Improving ....................................................................................................................................37
)UTYKI[ZO\Kú)RUYKú9_YZKSú ìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììçá
Defining your Trading Rules ........................................................................................................................41
Designing & Formatting ...............................................................................................................................41
Testing & Improving ....................................................................................................................................44
:NKú3USKTZ[Sí8KZXGIKSKTZú9_YZKSúììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììæä
Defining your Trading Rules ........................................................................................................................48
Designing & Formatting ...............................................................................................................................50
Testing & Improving ....................................................................................................................................55
:NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKú)XUYYU\KXú9_YZKSúìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììåä
Defining your Trading Rules ........................................................................................................................57
Designing & Formatting ...............................................................................................................................57
Testing & Improving ....................................................................................................................................60
/T\KYZOTMúGú,O^KJú*URRGXú'SU[TZú ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììäè

).'6:+8úç ú9[VVUXZúôú8KYOYZGTIKú9_YZKSYúììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì äç
9VXKGJú9_YZKS ú(KZGú;Vú ìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììäæ
Defining your Trading Rules ........................................................................................................................64
Designing & Formatting ...............................................................................................................................65
Testing & Improving ....................................................................................................................................67
9VXKGJú9_YZKS ú(KZGú*U]Tú ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììäã
Defining your Trading Rules ........................................................................................................................68
Designing & Formatting ...............................................................................................................................69
Testing & Improving ....................................................................................................................................71

).'6:+8úæ ú<URGZOROZ_ú(XKGQU[Zú9_YZKSYìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì ãå
*OYVRGIKJú3U\OTMú'\KXGMKúôú<UR[SKú9_YZKSú ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììãä
Defining your Trading Rules ........................................................................................................................77
Designing & Formatting ...............................................................................................................................77
Testing & Improving ....................................................................................................................................80
6XOIKú*OYZXOH[ZOUTú9_YZKSú ìììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììâé
Defining your Trading Rules ........................................................................................................................83
Designing & Formatting ...............................................................................................................................84
Testing & Improving ....................................................................................................................................86
'JJOZOUTGRú,UXS[RGYú ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììâã

/4*+>ú ììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììììì áé
INTRODUCTION

=KRIUSKúZUú<UR[SKúæ
Welcome to Volume 4 of the Omega Research System Trading and
Development Club, the revolutionary learning tool offered by Omega
Research to help you make the most of your trading potential.
This fourth volume of the Omega Research System Trading and Development
Club contains 10 new systems we’ve created to help you get started
developing your own systems.
In this volume, Appendix A, “Volume in Review,” discusses the results of
the recent survey you completed. We were very pleased by the
overwhelming response we received to the survey and you will start to see
the changes based on your suggestions in Volume 5. Thank you for your
feedback!
The systems in Volume 4 incorporate popular concepts such as exponential
moving averages, momentum retracement, price distribution, and more. We
identify the most common problems with these types of systems and provide
techniques to overcome them as well as present different ways of using
them. By reviewing and testing these 10 systems, you’ll be able to
understand these techniques and use them, or a variation of them, in your
own systems.
This book walks you step-by-step through the process we went through to
develop these systems, from coming up with a feasible trading idea, to
writing down your trading rules, to writing them in EasyLanguage, to taking
into consideration money management and risk control factors. Our goal is
for you to understand why we wrote these systems the way we did.
èúúúúúúúúúúúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

We recommend you study the EasyLanguage techniques we used, look at the System Report,
read about the factors we took into account to deem that a system may have merit, and think
about how you can combine some of these popular ideas with your own to develop a system
you want to trade.
IMPORTANT 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, well-known trading strategies
may be incorporated into personal trading systems.

)UTZKTZYúGZúGú-RGTIK
This book begins by discussing some of the broader concepts of system development before moving on
to the description of each system. We grouped the different types of systems together. The contents are:
„ Chapter 1: General System Development Concepts
„ Chapter 2: Trending Systems
„ Chapter 3: Support & Resistance Systems
„ Chapter 4: Volatility Breakout Systems
„ Index
IMPORTANT NOTE: We suggest you read the book from front to back because there is instructional
material in each section and it is not repeated throughout.

'JJOZOUTGRú+J[IGZOUTGRú9KX\OIKY
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-551-9991) and ask about the
following educational services:

=UXQYNUVY
Omega Research offers a variety of workshops on the 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!

+GY_2GTM[GMKú8KYU[XIKú)KTZKX
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.
/TZXUJ[IZOUT úúúúúúúúúúç

-KZZOTMú9ZGXZKJ
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 95, click Start, choose Programs, choose Omega
Research and choose TradeStation PowerEditor. In Windows 3.x, choose TradeStation
PowerEditor from the Omega Research program group.
3. In the PowerEditor, use the File - Open menu sequence.
4. Click Transfer.
5. Select the Transfer analysis techniques FROM EasyLanguage Archive File option and
click OK.
6. Click Scan.
7. In the Enter drive letter to scan edit box, enter the drive letter for your CD-ROM drive
(normally D), and click OK. The ELA file on the CD is placed in the list.
8. Choose JULAUG98.ELA from the list and click OK.
9. In the Transfer dialog box, select Transfer All and click OK.
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 STAD4. 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 4 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 4. 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.

5HZGOTOTMú:KINTOIGRú9[VVUXZ
Depending on your question, there are two resources at your disposal: the EasyLanguage Support
Department and the STAD Club E-Mail Address.
æúúúúúúúúúúúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

+GY_2GTM[GMKú9[VVUXZú*KVGXZSKTZ
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) 221-6831

E-Mail Address:
easylang@omegaresearch.com
Be sure to include the following information in your fax:
„ 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.

9:'*ú)R[Hú+í3GORú'JJXKYY
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 each subsequent volume we will publish the most common suggestions and
questions.
CHAPTER 1

-KTKXGRú9_YZKSú*K\KRUVSKTZú)UTIKVZY
Optimization and its value is a source of continuing debate. Those against
optimization argue that the process is really fitting the system to the sample data
and therefore a useless process that simply gives you the best system for the
specific sample of data.
The other side of the argument; however, contends that while there is a risk in the
process of optimization, the process itself is valuable when performed properly and
with its purpose and limitations kept clearly in mind.
We believe that optimization, used correctly, is an integral part of system
development; however, the risks of over-optimization are real and care must be
taken to maximize the usefulness of optimization while minimizing the risks.
This chapter discusses optimization, highlights the risks and signs of over-
optimization, and should help you use this technique effectively.

/Tú:NOYú)NGVZKX

„ What is Optimization? .......................6 „ Choosing the Criteria for


Best Result......................................... 8
„ What Can Be Optimized? .................6
„ Avoiding the Over-optimization
„ Determining the Number of Tests .....8
Trap ................................................... 8
äúúúúúúúúúú=NGZú/Yú5VZOSO`GZOUT%úúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

=NGZú/Yú5VZOSO`GZOUT%
Optimization is the process of testing different inputs and stops to fine-tune a trading system.
You use historical data to test the effects of slight changes in your system’s criteria.
When you optimize a system, TradeStation runs a series of tests based on different values for
system inputs and/or stops and then automatically picks the parameters that yielded the best
results according to the criteria you specify.
When you optimize a system, you are not limited to optimizing based on the best net profit. You
can optimize for return on account, overall drawdown, or on any of the fields in the System
Report, as discussed in the section titled, “Choosing the Criteria for Best Result.”

=NGZú)GTú(Kú5VZOSO`KJ%
As described next, the two elements of a trading system that can be optimized are simple
numeric inputs and stops.

9OSVRKú4[SKXOIú/TV[ZY
For examples of simple numeric inputs, take a look at the MovAvg (3) Crossover system, one
of TradeStation’s built-in systems. This system uses the inputs Length1, Length2, and Length3.
The input Length1 refers to the number of bars used to calculate the fastest moving average,
Length2 the second fastest moving average, and Length3 the third fastest moving average.
TradeStation’s default values for this system are 4, 9, and 18, respectively, which when we
tested it on a daily IBM chart generated a net profit of $2,688.10. Figure 1 shows the resulting
System Report:

,OM[XKúéìú9GSVRKú9_YZKSú8KVUXZúUTú3U\'\Múòçñú)XUYYU\KXú9_YZKSúHKLUXKúUVZOSO`GZOUT

However, you may want to test various combinations of input values for the MovAvg (3)
Crossover System. For example, for Length1 you could test the values from 2 to 6, for Length2
the values from 6 to 12, and for Length3 the values from 14 to 22, all in increments of one.
)NGVZKXúéúúúúúú-KTKXGRú9_YZKSú*K\KRUVSKTZú)UTIKVZY =NGZú)GTú(Kú5VZOSO`KJ%úúúúúúúúúúã

Figure 2 shows a sample Optimization Report for such a test. For this test, we optimized for net
profit. In other words, we wanted to find which lengths result in the highest net profit. In this
case, the lengths 4, 10 and 14 were the most profitable, as is indicated by the asterisk next to
the test number. Notice the net profit rose to $7,100.10.

,OM[XKúèìú5VZOSO`GZOUTú8KVUXZúLUXúZNKú3U\'\Múòçñú)XUYYU\KXú9_YZKS!úZNKúZNXKKúSU\OTMúG\KXGMKúRKTMZNYú]KXKúUVZOSO`KJ

Figure 3 shows the improved System Report generated by the optimized system.

,OM[XKúçìú8KY[RZOTMú9_YZKSú8KVUXZúMKTKXGZKJúH_úUVZOSO`KJúY_YZKS
âúúúúúúúúúú*KZKXSOTOTMúZNKú4[SHKXúULú:KYZYúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

9ZUVY
Stops enable you to set a specific dollar amount or percentage of open profits that you are
willing to risk before a trade is automatically closed out. The types of stops that can be
optimized in TradeStation include money management stops, $ risk trailing stops, breakeven
stops, and % risk trailing stops.
Although profit targets are not a type of stop, they are included in the same dialog as stops
because profit targets and stops can be optimized in exactly the same way.

*KZKXSOTOTMúZNKú4[SHKXúULú:KYZY
The range of values you specify for inputs and stops when you optimize a trading system
determines the number of tests TradeStation will perform. The more values for inputs or stops
that are optimized, the more tests must be run.
For example, if you want to optimize only one input for the system you are testing, and six
different values are to be used for that input, TradeStation will perform six tests (1 x 6 = 6). If
you optimize two inputs, and you decide to test six different values for each input, the number
of tests increases exponentially to 36 (6 x 6 = 36). Each possible combination is tested to
determine which performs best. If, in addition to the two inputs, you also included a money
management stop with six different values, the number of tests would climb to 216 (6 x 6 x 6).
Depending on the number of tests you run, an optimization can take seconds, minutes, or even
hours. You can cut down the time required for testing by either reducing the number of values
being tested for each input or stop, or reducing the number of inputs or stops being optimized.
For example, if you are optimizing a system with three unrelated entry signals, you should
optimize the inputs for each entry signal separately. If the inputs are related (so that it’s not
logical to optimize them separately), you can increase the size of the increment to reduce the
number of tests. For example, you might decide to test the input values 10, 20, 30, and 40 rather
than all the values between 10 and 40. Then, when you determine the range of input values that
performs best, you can re-optimize using this reduced range and a smaller increment.

)NUUYOTMúZNKú)XOZKXOGúLUXú(KYZú8KY[RZ
TradeStation enables you to choose the criterion for the best result when you optimize a trading
system. The default criterion for the best result of a system optimization is the value or
combination of values that produces the highest total net profit. However, the value that
produces the highest net profit is not always the best result. Would the value that yielded the
highest net profit but also produced the largest drawdown and the smallest winning percentage
necessarily be the best choice?
TradeStation offers more than 60 criteria for you to choose from for determining the best result
of an optimization. For example, instead of total net profit, you could select Average trade
(Wins + Losses), Percent profitable, or Profit factor (how many dollars won for each dollar
lost). The criteria for best result are calculated for three categories: All, Long, and Short. You
can, for example, optimize for Total net profit in long positions only, Ratio of average win to
average loss in short positions only, or Profit factor in both long and short positions. (The
criteria within each category are identical.)

'\UOJOTMúZNKú5\KXí5VZOSO`GZOUTú:XGV
If you over-optimize your trading system’s inputs or stops, you run the risk of curve-fitting the
parameters to the data you used to test your system. Since it is highly unlikely that a lengthy
series of price fluctuations will repeat itself exactly in the future, you must avoid the trap of
over-optimization. Following are some suggestions for constructive optimization as opposed to
curve-fitting optimization:
)NGVZKXúéúúúúúú-KTKXGRú9_YZKSú*K\KRUVSKTZú)UTIKVZY '\UOJOTMúZNKú5\KXí5VZOSO`GZOUTú:XGVúúúúúúúúúúá

1. Do not rely on optimization to create a trading system. Optimization should be one


of the last steps you take when you are developing a system. It is not time to
optimize a trading system until the system is already profitable as it stands.
2. Develop a trading system that is based on a logical trading idea. Avoid trading
systems that yield good optimized results but that are not based on a sound market
theory.
3. Keep your trading systems as simple as possible. The markets don’t pay you any
extra for designing and trading a more complex system.
4. Test your trading idea on several stocks and/or commodities. If your test results
are poor on other markets, the system is probably curve-fitted to one set of data.
5. The best value discovered by optimization should have a range of profitable values
around it. For example, if a system’s optimum moving average value is 20, values
on either side of it (e.g. 18, 19, 21, and 22) should also produce good results.
6. Include both backward and forward testing in your system evaluation. The optimal
parameters you discovered when testing one set of data should also be profitable
on both earlier and later data.
If you optimize your trading systems with these suggestions in mind, you’ll be well on your way
to effective, meaningful optimization, and you’ll avoid ineffective, curve-fitted optimization.
éêúúúúúúúúúú'\UOJOTMúZNKú5\KXí5VZOSO`GZOUTú:XGVúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ
CHAPTER 2

:XKTJOTMú9_YZKSY
Trending systems are systems designed for trending markets — they have the
following characteristics:
„ The systems are designed never to miss the big move; they will either always be
in the market or contain stop orders that will stop you into the market.
„ They attempt to limit losses during the market’s sideways mode; no system will
make money in every market condition, but a good system will limit losses in
market conditions for which it was not designed.
„ Profits are concentrated in a few big trades; they have a low percentage of
profitable trades. This makes them psychologically difficult to trade and
underscores the importance of never missing a big move.
Even though trending systems are difficult to trade, they are popular — it’s human
nature to want to cash in on the big moves. In this chapter, we present seven trending
systems that differ in their approach but that are all designed to capture big moves and
limit losses during directionless and/or volatile phases.

/Tú:NOYú)NGVZKX

„ Directional Movement Index System12 „ Consecutive Closes System............. 39


„ Keltner Channel System...................19 „ Momentum-Retracement System .... 45
„ Linear Regression & Momentum „ Three Exponential Moving Averages
System ..............................................25 System ............................................. 55
„ Herrick Payoff Index & Channel „ Investing a Fixed Dollar Amount .... 61
Breakout on Close System ...............32
éèúúúúúúúúúú*OXKIZOUTGRú3U\KSKTZú/TJK^ú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

*OXKIZOUTGRú3U\KSKTZú/TJK^ú9_YZKS
The Directional Movement Index (DMI) was created by Welles Wilder and presented in his
1978 book New Concepts in Technical Trading Systems. The DMI indicator measures the
amount of directional movement or “trendiness” in a market, and is composed of three lines:
DMI+ (DMIPlus), DMI- (DMIMinus), and ADX (Average Directional Index). When DMI+ is
greater than DMI-, the trend is up; when DMI- is greater than DMI+, the trend is down. ADX
is derived from the spread between DMI+ and DMI-. When ADX is rising, the market is
considered to be in a trending mode. When ADX is falling, the market is considered to be in a
nontrending mode.
The idea behind the Directional Movement Index System is that markets tend to cycle from a
nontrending period to a trending period, back to a nontrending period, and so on. The longer a
market trades in a nontrending mode, the more likely it is that the ensuing trend will offer a good
trading opportunity. We will watch for stocks that have been in a nontrending mode and enter
new positions when the stocks begin to trend.
To determine whether or not a stock is currently trending, we’ll use the Directional Movement
Index (DMI). If ADX is below both the DMI+ and the DMI- lines, then we’ll consider the stock
as not trending. Once we’ve determined that the stock is not trending, we’ll look at the behavior
of the DMI for our entry conditions.
As discussed, the market is not trending when ADX is below both the DMI+ and DMI- lines;
however, the market’s direction is considered to be up when DMI+ is above DMI- and down
when DMI- is above DMI+.Therefore, when DMI+ is greater than DMI-, and ADX crosses
above DMI-, we have a buy setup. When DMI- is greater than DMI+, and ADX crosses above
DMI+, we have a setup to sell short.
Once a buy setup occurs, we establish our entry point as the high of the setup bar plus one point.
When a sell setup occurs, our entry point is set at the low of the setup bar minus one point. The
buy setup remains in effect until the entry point is reached or until ADX declines below DMI-;
likewise, the sell setup remains in effect until the entry point is reached or until ADX declines
below DMI+. Figure 1 shows the Directional Movement Index System applied to a chart along
with the DMI Indicator (built into TradeStation).

4UZK ú=NKTúXKVXUJ[IOTMúZNOYú
INGXZîúSGQKúY[XKú_U[úXKSKSHKXú
ZUúSGZINú[VúZNKúOTV[ZYúOTú_U[Xú
Y_YZKSúGTJúZNKúOTJOIGZUXìú

,OM[XKúéìú*3/ú9_YZKSúGVVROKJúZUúGúJGOR_úINGXZúULú''ì
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY *OXKIZOUTGRú3U\KSKTZú/TJK^ú9_YZKSúúúúúúúúúúéç

When prices rally to our entry point for a buy, we’ll set our initial protective stop at the low of
the setup bar minus one point. When prices decline to our entry point to sell short, we’ll set our
initial protective stop at the high of the setup bar plus one point.
We have chosen two ways to exit our position in addition to the initial protective stop. We’ll
exit our position with whichever exit criteria is met first. First, we will exit either a long or a
short position on the next open when ADX reaches 30 and then ticks down (by “ticks down” we
mean that ADX is less than it was on the previous bar). Alternatively, we will exit a long
position when DMI+ crosses below DMI- or a short position when DMI- crosses below DMI+.

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined both long entries and short entries as well as exit orders. We also did
some setup work to calculate the DMI. The setup, entries and exits are described next:

9KZ[V
a) Calculate the DMI values: DMI+, DMI- and ADX.

2UTMú+TZXOKY
a) When DMI+ is greater than DMI-, and ADX crosses above DMI-, and we are not in a long
position, we have a buy setup.
b) Once a buy setup occurs, we establish our entry point as the high of the setup bar plus one
point.
c) The buy setup remains in effect until the entry point is reached or until ADX declines below
DMI-.

9NUXZú+TZXOKYú
a) When DMI- is greater than DMI+, and ADX crosses above DMI+, and we are not in a short
position, we have a setup to sell short.
b) When a sell setup occurs, our entry point is set at the low of the setup bar minus one point.
c) The sell setup remains in effect until the entry point is reached or until ADX declines below
DMI+.

+^OZú5XJKXYú
a) When prices rally to our entry point for a buy, we’ll set our initial protective stop at the low
of the setup bar minus one point.
b) When prices decline to our entry point to sell short, we’ll set our initial protective stop at the
high of the setup bar plus one point.
c) We will exit either a long or a short position at the close once we’ve been in the position at
least one bar and when ADX reaches 30 and then ticks down (by “ticks down” we mean that
ADX is less than it was on the previous bar).
d) We will exit a long position when we’ve been in the position at least one bar and when DMI+
crosses below DMI- or a short position when we’ve been in the position at least one bar and
when DMI- crosses below DMI+.

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
éæúúúúúúúúúú*OXKIZOUTGRú3U\KSKTZú/TJK^ú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

+GY_2GTM[GMKú/TYZX[IZOUTY ú*OXKIZOUTGRú3U\KSKTZú/TJK^úò9:'*úæ ú*3/í'*>ñ

/TV[Z ú*3/2KTòãñîú'*>2KTòãñîú'*>+^OZòçêñîú:XGJKòéêêêêñîú2UZòéêêñ!
<GXY ú([_9KZ[Vò,GRYKñîú9KRR9KZ[Vò,GRYKñîú([_6XOIKòêñîú9KRR6XOIKòêñîú*6R[Yòêñîú
*3OTòêñîú'*><GRòêñîú+^OZ96XIòêñîú+^OZ26XIòêñ!
a)GRI[RGZKú*3/úGTJú'*>ú<GR[KYc
*6R[Yú#ú*3/6R[Yò*3/2KTñ!
*3OTú#ú*3/3OT[Yò*3/2KTñ!
'*><GRú#ú'*>ò'*>2KTñ!
a)NKIQúLUXú([_ú9KZ[Vc
/Lú*6R[Yú$ú*3OTú'4*ú'*><GRú)XUYYKYú5\KXú*3OTúGTJú3GXQKZ6UYOZOUTú"$úéúZNKTú(KMOT
([_6XOIKú#ú.OMNúïúéú6UOTZ!
([_9KZ[Vú#ú:X[K!
+^OZ26XIú#ú2U]úíúéú6UOTZ!
+TJ!
/Lú'*><GRú"ú*3OTú58ú3GXQKZ6UYOZOUTú#úéúZNKT
([_9KZ[Vú#ú,GRYK!
a)NKIQúLUXú9KRRú9KZ[Vc
/Lú*6R[Yú"ú*3OTú'4*ú'*><GRú)XUYYKYú5\KXú*6R[YúGTJú3GXQKZ6UYOZOUTú"$úíéúZNKTú(KMOT
9KRR6XOIKú#ú2U]úíúéú6UOTZ!
9KRR9KZ[Vú#ú:X[K!
+^OZ96XIú#ú.OMNúïúéú6UOTZ!
+TJ!
/Lú'*><GRú"ú*6R[YúUXú3GXQKZ6UYOZOUTú#úíéúZNKT
9KRR9KZ[Vú#ú,GRYK!
a6RGIKú2UTMú+TZXOKYc
/Lú([_9KZ[VúZNKT
([_ú4[S;TOZYò:XGJKî2UZñú9NGXKYúTK^ZúHGXúGZú([_6XOIKú9ZUV!
a6RGIKú9NUXZú+TZXOKYc
/Lú9KRR9KZ[VúZNKT
9KRRú4[S;TOZYò:XGJKîú2UZñú9NGXKYúTK^ZúHGXúGZú9KRR6XOIKú9ZUV!
a+^OZú)XOZKXOGc
/Lú3GXQKZ6UYOZOUTú#úéúZNKTú(KMOT
([_9KZ[Vú#ú,GRYK!
+^OZ2UTMúGZú+^OZ26XIú9ZUV!
+TJ!
/Lú3GXQKZ6UYOZOUTú#úíéúZNKTú(KMOT
9KRR9KZ[Vú#ú:X[K!
+^OZ9NUXZúTK^ZúHGXúGZú+^OZ96XIú9ZUV!
+TJ!
/Lúòú'*><GRAéCú$#ú'*>+^OZú'4*ú'*><GRú"ú'*><GRAéCúñúZNKTú(KMOT
/Lú3GXQKZ6UYOZOUTú#úéúGTJú(GXY9OTIK+TZX_ú$úéúZNKT
+^OZ2UTMúZNOYúHGXúGZú)RUYK!
/Lú3GXQKZ6UYOZOUTú#úíéúGTJú(GXY9OTIK+TZX_ú$úéúZNKT
+^OZ9NUXZúZNOYúHGXúGZú)RUYK!
+TJ!
/Lú*6R[Yú"ú*3OTúGTJú(GXY9OTIK+TZX_ú$úéúúZNKTú+^OZ2UTMúZNOYúHGXúGZú)RUYK!
/Lú*6R[Yú$ú*SOTúGTJú(GXY9OTIK+TZX_ú$úéúZNKTú+^OZ9NUXZúZNOYúHGXúGZú)RUYK!
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY *OXKIZOUTGRú3U\KSKTZú/TJK^ú9_YZKSúúúúúúúúúúéå

/TV[ZY
Following is the list of all the inputs we used in this system:

Input Default Description

DMILen 7 The number of bars used in the calculation of the DMI.

ADXLen 7 The number of bars used in the calculation of the ADX.

ADXExit 30 The level to which the ADX has to reach in order for one of
the exits to take effect (the ADX reaches 30 and then ticks
down).

Trade 10000 The dollar amount of each trade.

Lot 100 The minimum lot size of each transaction.

In addition to these inputs, we define the following variables:


<GXY ú([_9KZ[Vò,GRYKñîú9KRR9KZ[Vò,GRYKñîú([_6XOIKòêñîú9KRR6XOIKòêñîú*6R[Yòêñîú
*3OTòêñîú'*><GRòêñîú+^OZ96XIòêñîú+^OZ26XIòêñ!

9KZ[V
Next, we calculate the DMI values and store the results to our variables:
*6R[Yú#ú*3/6R[Yò*3/2KTñ!
*3OTú#ú*3/3OT[Yò*3/2KTñ!
'*><GRú#ú'*>ò'*>2KTñ!

2UTMúôú9NUXZú+TZXOKY
If the DMI+ is greater than the DMI- and the ADX crosses over the DMI - and we are not in a
long position already, we will set our entry price for a long position to the high of the current
bar plus 1 point (stored in the variable ([_6XOIK). In addition, we set our exit price to the low
minus 1 point as well as the variable ([_9KZ[V to True, meaning that the buy setup conditions
4UZK úéúVUOTZúOYúKW[O\GRKTZúZUú
UTKúSOTOS[SúSU\KúULúZNKú have been met:
Y_SHURúZXGJKJìú:XGJK9ZGZOUTú /Lú*6R[Yú$ú*3OTú'4*ú'*><GRú)XUYYKYú5\KXú*3OTúGTJú3GXQKZ6UYOZOUTú"$úéúZNKTú(KMOT
XKGJYúZNKú9_SHURú;TO\KXYKúZUú ([_6XOIKú#ú.OMNúïúéú6UOTZ!
JKZKXSOTKúZNKú\GR[KúULúZNKú
([_9KZ[Vú#ú:X[K!
SOTOS[SúSU\Kì
+^OZ26XIú#ú2U]úíúéú6UOTZ!
+TJ!
If the ADX declines back under the DMI- or we enter a long position, we set the ([_9KZ[V
variable to False. This means we will no longer be looking for entry points:
/Lú'*><GRú"ú*3OTú58ú3GXQKZ6UYOZOUTú#úéúZNKTú
([_9KZ[Vú#ú,GRYK!
If the DMI- is lower than the DMI- and the ADX crosses over the DMI- and we are not in a short
position already, we will set our entry price for a short position to the low of the current bar
minus 1 point (stored in the variable 9KRR6XOIK). In addition, we set our exit price to the high plus
1 point as well as the variable 9KRR9KZ[V to True, meaning that the sell setup conditions have been
met:
/Lú*6R[Yú"ú*3OTú'4*ú'*><GRú)XUYYKYú5\KXú*6R[YúGTJú3GXQKZ6UYOZOUTú"$úíéúZNKTú(KMOT
9KRR6XOIKú#ú2U]úíúéú6UOTZ!
9KRR9KZ[Vú#ú:X[K!
+^OZ96XIú#ú.OMNúïúéú6UOTZ!
+TJ!
éäúúúúúúúúúú*OXKIZOUTGRú3U\KSKTZú/TJK^ú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

We will set the 9KRR9KZ[V variable to False if the ADX declines back under the DMI- or we enter
a short position. This means we will no longer be looking for short entry points.
/Lú'*><GRú"ú*6R[YúUXú3GXQKZ6UYOZOUTú#úíéúZNKT
9KRR9KZ[Vú#ú,GRYK!
If the variable ([_9KZ[V is true, then we will place an order to buy on the next bar when the
market reaches the price specified by the ([_6XOIK variable. In order to determine the number of
shares/contracts to trade, we use the function 4[S;TOZY. This function calculates the number of
units you can trade based on a given dollar number investment and the minimum lot size for the
market. For example, if you want to invest $15,500, the market trades in lots of 100 shares, and
the price of the stock is $65 a share, 4[S;TOZYòéååêêîéêêñúwill return 200. This function is
described in detail at the end of this chapter, in the section titled, “Investing a Fixed Dollar
Amount.”
/Lú([_9KZ[VúZNKT
([_ú4[S;TOZYò:XGJKî2UZñú9NGXKYúTK^ZúHGXúGZú([_6XOIKú9ZUV!
The same is done for the short side:
/Lú9KRR9KZ[VúZNKT
9KRRú4[S;TOZYò:XGJKî2UZñú9NGXKYúTK^ZúHGXúGZú9KRR6XOIKú9ZUV!
Once we enter a long position, we will set the variable ([_9KZ[V to False, this to avoid placing
additional entry orders. Also, we will place a stop loss exit at the +^OZ26XI, this will have the
value of the low minus 1 point of the setup bar, as defined previously.
/Lú3GXQKZ6UYOZOUTú#úéúZNKTú(KMOT
([_9KZ[Vú#ú,GRYK!
+^OZ2UTMúGZú+^OZ26XIú9ZUV!
+TJ!
Once we enter a short position, we will set the variable 9KRR9KZ[V to False, this to avoid placing
additional entry orders. Also, we will place a stop loss exit at the +^OZ96XI, this will have the
value of the high plus 1 point of the setup bar as defined previously.
/Lú3GXQKZ6UYOZOUTú#úíéúZNKTú(KMOT
9KRR9KZ[Vú#ú:X[K!
+^OZ9NUXZúTK^ZúHGXúGZú+^OZ96XIú9ZUV!
+TJ!

2UTMúôú9NUXZú+^OZY
If the ADX reaches the value specified in the '*>+^OZ input (30 by default), and then declines
once we have been in the position for more than 1 bar, we will exit either our long or short
positions:
/Lúòú'*><GRAéCú$#ú'*>+^OZú'4*ú'*><GRú"ú'*><GRAéCúñúZNKTú(KMOT
/Lú3GXQKZ6UYOZOUTú#úéúGTJúHGXYYOTIKKTZX_ú$úéúZNKT
+^OZ2UTMúZNOYúHGXúGZú)RUYK!
/Lú3GXQKZ6UYOZOUTú#úíéúGTJúHGXYYOTIKKTZX_ú$úéúZNKT
+^OZ9NUXZúZNOYúHGXúGZú)RUYK!
+TJ!
If the DMI+ declines and crosses under the DMI- we consider the market position to have
changed so we will exit our long position (provided we’ve been in the position at least one bar):
/Lú*6R[Yú"ú*3OTúGTJú(GXY9OTIK+TZX_ú$úéúZNKTú+^OZ2UTMúZNOYúHGXúGZú)RUYK!
If DMI Minus crosses under DMI-, we will exit our short position (provided we’ve been in the
position at least one bar):
/Lú*6R[Yú$ú*SOTúGTJú(GXY9OTIK+TZX_ú$úéúZNKT+^OZ9NUXZúZNOYúHGXúGZú)RUYK!
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY *OXKIZOUTGRú3U\KSKTZú/TJK^ú9_YZKSúúúúúúúúúúéã

-KTKXGRú9_YZKSú,UXSGZ
When we apply a system to a chart, we normally use the options in the Format dialog box to format
costs, stops, and properties. However, in this system we did not enter an amount for slippage and
commission although those costs must certainly be taken into account before a system is traded. We
did not specify a default number of shares to trade per order. Instead, we want to focus on what we
believe to be a much improved method for determining the number of shares to trade. Please see the
section at the end of this chapter, titled, “Investing a Fixed Dollar Amount,” for an explanation of
how we are calculating the number of shares to trade.
Note: Remember that Commissions are calculated on a per contract/share basis. When you are
trading stocks, you would enter the average commission you are charged divided by the number
of shares the system is buying and selling.
We also did not enable a money management stop or a trailing stop for this system. Our initial
protective stop for a long position is set at the low of the setup bar plus one point; our initial
stop for a short position is set at the high of the setup bar plus one point.
Rather than enabling a trailing stop, we decided to demonstrate a system that exits on signals
generated by indicators. We’ll exit our positions with one of two possible strategies. When
ADX reaches 30 and ticks down, we’ll exit on the next open. Alternatively, we’ll exit a long
position when DMI+ crosses below DMI- and exit a short position when DMI- crosses below
DMI+ (we’ll exit with whichever strategy occurs first).
In the Properties tab, we selected the option Do not allow multiple entries in the same
direction. If the system is in a long position, and market conditions generate another long entry
order, the order is ignored. This is also the case when we’re in a short position, and market
conditions generate another short entry order.

:KYZOTMúôú/SVXU\OTM
Figure 2 shows a sample System Report for the DMI-ADX trading system.

,OM[XKúèìú9GSVRKú9_YZKSú8KVUXZúLUXúZNKú*3/í'*>ú9_YZKSúGVVROKJúZUúGúJGOR_ú''úINGXZú

The total net profit of only $3,586.70 is misleading because the system actually made $6,801.90
on long trades and lost $3,215.20 on short trades. The system was tested from January of 1988
to July of 1998, a period in which stocks were in an unprecedented bull market. It’s not
surprising that this system (a trend-following system) performed poorly when it sold short.
éâúúúúúúúúúú*OXKIZOUTGRú3U\KSKTZú/TJK^ú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

Since very few of us actually sell stock short (generally using sell signals to exit long positions),
we're not overly concerned about the system’s poor performance on the short side. A result of
45% profitable is not bad for a trend-following system. The average win was 1.47 times as big
as the average loss.
The only parameter we optimized was the level that ADX had to reach before our ADX
turndown would be a signal for us to exit our position on the next open. The level 35 generated
the largest net profit, profit factor, and average trade, while producing the smallest maximum
drawdown. Figure 3 shows the resulting Optimization Report.

,OM[XKúçìú5VZOSO`GZOUTú8KVUXZúXKY[RZOTMúLXUSúGTúUVZOSO`GZOUTúULúZNKú'*>+^OZúOTV[Zú
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 1KRZTKXú)NGTTKRú9_YZKSúúúúúúúúúúéá

Figure 4 shows the bar graph view of the above Optimization Report. It shows profits increasing
as the ADX exit level increases from 10 to 35 and decreasing from 40 to 50. Notice that the
optimum exit level of 35 also had strong-performing values to both its left and right.

,OM[XKúæìú(GXúMXGVNú\OK]úULúZNKú5VZOSO`GZOUTú8KVUXZúOTú,OM[XKúç

9[MMKYZOUTúLUXú/SVXU\KSKTZ
When designing the system, we arbitrarily chose values of 7 for the DMI length and the ADX
length. Before trading this system with our hard-earned money, we would want to optimize the
DMI and ADX values on a large data set and then check to see that the optimized values
performed well on our-of-sample data. The out-of-sample data would include earlier and later
dates of the same stock (backward and forward testing) as well as testing the optimized
parameters on other stocks and perhaps some commodities as well. While we would not expect
the optimized parameters to perform as well on the out-of-sample data as they did on the
sample, we would require that they be generally profitable in order for us to trade the system.

1KRZTKXú)NGTTKRú9_YZKS
The construction of a Keltner Channel begins with the calculation of a moving average and an
average true range. Then an upper band is plotted at the moving average plus a multiple of the
average true range, and a lower band is plotted at the moving average minus a multiple of the
average true range. Generally, the length selected for the moving average is also the length
selected for the number of bars included for the average true range. The multiple of the average
true range that is added to and subtracted from the moving average determines the sensitivity
of the Keltner Channel.
Adding 1x the average true range to the moving average to determine the top band of the
channel, and subtracting 1x the average true range to determine the bottom of the channel
results in a relatively narrow channel. Adding 5x the average true range to the moving average
to determine the top band and subtracting 5x the average true range to determine the bottom
band produces a very wide channel. For this system, we selected a 10-bar simple moving
average of closes, a 10-bar average true range, and a 1.2 multiple of the average true range.
Our Keltner Channel System attempts to profit from trending price moves while limiting
“whipsaw” losses (“whipsaw” losses occur when a sensitive entry indicator is triggered
repeatedly causing several relatively small losses within a short period of time). Buying when
a market closes above a sensitive moving average (for example, a 10-bar average) and selling
short when a market closes below the moving average usually results in an unacceptable number
of “whipsaw” losses. Our Keltner Channel attempts to mitigate that problem by requiring prices
to rally above the top band of the channel for a buy and to decline below the lower band of the
channel for a sell.
èêúúúúúúúúúú1KRZTKXú)NGTTKRú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

Of course, the advantage of filtering out many of the “whipsaw” losses comes with a
disadvantage. Our buys will be executed at a higher price (above the top band), and our sells
will be executed at a lower price (below the bottom band) than they would be if we bought just
above or sold just below the moving average. Our goal is to save more money by reducing
“whipsaw” losses than we spend by buying higher and selling lower.
Our setup to buy is a close above the top line of the channel, and our setup to sell short is a close
below the bottom line of the channel. Figure 5 shows the Keltner Channel System applied to a
weekly American Express chart.

,OM[XKúåìú1KRZTKXú)NGTTKRú9_YZKSúGVVROKJúZUúGú]KKQR_ú'SKXOIGTú+^VXKYYúINGXZ

With a buy setup in place, our next step is to determine our entry point. First we measure the
distance between the top band of the channel and the moving average. Then we add 50% of that
distance to the high of the setup bar for our buy point. When we have a setup to sell short, we
first measure the distance between the moving average and the bottom band of the channel.
Then we subtract 50% of that distance from the low of the setup bar to determine our sell point.
We’ll keep the entry orders active for 5 bars; if the entry price is not reached within 5 bars of
the cross over, the orders are cancelled and we will wait for another setup to occur.
After we enter a position, we’ll set a money management stop to limit our loss to a specified
dollar amount if the market moves against us. To manage the trade, we’ll set a trailing stop at
the 4-bar extreme. Our exit, if we are not stopped out by our money management stop or our
trailing stop, will be on a close below the moving average (in the case of a long position) and
on a close above the moving average (for a short position).

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined both long entries and short entries as well as exit orders. We also did
some setup work to calculate the channel. The setup, entries and exits are described next:

9KZ[V
a) Calculate a channel using the 10-bar simple moving average of closing prices and a 10-bar
average true range with a 1.2 multiple.
b) Calculate the channel’s range.
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 1KRZTKXú)NGTTKRú9_YZKSúúúúúúúúúúèé

2UTMú+TZXOKY
a) Check for a close above the top line of the channel.
b) Once a close is above the top line, measure the distance between the top band of the channel
and the moving average and add 50% of that distance to the high of the setup bar. This is our
buy point, buy when the price reaches this point.
c) Keep the order active for 5 bars.

9NUXZú+TZXOKYú
a) Check for a close below the bottom line of the channel.
b) Once a close is below the bottom line, measure the distance between the moving average and
the bottom band of the channel. Then, subtract 50% of that distance from the low of the setup
bar. This is our sell point, sell when the price reaches this point.
c) Keep the order active for 5 bars.

+^OZú5XJKXYú
a) Once we enter a position, set a trailing stop at the 4-bar extreme. We’ll exit our long position
when the close penetrates the lowest low of the last 4 bars and we’ll exit our short position when
the close penetrates the highest high of the last 4 bars.
b) Also, exit a long position on a close below the moving average and exit a short position on a
close above the moving average (for a short position).

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.

+GY_2GTM[GMKú/TYZX[IZOUTY ú1KRZTKXú)NGTTKRúò9:'*úæ ú1KRZTKXú)NGTñ

/TV[ZY ú6XOIKò)RUYKñîú2KTMZNòéêñîú)UTYZòéìèñîú)NGT6ITZòìåñîú:XGJKòéêêêêñîú2UZòéêêñ!
<GXY ú1);òêñîú1)2òêñîú)NGT8TMòêñîú'\M<GRòêñîú'\M8GTMKòêñîú9KZ(GXòêñîú)U[TZ2òêñîú)U[TZ9òêñ!
a'YYOMTSKTZYúULú1KRZTKXúIGRI[RGZOUTYc
'\M<GRú#ú'\KXGMKò6XOIKîú2KTMZNñ!
'\M8GTMKú#ú'\KXGMKò:X[K8GTMKîú2KTMZNñ!
1);ú#ú'\M<GRúïú'\M8GTMKúðú)UTYZ!
1)2ú#ú'\M<GRúíú'\M8GTMKúðú)UTYZ!
)NGT8TMú#úò1);úíú1)2ñúëúè!
a'II[S[RGZKYúZUúIU[TZúZNKúHGXYúGLZKXúZNKú9KZ;VYúHKRU]c
)U[TZ2ú#ú)U[TZ2úïúé!
)U[TZ9ú#ú)U[TZ9úïúé!
a([_ú)XOZKXOGú+\GR[GZOUTc
/Lú6XOIKú)XUYYKYú'HU\Kú1);úZNKTú(KMOT
9KZ(GXú#ú.OMN!
)U[TZ2ú#úé!
+TJ!
/Lú6XOIKú$ú1);ú'4*ú)U[TZ2ú"#úåúZNKT
([_ú4[S;TOZYò:XGJKîú2UZñú9NGXKYú4K^Zú(GXúGZú9KZ(GXúïúò)NGT8TMúðú)NGT6ITZñú9ZUV!
èèúúúúúúúúúú1KRZTKXú)NGTTKRú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

a9KRRú)XOZKXOGú+\GR[GZOUTc
/Lú6XOIKú)XUYYKYú(KRU]ú1)2úZNKTú(KMOT
9KZ(GXú#ú2U]!
)U[TZ9ú#úé!
+TJ!
/Lú6XOIKú"ú1)2ú'4*ú)U[TZ9ú"#úåúZNKT
9KRRú4[S;TOZYò:XGJKîú2UZñú9NGXKYú4K^Zú(GXúGZú9KZ(GXúíúò)NGT8TMúðú)NGT6ITZñú9ZUV!
a9_YZKSú9ZUVYc
/Lú)RUYKú)XUYYKYú(KRU]ú'\M<GRúZNKT+^OZ2UTMúZNOYú(GXúUTú)RUYK!
/Lú)RUYKú)XUYYKYú'HU\Kú'\M<GRúZNKT+^OZ9NUXZúZNOYú(GXúUTú)RUYK!
a:XGOROTMú9ZUVYc
+^OZ2UTMú4K^Zú(GXúGZú2U]KYZò2U]îúæñú9ZUV!
+^OZ9NUXZú4K^Zú(GXúGZú.OMNKYZò.OMNîúæñú9ZUV!

/TV[ZY
Following is the list of all the inputs we used in this system:

Input Default Description

Price Close Price used to calculate the moving average (on which the
channels will be based).

Length 10 Length, expressed in bars, used to calculate the moving


average and average true range (in order to calculate Keltner
Channel)

Const 1.2 Multiplier used to specify the width of the channel

ChanPcnt .5 Percentage of channel range to add to the high to determine the


long entry point and to subtract from the low to determine the
short entry point

Trade 10,000 Dollar amount willing to invest in each transaction

Lot 100 Minimum lot size for each transaction

In addition to these inputs, we define the following variables:


<GXY ú1);òêñîú1)2òêñîú)NGT8TMòêñîú'\M<GRòêñîú'\M8GTMKòêñîú9KZ(GXòêñîú)U[TZ2òêñî
ú)U[TZ9òêñ!

9KZ[V
We calculate the moving average of the closing price as well as of the true range for the last 10
bars, and store the resulting values in the variables '\M<GR and '\M8GTMK, respectively.
'\M<GRú#ú'\KXGMKò6XOIKîú2KTMZNñ!
'\M8GTMKú#ú'\KXGMKò:X[K8GTMKîú2KTMZNñ!
Then, we multiply '\M8GTMK by the multiplier and add the resulting value to '\M<GR. This gives
us the upper band of the Keltner Channel. Likewise, we perform the same multiplication again
and this time subtract the resulting value from '\M<GR. This gives us the lower band of the
Keltner Channel. Finally, we calculate the channel range by subtracting the lower band from the
top band and dividing the resulting value by 2:
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 1KRZTKXú)NGTTKRú9_YZKSúúúúúúúúúúèç

1);ú#ú'\M<GRúïú'\M8GTMKúðú)UTYZ!
1)2ú#ú'\M<GRúíú'\M8GTMKúðú)UTYZ!
)NGT8TMú#úò1);úíú1)2ñúëúè!
We use two counters, )U[TZ2 and )U[TZ9. We increment these with each bar and reset them each
time a buy setup or sell setup occurs, respectively. This way, we can keep a count and use them
)U[TZKXYúGXKúGúYOSVRKúGTJú\KX_ú to keep buy and sell orders active for 5 bars:
IUSSUTúSKINGTOYSú[YKJúOTú
+GY_2GTM[GMKúH_ú]NOINú_U[ú )U[TZ2ú#ú)U[TZ2úïúé!
IGTúQKKVúZXGIQúULúNU]úSGT_ú
ZOSKYúGTúK\KTZúUII[XYîúUXúNU]ú )U[TZ9ú#ú)U[TZ9úïúé!
SGT_úHGXYúNG\KúHKKTúK\GR[GZKJú
YOTIKúGTúK\KTZúUII[XXKJìú 2UTMú+TZXOKY
Whenever the close (represented here by the input 6XOIK) crosses above the upper Keltner
?U[úYKZúGú\GXOGHRKúZUúéú]NKTúZNKú
LOXYZúK\KTZúUII[XYúGTJúZNKTú Channel band, we will save the high of the bar in the variable 9KZ(GX and we will reset the
OTIXKSKTZúZNKú\GXOGHRKúGYúKGINú variable )U[TZ2 to 1. This variable will be incremented on every bar thereafter by the above
K\KTZúUII[XYúUXúHGXúOYúK\GR[GZKJì instructions.
/Lú6XOIKú)XUYYKYú'HU\Kú1);úZNKTú(KMOT
9KZ(GXú#ú.OMN!
)U[TZ2ú#úé!
+TJ!
If the close is above the upper Keltner Channel band, and it has been five or less bars since the
cross over, we will place a buy stop order at the high of the set up bar, which is the bar on which
the close crossed over the upper Keltner Channel band (this value is stored in the variable
9KZ(GX) plus 50% of the channel range.
/Lú6XOIKú$ú1);ú'4*ú)U[TZ2ú"#úåúZNKT
([_ú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú9KZ(GXúïúò)NGT8TMúðú)NGT6ITZñú9ZUV!

9NUXZú+TZXOKY
Whenever the close crosses under the lower Keltner Channel band, we store the low in the
variable 9KZ(GX and reset the variable )U[TZ9 to 1. As with the variable )U[TZ2, this variable is
incremented on every bar thereafter by the previous instructions, )U[TZ9ú#ú)U[TZ9úïúé.
/Lú6XOIKú)XUYYKYú(KRU]ú1)2úZNKTú(KMOT
9KZ(GXú#ú2U]!
)U[TZ9ú#úé!
+TJ!
If the price is less than the lower Keltner Channel band, and it has been five or less bars since
the cross under, we will place a sell stop order at the low of the set up bar, which is the bar on
which the close crossed under the lower Keltner Channel band (this value is stored in the
variable 9KZ(GX) minus 50% of the channel range.
/Lú6XOIKú"ú1)2ú'4*ú)U[TZ9ú"#úåúZNKT
9KRRú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú9KZ(GXúíúò)NGT8TMúðú)NGT6ITZñú9ZUV!

2UTMúôú9NUXZú+^OZY
We will exit any long position if the close crosses under the moving average of the close. Also,
we will cover any short positions if the close crosses over the moving average of the close.
/Lú)RUYKú)XUYYKYú(KRU]ú'\M<GRúZNKT+^OZ2UTMú:NOYú(GXúUTú)RUYK!
/Lú)RUYKú)XUYYKYú'HU\Kú'\M<GRúZNKTú+^OZ9NUXZú:NOYú(GXúUTú)RUYK!
Finally, we will place a trailing stop for long positions at the lowest low of the last four bars.
Likewise, we will place a trailing stop to cover our short positions at the highest high of the last
four bars.
èæúúúúúúúúúú1KRZTKXú)NGTTKRú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

+^OZ2UTMú4K^Zú(GXúGZú2U]KYZò2U]îúæñú9ZUV!
+^OZ9NUXZú4K^Zú(GXúGZú.OMNKYZò.OMNîúæñú9ZUV!

-KTKXGRú9_YZKSú,UXSGZ
When we apply a system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified $10,000 as the trade size and 100 shares as the lot size.
Note: Remember that Commissions are calculated on a per contract/share basis. When you are
trading stocks, you would enter the average commission you are charged divided by the number
of shares the system is buying and selling.
Under the Stops tab, we enabled a money management stop. The money management stop
option holds the dollar amount per position or per contract/share we want to risk before exiting
from the position. We set the value to $7.
Note: When you are trading stocks and you choose the stop to be tracked on a per share
(contract) basis, you will type in the number of points you are willing to lose before you are
exited out. When you are trading futures or any instrument that has a different dollar-point
value, you would type the maximum number of dollars you are willing to risk per contract
traded.
In the Properties tab, we selected the Do not allow multiple entries in the same direction
option. If the system is in a long position and market conditions generate another long entry
order, the order is ignored. This is also the case when we’re in a short position and market
conditions generate another short entry order.

:KYZOTMúôú/SVXU\OTM
Because we tested this system on weekly data, we lengthened the test period from about 10
years to about 20 years. We still generated a smaller number of trades than were generated on
systems we tested on daily bars, of course, but at 36 trades these results are statistically
significant. Figure 6 shows the sample System Report.
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKSúúúúúúúúúúèå

,OM[XKúäìú9GSVRKú9_YZKSú8KVUXZúLUXúZNKú1KRZTKXú)NGTTKRú9_YZKSúUTúGú]KKQR_ú'SKXOIGTú+^VXKYYúINGXZ

As we have come to expect, the system made money on the long trades and lost money on the
short trades during this bull market. With that in mind, 44% profitable for all trades combined,
with a ratio of average win to average loss of 1.82 and a profit factor of 1.45 isn’t too bad.

9[MMKYZOUTYúLUXú/SVXU\KSKTZ
The most promising way to make a big improvement to the system is to employ a longer-term
filter to keep us on the bullish side of this historic uptrend. Granted, we could not know the
duration and magnitude of this bull market in advance; however, we would not need to know
the extent of the bull market in advance to limit our trading to the long side. Since we tested this
system on a weekly chart, we could go just one timeframe higher to a monthly chart, apply a
moving average to the monthly data, and only trade in the direction of the monthly moving
average.
Of course, we can also fine-tune this system by optimizing the values for the moving average,
the average true range, and the multiple of the average true range we use to determine the upper
and lower bands.
Other parameters that could improve the system’s performance with some attention are the
percentage of the distance between the top band of the channel and the moving average that we
add to the high of the setup bar to determine our buy point, and the percentage of the distance
between the bottom band of the channel and the moving average that we subtract from the low
of the setup bar to determine our sell point. We should not assume that the percentages will
necessarily be the same for long and short positions.

2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKS
The Linear Regression Indicator plots a line through the prices of a stock or commodity in an
attempt to minimize the distance between the line and each individual point. The method used
to accomplish this is called the “least squares” method. The indicator is based on the theory that
prices are pulled back to the regression line after they stray above it or below it.
èäúúúúúúúúúú2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

The Linear Regression Indicator can also be used to monitor the current trend. If it’s rising the
trend is up, and if it’s falling the trend is down. For our Linear Regression and Momentum
System, we’ll smooth the linear regression line with an exponential moving average so that the
indicator does not switch back and forth between uptrends and downtrends too often.
Momentum, the second indicator in this system, compares the current bar’s closing price with
the closing price a specified number of bars in the past. To calculate a 5-bar momentum line,
for example, subtract the close of 5 bars ago from the current bar’s close.
When the 5-bar Momentum Indicator is above its zero line and rising, the 5-bar price changes
are positive and increasing — that is, the trend is bullish and accelerating. If the momentum line
turns flat, it implies that the 5-bar price changes are about equal during the Momentum
Indicator’s period of sideways movement. When the Momentum Indicator begins to decline
from above zero, the market’s gains during the past 5 bars are less than the corresponding gains
in the preceding bars — that is, the uptrend is decelerating.
When the 5-bar Momentum Indicator falls below its zero line, the current close is below the
close 5 bars ago. As the downtrend gains bearish velocity, momentum accelerates downward
from the zero line. An upturn of the indicator in negative territory means that the magnitude of
5-bar price declines is decreasing — that is, the downtrend is decelerating. Momentum is a
leading indicator — it levels off while prices are still rising in an uptrend or falling in a
downtrend, and it reverses its direction when the trend begins to slow.
In this system, we’ll use momentum to identify countertrend declines in an uptrend and
countertrend rallies in a downtrend. As mentioned previously, the trend will be determined by
the direction of a smoothed linear regression line (i.e., an exponential moving average of linear
regression).
Figure 7 shows a daily chart of AT&T with a linear regression line and Momentum Indicator
applied.

,OM[XKúãìú*GOR_ú':ô:úINGXZú]OZNúZNKúYSUUZNKJúROTKGXúXKMXKYYOUTúROTKúGTJú3USKTZ[Sú/TJOIGZUXúGVVROKJ

For a buy setup, we’ll require the smoothed linear regression line to be rising and for momentum
to be below zero but rising. For a sell setup, we’ll require the smoothed linear regression line
to be falling and for momentum to be above zero but falling.
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKSúúúúúúúúúúèã

After a buy setup, we’ll calculate the distance between the high of the setup bar and the
smoothed linear regression line. Then we’ll add 50% of that distance to the high of the setup
bar to determine our long entry price.
After a sell setup, we’ll calculate the distance between the low of the setup bar and the smoothed
linear regression line. Then we’ll subtract 50% of that distance from the low of the setup bar to
determine our short entry price.
Once we’ve entered a long position, we’ll set our initial protective stop at the low of the setup
bar minus 50% of the 10-bar average true range; once we’ve entered a short position, we’ll set
our initial protective stop at the high of the setup bar plus 50% of the 10-bar average true range.
As the market moves in our favor, we’ll trail a % risk trailing stop.
To exit when we’re in a long position, we’ll watch for the smoothed linear regression line to
turn down. Then we’ll place our sell stop at the lowest low of the last 4 bars. When we’re in a
short position, we’ll watch for the smoothed linear regression line to turn up. Then we’ll place
our buy stop at the highest high of the last 4 bars.

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined both long entries and short entries as well as exit orders. We also did
some setup work to calculate the linear regression line, its smoothed average and momentum.
The setup, entries and exits are described next:

9KZ[V
a) Calculate the linear regression line (using the closing prices and a length of 20) and its
exponential average (using a length of 15).
b) Calculate the momentum (using the closing prices and a length of 10).

2UTMú+TZXOKY
a) For a buy setup, we’ll require the smoothed linear regression line to be rising. In other words,
its value on the current bar must be greater than its value on the previous bar. Also, momentum
must be below zero but rising (greater on this bar than on the previous bar).
b) After a buy setup, we’ll calculate the distance between the high of the setup bar and the
smoothed linear regression line. Then we’ll add 50% of that distance to the high of the setup
bar; this is our long entry price. The order remains active for 4 bars.

9NUXZú+TZXOKYú
a) For a sell setup, we’ll require the smoothed linear regression line to be falling. In other words,
its value on the current bar must be less than its value on the previous bar. Also, momentum
must be greater than zero but falling (less on this bar than on the previous bar).
b) After a sell setup, we’ll calculate the distance between the low of the setup bar and the
smoothed linear regression line. Then we’ll subtract 50% of that distance from the low of the
setup bar; this is our short entry price. The order remains active for 4 bars.

+^OZú5XJKXYú
a) Once we’ve entered a long position, we’ll set our initial protective stop at the low of the setup
bar minus 50% of the 10-bar average true range.
b) Once we’ve entered a short position, we’ll set our initial protective stop at the high of the
setup bar plus 50% of the 10-bar average true range.
d) To exit when we’re in a long position, we’ll watch for the smoothed linear regression line to
turn down (the value on the current bar is less than it was on the previous bar). Then we’ll place
a stop order at the lowest low of the last 4 bars.
èâúúúúúúúúúú2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

e) When we’re in a short position, we’ll watch for the smoothed linear regression line to turn
up (the value on the current bar is greater than it was on the previous bar). Then we’ll place a
stop order at the highest high of the last 4 bars.

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.

+GY_2GTM[GMKú/TYZX[IZOUTY ú2OTKGXú8KMXKYYOUTúôú3USKTZ[Súò9:'*úæ ú2OT8KMë3USñ

/TV[ZY ú6XOIKò)RUYKñîú282KTòèêñîú'\M2KTòéåñîú3US2KTòéêñîú6ITZòìåñîú:XGJKòéêêêêñîú2UZòéêêñ!
<GXY ú>2OT8KMòêñîú3USòêñîú9KZ(GX.òêñîú9KZ(GX2òêñîú9KZ(GX9òêñîú)U[TZ2òêñîú)U[TZ9òêñ!
a'YYOMTSKTZúULú+^VUTKTZOGRú2OTKGXú8KMXKYYOUTúGTJú3USKTZ[Sc
>2OT8KMú#ú>'\KXGMKò2OTKGX8KM<GR[Kò6XOIKîú282KTîúêñîú'\M2KTñ!
3USú#ú3USKTZ[Sò6XOIKîú3US2KTñ!
a'II[S[RGZKYúZUúIU[TZúZNKúHGXYúGLZKXúZNKú9KZ;VYúHKRU]c
)U[TZ2ú#ú)U[TZ2úïúé!
)U[TZ9ú#ú)U[TZ9úïúé!
a'YYOMTSKTZúULú9_YZKSú+TZX_ë+^OZúIXOZKXOGc
)UTJOZOUTéú#ú>2OT8KMú$ú>2OT8KMAéC!
)UTJOZOUTèú#ú3USú"úêú'4*ú3USú$ú3USAéC!
)UTJOZOUTçú#ú>2OT8KMú"ú>2OT8KMAéC!
)UTJOZOUTæú#ú3USú$úêú'4*ú3USú"ú3USAéC!
a)NKIQúIXOZKXOGúGTJúMKTKXGZKú([_úUXJKXúOLúIXOZKXOGúNG\KúHKKTúSKZú]OZNOTúæúHGXYc
/Lú)UTJOZOUTéú'4*ú)UTJOZOUTèúZNKTú(KMOT
/Lú)U[TZ2ú#úéú58ú)U[TZ2ú$úæúZNKTú(KMOT
9KZ(GX2ú#ú.OMN!
)U[TZ2ú#úé!
+TJ!
/Lú)U[TZ2ú"#úæúZNKTú(KMOT
<GR[Kéú#ú6ITZúðúò9KZ(GX2úíú>2OT8KMñ!
([_úòø2UTMøñú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú9KZ(GX2úïú<GR[Kéú9ZUV!
+TJ!
+TJ!
a)NKIQúIXOZKXOGúGTJúMKTKXGZKú9KRRúUXJKXúOLúIXOZKXOGúNG\KúHKKTúSKZú]OZNOTúæúHGXYc
/Lú)UTJOZOUTçú'4*ú)UTJOZOUTæúZNKTú(KMOT
/Lú)U[TZ9ú#úéú58ú)U[TZ9ú$úæúZNKTú(KMOT
9KZ(GX9ú#ú2U]!
)U[TZ9ú#úé!
+TJ!
/Lú)U[TZ9ú"#úæúZNKTú(KMOT
<GR[Kéú#ú6ITZúðúò9KZ(GX9úíú>2OT8KMñ!
9KRRúòø9NUXZøñú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú9KZ(GX9úíú<GR[Kéú9ZUV!
+TJ!
+TJ!
a/TOZOGRú9ZUVYc
+^OZ2UTMúòø>øñ4K^Zú(GXúLXUSúKTZX_úòø2UTMøñú':öú2U]úíúò6ITZúðú'\M:X[K8GTMKòéêññú9ZUV!
+^OZ9NUXZúòø?øñ4K^Zú(GXúLXUSúKTZX_úòø9NUXZøñú':öú.OMNúïúò6ITZúðú'\M:X[K8GTMKòéêññú9ZUV!
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKSúúúúúúúúúúèá

a:XGOROTMú9ZUVYc
/Lú)UTJOZOUTçú'4*ú2U]ú"ú2U]KYZò2U]îúæñAéCúZNKT
+^OZ2UTMú4K^Zú(GXúGZú3GXQKZ!
/Lú)UTJOZOUTéú'4*ú.OMNú$ú.OMNKYZò.OMNîúæñAéCúZNKT
+^OZ9NUXZú4K^Zú(GXúGZú3GXQKZ!

/TV[ZY
Following is the list of all the inputs we used in this system:

Input Default Description


Price Close Price used to calculate the linear regression line.
LRLen 20 Length, expressed in bars, used to calculate the linear
regression line.
AvgLen 1 Length, expressed in bars, used to calculate the exponential
average of the linear regression line.
MomLen 10 Length, expressed in bars, to use to calculate the momentum.
Pcnt .5 Percentage used to calculate the value of the entries, exits and
stops.
Trade 10,000 Dollar amount willing to invest in each transaction
Lot 100 Minimum lot size for each transaction

In addition to these inputs, we define the following variables:


<GXY ú>2OT8KMòêñîú3USòêñîú9KZ(GX.òêñîú9KZ(GX2òêñîú9KZ(GX9òêñîú)U[TZ2òêñîú)U[TZ9òêñ!

9KZ[V
First, we calculate the exponential moving average of the linear regression. We use the
2OTKGX8KM<GR[K function to calculate the linear regression and then use the resulting value as an
input for the >'\KXGMK function in order to determine the exponential average of the linear
regression. We store the resulting value in the >2OT8KM variable.
We also calculate the momentum using the 3USKTZ[S function and store the resulting value in
the 3US variable.
>2OT8KMú#ú>'\KXGMKò2OTKGX8KM<GR[Kò6XOIKîú282KTîúêñîú'\M2KTñ!
3USú#ú3USKTZ[Sò6XOIKîú3US2KTñ!
We use two counters, )U[TZ2 and )U[TZ9. We increment these with each bar and reset them each
time a buy setup or sell setup occurs, respectively. This way, we can keep a count and use them
to keep buy and sell orders active for 4 bars:
)U[TZ2ú#ú)U[TZ2úïúé!
)U[TZ9ú#ú)U[TZ9úïúé!
Next, we make the comparisons between the exponential moving averages and the momentum
values. The results of these comparisons are used throughout the system. We compare the
exponential moving average of the linear regression line to the same value one bar ago. We also
compare the value of the momentum calculation to zero and to the same value one bar ago.
First, we check to see if the current value of the exponential average is greater than the value
one bar ago. If it is, the variable )UTJOZOUTé is set to True. Next, we check to see if the momentum
value is less than zero and greater than the same value one bar ago. If it is, )UTJOZOUTè is set to
çêúúúúúúúúúú2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

True. After that, we check to see if the exponential average is less than it was one bar ago. If it
is, )UTJOZOUTç is set to True. And finally, we check to see if the momentum value is greater than
zero and less than the same value one bar ago. If it is, )UTJOZOUTæ is set to True.
)UTJOZOUTéú#ú>2OT8KMú$ú>2OT8KMAéC!
)UTJOZOUTèú#ú3USú"úêú'4*ú3USú$ú3USAéC!
)UTJOZOUTçú#ú>2OT8KMú"ú>2OT8KMAéC!
)UTJOZOUTæú#ú3USú$úêú'4*ú3USú"ú3USAéC!

2UTMú+TZXOKY
Next, we check to see if )UTJOZOUTé and )UTJOZOUTè are true. If they are, and they became true
either on the previous bar or more than 4 bars ago, then the high price is stored in the variable
9KZ(GX2 and the )U[TZ2 variable, which accumulates the number of bars since the setup, is set
to 1.
/Lú)UTJOZOUTéú'4*ú)UTJOZOUTèúZNKTú(KMOT
/Lú)U[TZ2ú#úéú58ú)U[TZ2ú$úæúZNKTú(KMOT
9KZ(GX2ú#ú.OMN!
)U[TZ2ú#úé!
+TJ!
If the number of bars since )UTJOZOUTé and )UTJOZOUTè became true is less than 4, then we place a
buy order at a certain percentage above the value stored in 9KZ(GX2. We calculate the percentage
by subtracting the value of the exponential moving average from the value in 9KZ(GX2 and
multiplying that by the specified percentage (default of .5). We add this to the value in 9KZ(GX2
and that is our entry price. Notice that we specified a certain number of shares to buy using the
4[S;TOZY function. This function is described in detail in the section at the end of this chapter,
titled, “Investing a Fixed Dollar Amount.”
/Lú)U[TZ2ú"#úæúZNKTú(KMOT
<GR[Kéú#ú6ITZúðúò9KZ(GX2úíú>2OT8KMñ!
([_úòø2UTMøñú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú9KZ(GX2ïú
<GR[Kéú9ZUV!
+TJ!
+TJ!

9NUXZú+TZXOKY
Next, we check to see if )UTJOZOUTç and )UTJOZOUTæ are true. If they are, and they became true
either on the previous bar or more than 4 bars ago, then the low price is stored in the variable
9KZ(GX9 and the )U[TZ9 variable, which accumulates the number of bars since the setup, is set
to 1.
/Lú)UTJOZOUTçú'4*ú)UTJOZOUTæúZNKTú(KMOT
/Lú)U[TZ9ú#úéú58ú)U[TZ9ú$úæúZNKTú(KMOT
9KZ(GX9ú#ú2U]!
)U[TZ9ú#úé!
+TJ!
If the number of bars since )UTJOZOUTç and )UTJOZOUTæ became true is less than 4, then we place a
sell order at a certain percentage below the value stored in 9KZ(GX9. We calculate the percentage
by subtracting the value of the exponential moving average from the value in 9KZ(GX9 and
multiplying that by the specified percentage (default of .5). We subtract this from the value in
9KZ(GX9 and that is our entry price. Notice that we specified a certain number of shares to sell
using the 4[S;TOZY function. This function is described in detail in the section at the end of this
chapter, titled, “Investing a Fixed Dollar Amount.”
/Lú)U[TZ9ú"#úæúZNKTú(KMOT
<GR[Kéú#ú6ITZúðúò9KZ(GX9úíú>2OT8KMñ!
9KRRúòø9NUXZøñú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú9KZ(GX9úíú
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKSúúúúúúúúúúçé

<GR[Kéú9ZUV!
+TJ!
+TJ!

2UTMúôú9NUXZú+^OZY
We will exit any long position at or below the value that results when you subtract a percentage
(as specified by the input 6ITZ) of the 10-bar average of the true range from the low of the buy
setup bar.
Conversely, we will exit the short position at or above the value that results when you add a
percentage (as specified by the input 6ITZ) of the 10-bar average of the true range to the high of
4UZOIKúZNKú[YKúULúZNKú8KYKX\KJú the sell setup bar.
=UXJú':öìú:NOYúZOKYúZNKúLURRU]OTMú
VXOIKúXKLKXKTIKúZUúZNKúHGXúULúKTZX_ìú +^OZ2UTMúòø>øñ4K^Zú(GXúLXUSúKTZX_úòø2UTMøñú':öú2U]úíúò6ITZúðú'\M:X[K8GTMKòéêññú9ZUV!
/ZúOYúGúYOSVRKú_KZúVU]KXL[Rú +^OZ9NUXZúòø?øñ4K^Zú(GXúLXUSúKTZX_úòø9NUXZøñú':öú.OMNúïúò6ITZúðú'\M:X[K8GTMKòéêññú9ZUV!
ZKINTOW[KúZUú[YKìú
Finally, we will place a trailing stop for long positions at the lowest low of the last four bars.
Conversely, we will place a trailing stop to cover our short positions at the highest high of the
last four bars.
/Lú)UTJOZOUTçú'4*ú2U]ú"ú2U]KYZò2U]îúæñAéCúZNKT+^OZ2UTMú4K^Zú(GXúGZú3GXQKZ!
/Lú)UTJOZOUTéú'4*ú.OMNú$ú.OMNKYZò.OMNîúæñAéCúZNKT+^OZ9NUXZú4K^Zú(GXúGZú3GXQKZ!

-KTKXGRú9_YZKSú,UXSGZ
When we apply a system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified $10,000 as the trade size and 100 shares as the lot size.
Note: Remember that Commissions are calculated on a per contract/share basis. When you are
trading stocks, you would enter the average commission you are charged divided by the number
of shares the system is buying and selling.
Under the Stops tab, we enabled a % risk trailing stop. This type of stop enables you to indicate
what percent of the maximum open profit you are willing to give back before the position is
automatically closed out. The % risk trailing stop also requires that you specify a minimum
profit level that must be reached before the stop takes effect.
Note: When you are trading stocks and you choose the stop to be tracked on a per share
(contract) basis, you will type in the number of points you are willing to lose before you are
exited out. When you are trading futures or any instrument that has a different dollar-point
value, you would type the maximum number of dollars you are willing to risk per contract
traded.
In the Properties tab, we selected the Do not allow multiple entries in the same direction
option. If the system is in a long position and market conditions generate another long entry
order, the order is ignored. This is also the case when we’re in a short position and market
conditions generate another short entry order.
çèúúúúúúúúúú.KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

:KYZOTMúôú/SVXU\OTM
A winning percentage of 32 coupled with a ratio of average win to average loss of 2.59 is
marginally acceptable. Figure 8 shows the sample System Report for the Linear Regression
&Momentum System on a daily AT&T chart.

OM[XKúâìú9GSVRKú9_YZKSú8KVUXZúLUXúZNKú2OTKGXú8KMXKYYOUTúôú3USKTZ[Sú9_YZKSúGVVROKJúZUúGúJGOR_ú'Zô:úINGXZ

The system made $1.24 (the profit factor) for each dollar it lost. Unlike many of our systems
for stocks, this one actually made some money on the short side as well as the long side. The
Performance Summary also shows that the system stayed in winners an average of 33 bars
(letting profits run) but stayed in losers for only nine bars (cutting losses short).

9[MMKYZOUTúLUXú/SVXU\KSKTZ
As we scrolled through the years of AT&T daily data, we noticed that many of the buy signals
that turned out to be losses occurred when the smoothed linear regression line was rising (as
required in this system), but when prices were below the line. Similarly, many of the signals to
sell short that ended up losers occurred when the smoothed linear regression line was falling (as
required), but when prices were above the line.
We would like to see what happens to this system’s performance when we strengthen the entry
requirement to include that prices must be above the smoothed linear regressions line for a buy
and below the line for a sell. (Note in Figure 7 that both profitable long entries were executed
above the smoothed linear regression line.)

.KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú9_YZKS
The Herrick Payoff Index (HPI) is a complex formula that evaluates changes in price, volume,
and open interest. HPI measures the flow of money into and out of a market.
Because its calculation includes open interest, HPI can only be used for futures and not for
stocks. Another restriction of the HPI is that it can only be applied to daily data because there
is no such thing as intraday or weekly open interest.
HPI can be used to confirm price action. When HPI rallies to a new high along with a new price
high, volume (the number of contracts that change hands during a specified time period) and
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY .KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú9_YZKSúúúúúúúúúúçç

open interest are confirming the bullish price action, and when HPI falls to a new low along
with a new low in price, volume and open interest are confirming the bearish price action.
However, when a new price high is accompanied by the failure of HPI to also make a new high,
=NGZúOYú5VKTú/TZKXKYZ%ú5VKTú
OTZKXKYZúOYúZNKúT[SHKXúULúL[Z[XKYú the price action is not confirmed by volume and open interest. A bearish divergence exists
IUTZXGIZYúU[ZYZGTJOTMúGZúZNKúKTJúULú between the higher price high and the lower HPI high. Similarly, when a new price low is not
GúZXGJOTMúJG_ìú matched by a new HPI low, the price action is unconfirmed by volume and open interest, and a
condition of bullish divergence exists.
5VKTúOTZKXKYZúOTIXKGYKYúUXú
JKIXKGYKYúGYúZXGJKXYúZGQKúTK]ú Bullish and bearish divergences are early warning signs of a possible change in trend. HPI
VUYOZOUTYúOTúGúSGXQKZúUXúK^OZúLXUSúURJú confirmation of new price highs and new price lows suggests that the current trend is more
VUYOZOUTYìú likely to continue than to reverse.

5VKTúOTZKXKYZúOTIXKGYKYú]NKTúGú Another component of this system is the channel breakout on close. When a market closes above
H[_KXúGTJúGúYKRRKXúZGQKúTK]úVUYOZOUTYú the highest high of a specified number of bars, price action is bullish, and when a market closes
OTúGúSGXQKZìú5VKTúOTZKXKYZú below the lowest low of a specified number of bars, the market is bearish.
JKIXKGYKYú]NKTúGúZXGJKXú]NUúOYúRUTMú
GTJúGúZXGJKXú]NUúOYúYNUXZúSGQKúGú A system combining the Channel Breakout on Close Indicator and the Herrick Payoff Index
ZXGJKúZUúK^OZúZNKOXúVUYOZOUTYì should alert us to good trading opportunities. After a bullish setup, we’ll enter long at the high
of the setup bar plus one point, and after a bearish setup, we’ll enter short at the low of the setup
bar minus one point. The setup remains in effect for five days after the setup bar.
Figure 9 shows a daily Coffee chart with this system applied along with the HPI Indicator (built
into TradeStation).

OM[XKúáìú.KXXOIQú6G_ULLú/TJK^úGVVROKJúZUúGúJGOR_ú)ULLKKúINGXZú

Our initial stop and trailing stop when long will be at the four-day low, and our initial stop and
trailing stop when short will be at the four-day high. We’ll exit long positions on the close when
HPI crosses below zero and exit short positions on the close when HPI crosses above zero.

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined both long entries and short entries as well as exit orders. We also did
some setup work to calculate the Channel Breakout on Close Indicator and the Herrick Payoff
Index, as well as their to compare them. The setup, entries and exits are described next.
çæúúúúúúúúúú.KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

9KZ[V
a) Calculate the HPI values.
b) Look for confirmation of bearish price action by consistency between the closing price and
the HPI. The closing price will be lower than the lowest low of the last 10 bars and the HPI will
be lower than the lowest HPI of the last 10 bars. This is our sell setup.
c) Look for confirmation of bullish price action by consistency between the closing price and
the HPI. The closing price will be higher than the highest high of the last 10 bars and the HPI
will be higher than the highest HPI of the last 10 bars. This is our buy setup.

2UTMú+TZXOKY
a) After a bullish or buy setup, we’ll enter long at the high of the setup bar plus one point.This
setup will remain in effect for five days after the setup bar.

9NUXZú+TZXOKYú
b) After a bearish or sell setup, we’ll enter short at the low of the setup bar minus one point.
This setup will remain in effect for five days after the setup bar.

+^OZú5XJKXYú
a) Our initial stop and trailing stop when long will be at the 4-day low, and our initial stop and
trailing stop when short will be at the 4-day high.
b) We’ll also exit long positions on the close when HPI crosses below zero and exit short
positions on the close when HPI crosses above zero.

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.

+GY_2GTM[GMKú/TYZX[IZOUTY ú.KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú
ò9:'*úæ ú.KXXOIQë(XKGQñ

/TV[ZY ú3[RZòéêêñîú,GIZUXòìéñîú2KTMZNòéêñ!
<GXY ú.6/<GRòêñîú)U[TZ2òåñîú)U[TZ9òåñ!
a.6/úIGRI[RGZOUTúGTJú9_YZKSúIXOZKXOGúGYYOMTSKTZYúZUú\GXOGHRKYc
.6/<GRú#ú.6/ò3[RZîú,GIZUXñ!
)UTJOZOUTéú#ú)RUYKú$ú.OMNKYZò.OMNîú2KTMZNñAéC!
)UTJOZOUTèú#ú.6/<GRú$ú.OMNKYZò.6/<GRîú2KTMZNñAéCú'4*ú.6/<GRú$úê!
)UTJOZOUTçú#ú)RUYKú"ú2U]KYZò2U]îú2KTMZNñAéC!
)UTJOZOUTæú#ú.6/<GRú"ú2U]KYZò.6/<GRîú2KTMZNñAéCú'4*ú.6/<GRú"úê!
a'II[S[RGZKYúZUúIU[TZúZNKúHGXYúGLZKXúZNKú9KZ;VYúHKRU]c
)U[TZ2ú#ú)U[TZ2úïúé!
)U[TZ9ú#ú)U[TZ9úïúé!
a9_YZKSú+TZX_ú9KZ;VYc
/Lú)UTJOZOUTéú'4*ú)UTJOZOUTèú'4*ú)U[TZ2ú$úåúZNKT)U[TZ2ú#úé!
/Lú)UTJOZOUTçú'4*ú)UTJOZOUTæú'4*ú)U[TZ9ú$úåúZNKT)U[TZ9ú#úé!
a9_YZKSú+TZXOKYúOLúZNK_úGXKú]OZNOTúåúHGXYúULúZNKúYKZ[VYc
/,ú)U[TZ2ú"#úåú:NKT
([_ú4K^Zú(GXúGZú.OMNA)U[TZ2Cúïúéú6UOTZú9ZUV!
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY .KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú9_YZKSúúúúúúúúúúçå

/,ú)U[TZ9ú"#úåú:NKT
9KRRú4K^Zú(GXúGZú2U]A)U[TZ9Cúíúéú6UOTZú9ZUV!
a:XGOROTMú9ZUVYc
+^OZ2UTMú4K^Zú(GXúGZú2U]KYZò2U]îúæñú9ZUV!
+^OZ9NUXZú4K^Zú(GXúGZú.OMNKYZò.OMNîúæñú9ZUV!
a9_YZKSú9ZUVYc
/,ú.6/<GRú"úêú:NKT+^OZ2UTMú:NOYú(GXúUTú)RUYK!
/,ú.6/<GRú$úêú:NKT+^OZ9NUXZú:NOYú(GXúUTú)RUYK!

/TV[ZY
Following is the list of all the inputs we used in this system:

Input Default Description

Mult 100 The contract value of a 1 cent move in the underlying asset.
Factor .1 Smoothing factor, used to smooth the HPI.

Length 10 Length, expressed in bars, used to calculate the x-bar highs and
lows as well as the Herrick Payoff Index.

In addition to these inputs, we define the following variables (notice that our variables )U[TZ2
and )U[TZ9 are initialized to 5):
<GXY ú.6/<GRòêñîú)U[TZ2òåñîú)U[TZ9òåñ!

9KZ[V
We begin by calculating the HPI value using the .6/ function and a contract value of 100 and a
smoothing factor of .1. We store the resulting value in the variable .6/<GR.
.6/<GRú#ú.6/ò3[RZîú,GIZUXñ!
Then we perform four comparisons and store the results in four different variables, )UTJOZOUTé
through )UTJOZOUTæ. First, we check to see if the close of the current bar is greater than the highest
high of the last 10 bars. We store the result in )UTJOZOUTé. Then we check to make sure the value
in .6/<GR is greater than the highest .6/<GR value for the last 10 bars and make sure .6/<GR is
greater than zero. The result is stored in )UTJOZOUTè.
Next we check to see if the close of the current bar is less than the lowest low of the last 10 bars.
We store the result in )UTJOZOUTç. And finally, we check to see if .6/<GR is less than the lowest
.6/<GR value for the last 10 bars and make sure .6/<GR is less than zero. The result is stored in
)UTJOZOUTæ.
)UTJOZOUTéú#ú)RUYKú$ú.OMNKYZò.OMNîú2KTMZNñAéC!
)UTJOZOUTèú#ú.6/<GRú$ú.OMNKYZò.6/<GRîú2KTMZNñAéCú'4*ú.6/<GRú$úê!
)UTJOZOUTçú#ú)RUYKú"ú2U]KYZò2U]îú2KTMZNñAéC!
)UTJOZOUTæú#ú.6/<GRú"ú2U]KYZò.6/<GRîú2KTMZNñAéCú'4*ú.6/<GRú"úê!
We use two counters, )U[TZ2 and )U[TZ9. We increment these with each bar and reset them to 1
each time a buy setup or sell setup occurs, respectively. This way, we can keep a count and use
them to keep buy and sell orders active for 5 bars:
)U[TZ2ú#ú)U[TZ2úïúé!
)U[TZ9ú#ú)U[TZ9úïúé!
çäúúúúúúúúúú.KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

If the criteria specified in the conditional statements above, as appropriate, are true and the
variables )U[TZ2 or )U[TZ9 is greater than 5, then )U[TZ2 or )U[TZ9 is reset to one. Since the buy
or sell setup criteria is true, we want to place buy or sell orders, respectively, therefore, we need
to set the counters to 1 so the next set of instructions are carried out.
/Lú)UTJOZOUTéú'4*ú)UTJOZOUTèú'4*ú)U[TZ2ú$úåúZNKT)U[TZ2ú#úé!
/Lú)UTJOZOUTçú'4*ú)UTJOZOUTæú'4*ú)U[TZ9ú$úåúZNKT)U[TZ9ú#úé!

2UTMúôú9NUXZú+TZXOKY
If the )U[TZ2 variable is less than or equal to 5, a buy stop order is generated at the high of the
setup bar plus 1 point. If the )U[TZ9 variable is less than or equal to 5, a sell stop order is
generated at the low of the setup bar minus 1 point.
/Lú)U[TZ2ú"#úåúZNKTú([_ú4K^Zú(GXúGZú.OMNA)U[TZ2Cúïúéú6UOTZú9ZUV!
/Lú)U[TZ9ú"#úåúZNKT9KRRú4K^Zú(GXúGZú2U]A)U[TZ9Cúíúéú6UOTZú9ZUV!

2UTMúôú9NUXZú+^OZY
A trailing stop for long positions will be placed at the lowest low of the last four bars.
Conversely, we will place a trailing stop to cover our short positions at the highest high of the
last four bars.
+^OZ2UTMú4K^Zú(GXúGZú2U]KYZò2U]îúæñú9ZUV!
+^OZ9NUXZú4K^Zú(GXúGZú.OMNKYZò.OMNîúæñú9ZUV!
Additionally, the system will generate a long exit on the close of the current bar if the HPI value
falls below zero. A short exit on the close of the current bar will be generated if the HPI value
rises above zero.
/Lú.6/<GRú"úêúZNKT+^OZ2UTMúZNOYúHGXúUTú)RUYK!
/Lú.6/<GRú$úêúZNKTú+^OZ9NUXZúZNOYúHGXúUTú)RUYK!

-KTKXGRú9_YZKSú,UXSGZ
When we apply a system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified 1 as the default contract size to trade.
Note: Remember that Commissions are calculated on a per contract basis. When you are
trading commodities, you would enter the average commission you are charged divided by the
number of contracts the system is buying and selling.
Under the Stops tab, we enabled a money management stop. Our trailing stop for this system
will be at the four-bar low when long and at the four bar high when short.
Note: When you are trading futures or any instrument that has a different dollar-point value,
you would type the maximum number of dollars you are willing to risk per contract traded.
In the Properties tab, we selected the Do not allow multiple entries in the same direction
option. If the system is in a long position and market conditions generate another long entry
order, the order is ignored. This is also the case when we’re in a short position and market
conditions generate another short entry order.
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY .KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú9_YZKSúúúúúúúúúúçã

:KYZOTMúôú/SVXU\OTM
The Performance Summary in Figure 10 shows a large net profit of over $67,000 per contract.

,OM[XKúéêìú9GSVRKú9_YZKSú8KVUXZúLUXúU[XúY_YZKSúGVVROKJúZUúGúJGOR_ú)ULLKKúINGXZú

The other performance numbers are good also with 42% profitable trades, a ratio of average win
to average loss of 2.29, and a profit factor of 1.69. Maximum drawdown is high at $20,756.25,
or 30% of the total net profit.
An even more serious potential problem is that the largest winning trade ($30,825) comprises
such a big percentage (46%) of the total net profit. If we were to subtract the largest winning
trade from this system’s track record, would the results still encourage us to trade the system?
In this extreme example, no.
çâúúúúúúúúúú.KXXOIQú6G_ULLú/TJK^úôú)NGTTKRú(XKGQU[ZúUTú)RUYKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

We optimized for the best number of bars to include in the Channel Breakout on Close Indicator,
testing the values from 2 through 8 in increments of one. Figure 11 shows the resulting
Optimization Report.

,OM[XKúééìú5VZOSO`GZOUTú8KVUXZúLUXúUVZOS[SúT[SHKXúULúHGXYúZUú[YKúOTúINGTTKRúHXKGQU[Zú

The 5-bar breakout yielded the best results with the largest net profit and profit factor (tied with
the six-bar breakout), and the second best average trade. The bar graph of the net profits is
picture-perfect, as shown in Figure 12, with the optimal value of five in the center of the range
of values, and descending profits for the values to its left and right.

,OM[XKúéèìú(GXúMXGVNú\OK]úULúZNKúGHU\Kú5VZOSO`GZOUTú8KVUXZúú
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY )UTYKI[ZO\Kú)RUYKú9_YZKSúúúúúúúúúúçá

9[MMKYZOUTYúLUXú/SVXU\KSKTZ
The System Equity Indicator in Figure 13 shows how profits in the Coffee market soared during
the major uptrend.

,OM[XKúéçìú9_YZKSú+W[OZ_ú/TJOIGZUXúGVVROKJúZUúZNKúINGXZú

Since we wouldn’t really be excited about trading the system without that one great trade, we
know that we’ll have to improve this system before we’ll have confidence in it.
One possibility for improvement has more to do with the markets we trade than with this
particular system. Perhaps we could apply a “trendiness” indicator such as the ADX (Average
Directional Index) to a list of the commodities we are thinking about trading and selecting only
those that historically have displayed the greatest tendency to trend.

)UTYKI[ZO\Kú)RUYKú9_YZKS
To try something different from most of our previous STAD Club systems, we decided to write
a system with an entry based on a very simple chart pattern and an exit based on a profit target
rather than on the reversal of an indicator.
The chart pattern for a long setup begins with at least three consecutive up closes. This
condition should tell us that the short-term trend is up. However, three consecutive up closes
may also suggest that the market may be a bit overextended and due for a correction. Therefore,
after three consecutive up closes, we’ll wait for a down close. Our idea is that the down close
should alleviate the market’s short-term overbought condition and complete the setup.
Therefore, our buy setup is the three up close/one down close pattern and we’ll place a long
entry when the price moves above the open of the bar that follows our setup. We’ll enter long
on the bar after the setup at the open plus 25% of the 8-bar average true range.
Once we initiate a new long position, we’ll place our protective stop at the 10-bar low. Then,
as the market trades higher, we’ll trail a % risk trailing stop.
Our exit for the Consecutive Close System is unusual. We’ll exit at the open of the next bar once
two bars have closed above the high of the three up close/one down close pattern. In other
words, after we buy, we’ll wait for the market to post two opens above the high of the setup
æêúúúúúúúúúú)UTYKI[ZO\Kú)RUYKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

pattern, and we’ll exit on the next open. Our thinking behind this exit strategy is that since the
setup and entry are based on short-term price action, the exit should be as well. Figure 14 shows
the chart pattern we look for to initiatie a long position:

,OM[XKúéæìú)NGXZúVGZZKXTú]K©XKúRUUQOTMúLUXúZUúOTOZOGZKúGúRUTMúVUYOZOUT

Let’s take a look at the short side of our system. The chart pattern for a short setup begins with
at least three consecutive down closes. This condition indicates that the short-term trend is
down. However, three consecutive down closes may also indicate that the market is susceptible
to a correction. Therefore, after three consecutive down closes, we’ll wait for an up close. The
up close should cancel the market’s short-term oversold condition.
Therefore, our sell setup is the three down close/one up close pattern and we’ll place a short
entry when the price moves below the open of the bar that follows the setup. We’ll enter the
market short on the bar after the setup at the open minus 25% of the 8-bar average true range.
After we take a short position, we’ll set our protective stop at the 10-bar high. Then, as the
market trades lower, we’ll trail a % risk trailing stop. We’ll exit on the open after the second
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY )UTYKI[ZO\Kú)RUYKú9_YZKSúúúúúúúúúúæé

consecutive close below the low of the setup pattern. Figure 15 illustrates the short side of the
system:

,OM[XKúéåìú)NGXZúVGZZKXTú]K©XKúRUUQOTMúLUXúZUúOTOZOGZKúGúYNUXZúVUYOZOUT

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined both long entries and short entries as well as exit orders. The entries
and exits are described next:

2UTMú+TZXOKY
a) We look for three up closes and a subsequent down close. This is our buy setup. We place a
buy stop order on the bar after the setup at the open plus 25% of the 8-bar average true range.

9NUXZú+TZXOKYú
a) We look for three consecutive down closes and a subsequent up close. This is our sell setup.
We place a sell stop order on the bar after the setup at the open minus 25% of the 8-bar average
true range.

+^OZú5XJKXYú
a) Once we initiate a position, we’ll place our protective stop at the 10-bar low and 10-bar high
for long and short positions, respectively.
b) After we buy, we’ll wait for the market to post two opens above the high of the setup pattern,
and we’ll exit on the subsequent open.
c) After we take a short position, we’ll wait for the market to post two closes below the low of
the setup pattern, and we’ll exit on the subsequent open.

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
æèúúúúúúúúúú)UTYKI[ZO\Kú)RUYKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

+GY_2GTM[GMKú/TYZX[IZOUTY ú)UTYKI[ZO\Kú)RUYKúò9:'*úæ ú)RUYKú6GZZKXTñ

/TV[Z ú4[S;V(GXòçñîú4[S*T(GXòçñîú'\M2KTòâñîú6ITZòìèåñ!
<GXY ú..òêñîú22òêñîú2)U[TZòêñîú9)U[TZòêñ!
a/JKTZOL_OTMúZNKúIUTYKI[ZO\KúIRUYKúVGZZKXTúGTJúVRGIOTMúGúH[_úUXJKXc
/Lú385òú)RUYKú"ú)RUYKAéCîú4[S;V(GXîúéñAéCú#úíéúGTJú)RUYKú"ú)RUYKAéCúZNKTú(KMOT
([_úGZú5VKTúTK^ZúHGXúïú'\KXGMKò:X[K8GTMKîú'\M2KTñð6ITZú9ZUV!
..ú#ú.OMNKYZò.OMNîú4[S;V(GXúïúéñ!
+TJ!
a/JKTZOL_OTMúZNKúIUTYKI[ZO\KúIRUYKúVGZZKXTúGTJúVRGIOTMúGúYKRRúUXJKXc
/Lú385òú)RUYKú$ú)RUYKAéCîú4[S*T(GXîúéñAéCú#úíéúGTJú)RUYK$)RUYKAéCúZNKTú(KMOT
9KRRúGZú5VKTúTK^ZúHGXúíú'\KXGMKò:X[K8GTMKîú'\M2KTñð6ITZú9ZUV!
22ú#ú2U]KYZò2U]îú4[S*T(GXúïúéñ!
+TJ!
a+^OZúIXOZKXOGúHGYKJúUTúYNUXZúZKXSúVXOIKúGIZOUTc
/Lú3GXQKZ6UYOZOUTú"$úéúZNKT2)U[TZú#úê!
/Lú3GXQKZ6UYOZOUTú"$úíéúZNKT9)U[TZú#úê!
/Lú3GXQKZ6UYOZOUTú#úéúGTJú5VKTúTK^ZúHGXú$ú..úZNKTú(KMOT
2)U[TZú#ú2)U[TZúïúé!
/Lú2)U[TZú#úèúZNKTú+^OZ2UTMúTK^ZúHGXúGZú5VKT!
+TJ!
/Lú3GXQKZ6UYOZOUTú#úíéúGTJú)RUYKú"ú22úZNKTú(KMOT
9)U[TZú#ú9)U[TZúïúé!
/Lú9)U[TZú#úèúZNKT +^OZ9NUXZúTK^ZúHGXúGZú5VKT!
+TJ!
a6XUZKIZO\KúYZUVYc
+^OZ9NUXZúTK^ZúHGXúGZú.OMNKYZò.OMNîéêñú9ZUV!
+^OZ2UTMúTK^ZúHGXúGZú2U]KYZò2U]îéêñú9ZUV!

/TV[ZY
Following is the list of all the inputs we used in this system:

Input Default Description

NumUpBar 3 Number of up closes that are required for a buy setup.

NumDnBar 3 Number of down closes that are required for a sell setup.
AvgLen 8 Length, expressed in bars, used to calculate the average true
range.

Pcnt .25 Percentage used to calculate the value of the entries and exits.

In addition to these inputs, we define the following variables:


<GXY ú..òêñîú22òêñîú2)U[TZòêñîú9)U[TZòêñ!

2UTMú+TZXOKY
We used the Most Recent Occurrence (385) function is used to determine if there were any
down closes in the last 3 bars, not including the current bar. The function returns the number of
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY )UTYKI[ZO\Kú)RUYKú9_YZKSúúúúúúúúúúæç

the bar on which the down close most recently occurred. If no down closes are found, the 385
function returns a -1.
Therefore, if a down close has not occurred in the last 3 bars, and the current close is greater
than the close of the previous bar, we place a buy stop order at the open of the next bar plus a
percentage 2% of the 8-bar average of the true range. Also, we set the variable .. to the highest
high of the last 4 bars. We’ll use the value in .. in our exit criteria.
/Lú385òú)RUYKú"ú)RUYKAéCîú4[S;V(GXîúéñAéCú#úíéúGTJú)RUYK")RUYKAéCúZNKTú(KMOT
([_úGZú5VKTúTK^ZúHGXúïú'\KXGMKò:X[K8GTMKîú'\M2KTñúðú6ITZú9ZUV!
..ú#ú.OMNKYZò.OMNîú4[S;V(GXúïúéñ!
+TJ!

9NUXZú+TZXOKY
Like with the long entries, we again use the 385 function to determine if there have been any
up closes in the last 4 bars. If an up close has not occurred and the current close is less than the
close of the previous bar, we place a sell stop at the open of the next bar minus 25% of the 8-
bar average of the true range. Also, the lowest low of the last 4 bars is stored in the variable 22.
We’ll use the value in 22 in our exit criteria.
/Lú385òú)RUYKú$ú)RUYKAéCîú4[S*T(GXîúéñAéCú#úíéúGTJú)RUYK$)RUYKAéCúZNKTú(KMOT
9KRRúGZú5VKTúTK^ZúHGXúíú'\KXGMKò:X[K8GTMKîú'\M2KTñð6ITZúYZUV!
22ú#ú2U]KYZò2U]îú4[S*T(GXúïúéñ!
+TJ!

2UTMúôú9NUXZú+^OZY
If the current market position is short or flat, the variable 2)U[TZ is re-set to 0.
/Lú3GXQKZ6UYOZOUTú"$úéúZNKTú2)U[TZú#úê!
If the current market position is long or flat, the variable 9)U[TZ is re-set to 0.
/Lú3GXQKZ6UYOZOUTú"$úíéúZNKTú9)U[TZú#úê!
If the current market position is long and the next bar’s open is greater than the value stored in
.., then the 2)U[TZ variable is accumulated by one. If these conditions exist and 2)U[TZ holds
a value of 2, meaning that the open has been higher than the value in .. for two bars now, we
exit our long position at the open of the next bar.
/Lú3GXQKZ6UYOZOUTú#úéúGTJú5VKTúTK^ZúHGXú$ú..úZNKTú(KMOT
2)U[TZú#ú2)U[TZúïúé!
/Lú2)U[TZú#úèúZNKT+^OZ2UTMúTK^ZúHGXúGZúUVKT!
+TJ!
If the current market position is short and the next bar’s close is less than the value stored in 22,
then the 9)U[TZ variable is accumulated by one. If these conditions exist and 9)U[TZ holds a
value of 2, meaning that the close has been less than the value in 22 for two bars now, we exit
our short position at the open of the next bar.
/Lú3GXQKZ6UYOZOUTú#úíéúGTJú)RUYKú"ú22úZNKTú(KMOT
9)U[TZú#ú9)U[TZúïúé!
/Lú9)U[TZú#úèúZNKT
+^OZ9NUXZúTK^ZúHGXúGZú5VKT!
+TJ!
Finally, we will use the highest high and lowest low of the last 10 bars as a trailing stop.
+^OZ9NUXZúTK^ZúHGXúGZú.OMNKYZò.OMNîéêñú9ZUV!
+^OZ2UTMúTK^ZúHGXúGZú2U]KYZò2U]îéêñú9ZUV!
ææúúúúúúúúúú)UTYKI[ZO\Kú)RUYKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

-KTKXGRú9_YZKSú,UXSGZ
When we apply a system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified $10,000 as the trade size and 100 shares as the lot size.
Note: Remember that Commissions are calculated on a per contract/share basis. When you
are trading stocks, you would enter the average commission you are charged divided by the
number of shares the system is buying and selling.
We did not enable a money management stop, but we did enable a % risk trailing stop for this
system. Our initial protective stop for a long position is set at the 4-bar low; our initial stop for
a short position is set at the 4-bar high.
In the Properties tab, we selected the option Do not allow multiple entries in the same
direction. If the system is in a long position, and market conditions generate another long entry
order, the order is ignored. This is also the case when we’re in a short position, and market
conditions generate another short entry order.

:KYZOTMúôú/SVXU\OTM
We applied this system to a daily chart of Coca-Cola from 1970 - 1998. Sixty-five percent of
the trades were profitable. The profit factor was 2.19, meaning that the system made $2.19 in
profits for each dollar it lost. Figure 16 shows the resulting sample System Report.

,OM[XKúéäìú9GSVRKú9_YZKSú8KVUXZúLUXúZNKú)UTYKI[ZO\Kú)RUYKú9_YZKSúUTúGúJGOR_úINGXZúULú)UIG)URG

Next we tested this system with the same parameters on a continuation chart of the CRB Index
futures contract. Figure 17 shows the resulting chart.
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY )UTYKI[ZO\Kú)RUYKú9_YZKSúúúúúúúúúúæå

,OM[XKúéãìú:NKú)UTYKI[ZO\Kú)RUYKú9_YZKSúGVVROKJúZUúGú)8(ú/TJK^úL[Z[XKYúIUTZXGIZ

The CRB (Commodity Research Bureau) Index, which represents a basket of 21 major
commodities, is widely monitored as an early warning sign of inflation. The system earned
$4,900 per contract. Sixty percent of the trades were profitable, and the system made money on
both the long and short sides of the market. Figure 18 shows the resulting System Report, the
Trade by Trade view.

,OM[XKúéâìú:NKúYGSVRKú9_YZKSú8KVUXZúLUXúZNKú)UTYKI[ZO\Kú)RUYKú9_YZKSúGVVROKJúZUúZNKú)8(ú/TJK^úL[Z[XKYúIUTZXGIZ
æäúúúúúúúúúú3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

9[MMKYZOUTYúLUXú/SVXU\KSKTZ
We like this system enough to wish it generated more trades. Perhaps it would be worthwhile
to test it on intraday bars, e.g. a 5-minute S&P futures chart.
Another possible improvement would be to apply a longer-term moving average (40 - 60 bars)
and only take the trades in the direction of the slope of the moving average.

3USKTZ[Sí8KZXGIKSKTZú9_YZKS
The Momentum-Retracement System demonstrates a way of trading within an established
trend. The system consists of seven components: 1) trend, 2) momentum, 3) directional
movement, 4) retracements, 5) entries, 6) stops, and 7) exits.
The first step in applying the Momentum-Retracement System is to determine the trend. We use
a moving-average channel and the MACD Indicator to accomplish this task.
The moving-average channel includes exponential moving averages of 15 highs, 15 lows, and
5 closes. The trend is up when the 5-bar exponential average of the closes is above 15-bar
exponential average of the highs, or when the 5-bar exponential moving average of the closes
is above the 15-bar exponential moving average of the highs more recently than it was below
the 15-bar exponential moving average of the lows.
Conversely, the trend is down when 5-bar exponential average of the closes is below the 15-bar
exponential average of the lows or when the 5-bar exponential average of the closes was below
15-bar exponential average of the lows more recently than it was above 15-bar exponential
average of the highs.
The MACD Indicator must confirm the trend identified by the moving-average channel. We use
a 3-10-15 MACD. This means that the MACD line represents the difference between a 3-bar
and a 10-bar exponential moving average, and that the signal line of the indicator is a 15-bar
exponential moving average of the MACD line. When the signal line is above zero, the trend is
up, and when the signal line is below zero, the trend is down.
The second step is to evaluate the market’s momentum. In this system, we use the Relative
Strength Index (RSI). RSI compares the relative strength of price gains on bars that close above
the previous bar’s close to price losses on bars that close below the previous bar’s close. A
5-bar RSI rising to 70 or higher signifies strong bullish momentum, and the RSI falling to 30 or
lower indicates strong bearish momentum.
The third step is to measure the market’s directional movement. In this system, we use the
Directional Movement Index (DMI). DMI consists of two lines — the DMIPlus line and the
DMIMinus line. These two lines represent the amount of consistent bullish “trendiness” and
consistent bearish “trendiness” respectively. We construct an indicator called the DMI Spread
by subtracting the DMIMinus line from the DMIPlus line. A DMI spread of +15 or higher
indicates a persistent uptrend, and a DMI spread of -15 or lower indicates a persistent
downtrend.
The fourth step is to identify a retracement. A retracement refers to a countertrend decline in an
uptrend or a countertrend rally in a downtrend. In this system, we specify three conditions that
must be met for a qualifying retracement. In an uptrend, the three conditions are: 1) Prices
decline into the moving-average channel (in other words, the low of a price bar crosses below
the exponential moving average of 15 highs), 2) MACD crosses below the signal line, and 3)
RSI declines from above 70 to below 50 or declines by at least 30 RSI points.
In a downtrend, the three conditions are: 1) Prices rally into the moving-average channel (i.e.,
the high of a price bar crosses above the exponential moving average of 15 lows), 2) MACD
crosses above the signal line, and 3) RSI rises from below 30 to above 50 or rises by at least 30
RSI points.
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúúæã

These three conditions for retracements do not have to occur on the same bar. The requirement
is that all three conditions occur within 10 bars of the highest high (in an uptrend) or within 10
bars of the lowest low (in a downtrend).
The fifth step is to determine the entry price. After a qualified retracement in an uptrend, we
enter a long position when prices rally one third of the way back up between the low of the
retracement and the high of the uptrend. For example, if the high of the uptrend is 124, and the
low of the retracement is 112, we will set our buy stop at 116 (one third of the way back up).
After a qualified retracement in a downtrend, we enter a short position when prices fall one third
of the way back down between the high of the retracement and the low of the downtrend. For
example, if the low of the downtrend is 112, and the high of the retracement is 124, we will set
our sell stop at 120 (one third of the way back down).
The setup for a buy entry is canceled if the exponential moving average of 5 closes crosses
below the exponential moving average of 15 lows or if the signal line of the MACD crosses
below zero. The setup to sell short is canceled if exponential moving average of 5 closes crosses
above the exponential moving average of 15 highs or if the signal line of the MACD crosses
above zero.
The sixth step is to determine our initial protective stop, our breakeven stop, and our trailing
stop. For a long position, the initial protective stop is set one 10-bar average true range below
our entry price; for a short position, the initial stop is set a 10-bar average true range above our
entry price.
We move our stop to breakeven after a closing price that gives us an open profit equal to or
greater than the initial risk on the trade. For example, if we bought a stock at $80 and set our
initial stop at $77, we would raise our stop to $80 (breakeven) after a close of $83 or higher.
We’ll also place a profit-protect trailing stop. For a long position, we watch two trailing stops
and place our profit-protect order at the higher of the two stops. The first stop is swing support
to the power of two, which is defined as a price low that has at least two higher lows
immediately before it and at least two higher lows immediately after it. The second stop is the
exponential moving averages of 15 lows. Remember that we will place our stop at the higher of
the two possibilities.
For a short position, we also watch two trailing stops and place our profit-protect order at the
lower of the two stops. The first stop is swing resistance to the power of two, which can be
defined as a price high that has at least two lower highs immediately before it and after it. The
second stop is the exponential moving averages of 15 highs. We will place our stop at the lower
of the two alternatives.
The seventh step is the exit. We exit from a long position on the next open when both the signal
line of the MACD and the DMI spread fall below zero; we exit from a short position on the next
æâúúúúúúúúúú3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

open when both the MACD signal line and the DMI spread rally above zero. Figure 19 shows
the Momentum-Retracement System applied to a weekly chart of General Electric.

,OM[XKúéáìú:NKú3USKTZ[Sí8KZXGIKSKTZú9_YZKSúGVVROKJúZUúGú]KKQR_úINGXZúULú-KTKXGRú+RKIZXOI

Our Momentum-Retracement System is fairly long and complex compared to most of the
systems we have presented in the STAD Club so far. We believe, however, that the time you
devote to studying this system will be time well spent.

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined both long entries and short entries as well as exit orders. We also did
substantial setup work to calculate the moving average channel, momentum, and DMI. The
setup, entries and exits are described next:

9KZ[V
a) Calculate the 15-bar exponential moving averages of the highs and the lows and the 5-bar
exponential moving average of the closing prices.
b) Calculate a 15-bar exponential average of the MACD (based on 3 and 10 bars).
c) Calculate the difference between the exponential average of the MACD calculated in b) and
the underlying MACD.
d) Calculate the DMI spread by subtracting the DMI Minus from the DMI Plus, based on a
length of 15 bars.

2UTMú+TZXOKY
a) Determine the trend by comparing the exponential moving averages. The trend is up when:
the 5-bar exponential average of the closes is above 15-bar exponential average of the highs, or
when the 5-bar exponential moving average of the closes is above the 15-bar exponential
moving average of the highs more recently than it was below the 15-bar exponential moving
average of the lows.
b) Confirm the trend using the MACD. When the signal line is above zero, the trend is up.
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúúæá

c) Evaluate the momentum of the market using the RSI Indicator. A 5-bar RSI rising to 70 or
higher signifies strong bullish momentum.
d) Determine the persistence of the trend using the DMI Indicator. We construct an indicator
called the DMI Spread by subtracting the DMIMinus line from the DMIPlus line. A DMI spread
of +15 or higher indicates a persistent uptrend.
e) Check for a retracement. In an uptrend, the three conditions are: 1) Prices decline into the
moving-average channel (in other words, the low of a price bar crosses below the exponential
moving average of 15 highs), 2) MACD crosses below the signal line, and 3) RSI declines from
above 70 to below 50 or declines by at least 30 RSI points. These three conditions for
retracements do not have to occur on the same bar. The requirement is that all three conditions
occur within 10 bars of the highest high.

9NUXZú+TZXOKYú
a) Determine the trend by comparing the exponential moving averages. The trend is down when:
the 5-bar exponential average of the closes is below the 15-bar exponential average of the lows
or when the 5-bar exponential average of the closes was below 15-bar exponential average of
the lows more recently than it was above 15-bar exponential average of the highs.
b) Confirm the trend using the MACD. When the signal line is below zero, the trend is down.
c) Evaluate the momentum of the market using the RSI Indicator. A 5-bar RSI falling to 30 or
lower indicates strong bearish momentum.
d) Determine the persistence of the trend using the DMI Indicator. We construct an indicator
called the DMI Spread by subtracting the DMIMinus line from the DMIPlus line. A DMI spread
of -15 or lower indicates a persistent downtrend.
e) Check for a retracement. In a downtrend, the three conditions are: 1) Prices rally into the
moving-average channel (i.e., the high of a price bar crosses above the exponential moving
average of 15 lows), 2) MACD crosses above the signal line, and 3) RSI rises from below 30 to
above 50 or rises by at least 30 RSI points.
These three conditions for retracements do not have to occur on the same bar. The requirement
is that all three conditions occur within 10 bars of thelowest low.

+^OZú5XJKXYú
a) Place protective stops. For a long position, we’ll set the initial protective stop at our entry
price minus the 10-bar average true range; for a short position, we’ll set the initial stop at our
entry price plus a 10-bar average true range.
b) We’ll also place a profit-protect trailing stop:
1. For a long position, we’ll watch two trailing stops and place our profit-protect order at
the higher of the two stops. The first stop is swing support to the power of two, which is
defined as a price low that has at least two higher lows immediately before it and at least
two higher lows immediately after it. The second stop is one point below the exponential
moving averages of 15 lows. We will place our stop at the higher of the two possibilities.
2. For a short position, the first stop is swing resistance to the power of two, which can be
defined as a price high that has at least two lower highs immediately before it and after it.
The second stop is one point above the exponential moving averages of 15 highs. We will
place our stop at the lower of the two alternatives.
c) We exit from a long position on the next open when both the signal line of the MACD and
the DMI spread fall below zero; we exit from a short position on the next open when both the
MACD signal line and the DMI spread rally above zero.
åêúúúúúúúúúú3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.
We created this system in modules. We wrote the criteria for the long side of the Momentum-
Retracement System in one system (STAD 4: L Mom-Retrcmnt) and the criteria to follow the
short side of the Momentum-Retracement System in another (STAD 4: S Mom-Retrcmnt). Then
we created a third system that references the first and second system (STAD 4: Mom-Rtrcmnt).
You only need to apply the one system, STAD 4: Mom-Rtrcmnt.
In order to reference one system from another, we used the ‘IncludeSystem’ EasyLanguage
command. This command is very useful and commonly used. There are two main advantages to
using the ‘IncludeSystem’ command:
a) In TradeStation 4, each system can be a maximum of 64K in size. If your system is large,
it is possible to exceed this limit. One easy way to overcome this limit is to break your
system into one or more systems and then combine them using the ‘IncludeSystem’
command. Then, each system has 64K allocated to it.
b) You can use the ‘IncludeSystem’ command to include instructions that you use often.
For example, if there is an exit you use often, you can write it into a system and then include
it any time you want to use it in a system you are writing.
Following are the instructions for the main system. Notice how short it is. Notice also that we
defined inputs. You don’t have to, however, if you want to be able to modify the systems you
included, you have to define the inputs in the main system.

+GY_2GTM[GMKú/TYZX[IZOUTY ú3USKTZ[Sí8KZXGIKSKTZúò9:'*úæ ú3USí8ZXISTZñ

/TV[Z ú>3'2KTòåñîú2KTèòéêñ!

/TIR[JK9_YZKS ø9:'*æ 9ú3USí8KZXISTZøî>3'2+4î2+4è!


/TIR[JK9_YZKS ø9:'*æ 2ú3USí8KZXISTZøî>3'2+4î2+4è!
This system merges the two systems and converts them into one, so they can be applied as one
system on any given chart.
The EasyLanguage instructions for the long side of the Momentum-Retracement System are
listed next. The instructions for the short side of the Momentum-Retracement System are not
listed because they exactly mirror the long side instructions. The subsequent discussion also
covers the long side; however, the explanations can be applied to the short side, and of course,
the final main system is the two together.

+GY_2GTM[GMKú/TYZX[IZOUTY ú2UTMúYOJKúULúZNKú3USKTZ[Sí8KZXGIKSKTZ
ò9:'*úæ ú2ú3USí8KZXISTZñú

/TV[Z ú>3'2KTòåñîú2KTèòéåñ!
<GXY ú6XOIK>3'òêñîú.OMN>3'òêñîú2U]>3'òêñîú3')*9OM2OTKòêñîú3')**OLLòêñ!
<GXY ú:XKTJ;Vò,GRYKñîú3USKTZ[Sò,GRYKñîú8KZXGIKSKTZò,GRYKñîú+^OZ6XIòêñ!
<GXY ú.OMNKYZ.Oòêñîú.OMNKYZ89/òêñîú2U]KYZ2Uòááááááñîú([_9]OZINò,GRYKñ!
<GXY ú*3/9VXKGJòêñîú,GYKéò,GRYKñîú,GYKèò,GRYKñ!
a)GRI[RGZKúK^VUTKTZOGRúSU\OTMúG\KXGMKYîú3')*ú\GR[KYúGTJú*3/ú9VXKGJc
6XOIK>3'ú#ú>'\KXGMKò)RUYKî>3'2KTñ!
.OMN>3'ú#ú>'\KXGMKò.OMNî2KTèñ!
2U]>3'ú#ú>'\KXGMKò2U]îú2KTèñ!
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúúåé

3')*9OM2OTKú#ú>'\KXGMKòú3')*ò)RUYKîçîéêñîúéåñ!
3')**OLLú#ú3')*ò)RUYKîçîéêñúíú3')*9OM2OTK!
*3/9VXKGJú#ú*3/6R[Yòéåñúíú*3/3OT[Yòéåñ!
a*KZKXSOTKúZXKTJúGTJúSUSKTZ[Sc
:XKTJ;Vú#ú6XOIK>3'ú$ú.OMN>3'úGTJú3')*9OM2OTKú$úê!
3USKTZ[Sú#ú89/ò)RUYKîåñú$#úãêú'4*ú*3/9VXKGJú$úéå!
/Lú:XKTJ;VúGTJú3USKTZ[SúZNKTú(KMOT
/Lú,GYKéú#ú,GRYKúZNKTú(KMOT
.OMNKYZ.Oú#úê!
.OMNKYZ89/ú#úê!
+TJ!
,GYKéú#ú:X[K!
,GYKèú#ú,GRYK!
/Lú.OMNú$ú.OMNKYZ.OúZNKTú.OMNKYZ.Oú#ú.OMN!
/Lú89/ò)RUYKîåñú$ú.OMNKYZ89/úZNKT.OMNKYZ89/ú#ú89/ò)RUYKîåñ!
+TJ!
a)NKIQúLUXú8KZXGIKSKTZúGTJúKYZGHROYNú([_ú9KZ[Vc
8KZXGIKSKTZú#ú,GYKéú'4*ú6XOIK>3'ú"ú.OMN>3'ú'4*ú3')**OLLú"úêú'4*úò89/ò)RUYKîåñ"#åêú58
89/ò)RUYKîåñú"ú.OMNKYZ89/íçêñ!
/Lú8KZXGIKSKTZúZNKTú(KMOT
/Lú,GYKèú#ú,GRYKúZNKT2U]KYZ2Uú#úáááááá!
,GYKèú#ú:X[K!
,GYKéú#ú,GRYK!
([_9]OZINú#ú,GRYK!
+TJ!
/Lú,GYKèúZNKTú(KMOT
/Lú2U]ú"ú2U]KYZ2UúZNKT
2U]KYZ2Uú#ú2U]!
([_9]OZINú#ú:X[K!
+TJ!
a6RGIKúKTZX_úUXJKXúGTJúXKíYKZúY]OZINKYc
/Lú([_9]OZINúGTJú3GXQKZ6UYOZOUT"$úéúZNKTú(KMOT
([_úTK^ZúHGXúGZú2U]KYZ2Uúïúò.OMNKYZ.Oúíú2U]KYZ2Uúñëçú9ZUV!
+TJ!
/Lú3GXQKZ6UYOZOUTú#úéú58úò6XOIK>3'ú"ú2U]>3'úUXú3')*9OM2OTKú"úêñúZNKTú(KMOT
([_9]OZINú#ú,GRYK!
,GYKéú#ú,GRYK!
,GYKèú#ú,GRYK!
+^OZ2UTMúTK^ZúHGXúGZú3GXQKZ!
+TJ!
a9KZú:XGOROTMú9ZUVYúGTJú+^OZúUXJKXYc
/Lú3GXQKZ6UYOZOUTú"$úéúZNKT
+^OZ2UTMúTK^ZúHGXúGZú2U]úíú'\KXGMKò:X[K8GTMKîéêñú9ZUV
+RYK
+^OZ2UTMúTK^ZúHGXúGZú+TZX_6XOIKúíú'\KXGMKò:X[K8GTMKîúéêñú9ZUV!
/Lú9]OTM2U]òéî2U]îèîæñú#úçú'4*ú3GXQKZ6UYOZOUTú#úéúZNKT+^OZ6XIú#ú2U]AçC!
+^OZ6XIú#ú3OT2OYZò2U]>3'îú+^OZ6XIñ!
/Lú3GXQKZ6UYOZOUTú#úéúZNKT+^OZ2UTMúTK^ZúHGXúGZú+^OZ6XIú9ZUV!
åèúúúúúúúúúú3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

/TV[ZY
Following is the list of all the inputs we used in this system:

Input Default Description

XMALen 5 Length, expressed in bars, used to calculate the exponential


average of the closing prices.

Len2 15 Length, expressed in bars, used to calculate the exponential


average of the high prices.

In addition to these inputs, we define the following variables:


<GXY ú6XOIK>3'òêñîú.OMN>3'òêñîú2U]>3'òêñîú3')*9OM2OTKòêñîú3')**OLLòêñ!
<GXY ú:XKTJ;Vò,GRYKñîú3USKTZ[Sò,GRYKñîú8KZXGIKSKTZò,GRYKñîú+^OZ6XIòêñ!
<GXY ú.OMNKYZ.Oòêñîú.OMNKYZ89/òêñîú2U]KYZ2Uòááááááñîú([_9]OZINò,GRYKñ!
<GXY ú*3/9VXKGJòêñîú,GYKéò,GRYKñîú,GYKèò,GRYKñ!
9KZ[V
We begin by calculating the exponential averages. We use the function >'\KXGMK to calculate
the three averages we will be using.
6XOIK>3'ú#ú>'\KXGMKò)RUYKî>3'2KTñ!
.OMN>3'ú#ú>'\KXGMKò.OMNî2KTèñ!
2U]>3'ú#ú>'\KXGMKò2U]îú2KTèñ!
Then, we calculate the 15-bar expoential average of the MACD line and store the resulting value
in the variable 3')*9OM2OTKú(we’ll refer to this as the MACD signal line). We also subtract this
average from the MACD line itself and store this value in 3')**OLL (we’ll refer to this
differential as the MACD differential. It represents the nearness of the MACD line to its
smoothed average). Finally, we calculate the DMI spread and store this in the variable
*3/9VXKGJ.
3')*9OM2OTKú#ú>'\KXGMKòú3')*ò)RUYKîçîéêñîúéåñ!
3')**OLLú#ú3')*ò)RUYKîçîéêñúíú3')*9OM2OTK!
*3/9VXKGJú#ú*3/6R[Yòéåñúíú*3/3OT[Yòéåñ!
Once we have the values we need, we can begin our comparisons. As described, we want to
check for trend, momentum, directional movement and retracement. First, we look for a trend.
We check to make sure that the 5-bar average of the closing prices is greater than the 15-bar
average of the high prices and that the MACD signal line is greater than zero. We store the
resulting true or false value in the variable :XKTJ;V.
Then, we check the RSI to evaluate momentum. We use the 89/ function to check whether or
not the RSI (using the closing prices and 5 bars) is greater than or equal to 70, and then make
sure the DMI spread is greater than 15. We store the resulting value, true or false, in the variable
3USKTZ[S.
:XKTJ;Vú#ú6XOIK>3'ú$ú.OMN>3'úGTJú3')*9OM2OTKú$úê!
3USKTZ[Sú#ú89/ò)RUYKîåñú$#úãêú'4*ú*3/9VXKGJú$úéå!

2UTMú+TZXOKY
Once we have performed the comparisons, we check their values. If the trend is up and there is
strong bullish movement (RSI >= 70), then we do three things: First, if ,GYKé is False, then we
set our variables .OMNKYZ.O and .OMNKYZ89/ to zero. This will make sure we capture the current
bar’s high and RSI values in these variables. Second, we set the variable ,GYKé to True and the
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúúåç

variable ,GYKè to False. And three, we compare the high of the current bar to the value in
.OMNKYZ.O. If the high is greater, we store it in .OMNKYZ.O. Likewise, we compare the value of the
RSI to the value stored in .OMNKYZ89/ and store the greater value in .OMNKYZ89/.
We use the variables ,GYKé and ,GYKè essentially to keep track of what we consider two distinct
phases. The first phase is the up trend and the second phase is the retracement. As soon as we
begin the second phase, we consider the first phase over and set ,GYKé to False and set ,GYKè to
True, and vice versa.
/Lú:XKTJ;VúGTJú3USKTZ[SúZNKTú(KMOT
/Lú,GYKéú#ú,GRYKúZNKTú(KMOT
.OMNKYZ.Oú#úê!
.OMNKYZ89/ú#úê!
+TJ!
,GYKéú#ú:X[K!
,GYKèú#ú,GRYK!
/Lú.OMNú$ú.OMNKYZ.OúZNKTú.OMNKYZ.Oú#ú.OMN!
/Lú89/ò)RUYKîåñú$ú.OMNKYZ89/úZNKT.OMNKYZ89/ú#ú89/ò)RUYKîåñ!
+TJ!
Then, we check for a retracement. Four conditions must be true. First, ,GYKé must be true, which
means the trend is up and there is strong bullish movement, the 5-bar average of closing prices
must be less then the 15-bar average of the high prices, the MACD differential must be less than
zero, and one of the following must be true: the RSI is at or under 50 or the RSI is less than the
HighestRSI minus 30. If they are, then the variable 8KZXGIKSKTZ is set to True.
8KZXGIKSKTZú#ú,GYKéú'4*ú6XOIK>3'ú"ú.OMN>3'ú'4*ú3')**OLLú"úêú'4*ú
òú89/ò)RUYKîåñ"#åêúUX89/ò)RUYKîåñú"ú.OMNKYZ89/íçêúñ!
If there is a retracement then we do three things. First, if ,GYKè is False then we set the 2U]KYZ2U
variable to 999999 (this ensures that we will capture the low of the current bar in the variable
2U]KYZ2U in the next set of instructions). Second, we set the variable ,GYKè to True and set the
variable ,GYKé to False. Third, we set the variable ([_9]OZIN to False.
/Lú8KZXGIKSKTZúZNKTú(KMOT
/Lú,GYKèú#ú,GRYKúZNKT2U]KYZ2Uú#úáááááá!
,GYKèú#ú:X[K!
,GYKéú#ú,GRYK!
([_9]OZINú#ú,GRYK!
+TJ!
If ,GYKè is True, meaning that there was first an up trend and bullish market momentum and a
subsequent retracement, then we perform two actions: first, we check to make sure that the
current low is less than the 2U]KYZ2U. If it is, then we’ll store it in the variable 2U]KYZ2U. And
second, we set the variable ([_9]OZIN to True.
/Lú,GYKèúZNKTú(KMOT
/Lú2U]ú"ú2U]KYZ2UúZNKT
2U]KYZ2Uú#ú2U]!
([_9]OZINú#ú:X[K!
+TJ!
Finally, if ([_9]OZIN is True, which means there was a retracement, and we are currently not in
a long position, then we place a buy stop order at the value stored in the variable 2U]KYZ2U plus
a third of the difference between the .OMNKYZ.O and 2U]KYZ2U. This ensures that prices have to
rally a third of the way back up between the low of the retracement and the high of the uptrend.
/Lú([_9]OZINúGTJú3GXQKZ6UYOZOUT"$úéúZNKTú(KMOT
([_úTK^ZúHGXúGZú2U]KYZ2Uúïúò.OMNKYZ.Oúíú2U]KYZ2Uúñëçú9ZUV!
+TJ!
åæúúúúúúúúúú3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

Once we are in a long position, or if 5-bar average of the closing prices is less than the 15-bar
average of the low prices or the MACD signal line is less than zero, we will re-set our variables,
([_9]OZIN, ,GYKé and ,GYKè to False.
/Lú3GXQKZ6UYOZOUTú#úéúUXúò6XOIK>3'ú"ú2U]>3'ú58ú3')*9OM2OTKú"úêñúZNKTú(KMOT
([_9]OZINú#ú,GRYK!
,GYKéú#ú,GRYK!
,GYKèú#ú,GRYK!
+^OZ2UTMúTK^ZúHGXúGZú3GXQKZ!
+TJ!

2UTMú+^OZY
The next set of instructions places exit orders. First, we check to see if we are in a long position.
If we are not, then we place the exit order at the low of the current bar minus the 10-bar average
of the true range. If we are, we place the exit order at the entry price minus the 10-bar average
of the true range.
Consider this set of instructions. When we are not in a long position, we place an order to exit
a long position. This statement enables us to place an exit for the bar of entry. As soon as we
are in a long position, this exit order takes effect.
/Lú3GXQKZ6UYOZOUTú"$úéúZNKT
+^OZ2UTMúTK^ZúHGXúGZú2U]úíú'\KXGMKò:X[K8GTMKîéêñú9ZUV
+RYK
+^OZ2UTMúTK^ZúHGXúGZú+TZX_6XOIKúíú'\KXGMKò:X[K8GTMKîúéêñú9ZUV!
We also wanted to place a profit-protecting trailing stop. We consider two prices, the low of the
swing resistance and the exponential moving averages of the low prices. First we determine
when a swing low has occurred and we are in a long position, we use the functions 9]OTM2U]
and 3GXQKZ6UYOZOUT, respectively, to do this. When these two conditions are true, we store the low
of the swing bar in the variable +^OZ6XI. We then use the 3OT2OYZ function to determine which
value is lower, the 15-bar exponential moving average of the low prices (2U]>3') or the value
stored in +^OZ6XI. Whichever is lower is stored in the variable +^OZ6XI. Then, we place a stop order
to exit our long position at the price stored in the variable +^OZ6XI.
/Lú9]OTM2U]òéî2U]îèîæñú#úçú'4*ú3GXQKZ6UYOZOUTú#úéúZNKT+^OZ6XIú#ú2U]AçC!
+^OZ6XIú#ú3OT2OYZò2U]>3'îú+^OZ6XIñ!
/Lú3GXQKZ6UYOZOUTú#úéúZNKT+^OZ2UTMúTK^ZúHGXúGZú+^OZ6XIú9ZUV!

-KTKXGRú9_YZKSú,UXSGZ
When we apply a system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified $10,000 as the trade size and 100 shares as the lot size.
Note: Remember that Commissions are calculated on a per contract/share basis. When you are
trading stocks, you would enter the average commission you are charged divided by the number
of shares the system is buying and selling.
We did not enable a money management stop or % risk trailing stop for this system. Our initial
protective stop for a long position is set one ten-bar average true range below our entry price;
for a short position, the initial stop is set one ten-bar average true range above our entry price.
Our stop is moved to breakeven after a closing price that gives us an open profit equal to or
greater than the initial risk on the trade.
Note: When you are trading stocks and you choose the stop to be tracked on a per share
(contract) basis, you will type in the number of points you are willing to lose before you are
exited out. When you are trading futures or any instrument that has a different dollar-point
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY 3USKTZ[Sí8KZXGIKSKTZú9_YZKSúúúúúúúúúúåå

value, you would type the maximum number of dollars you are willing to risk per contract
traded.
In the Properties tab, we selected the option Do not allow multiple entries in the same
direction. If the system is in a long position, and market conditions generate another long entry
order, the order is ignored. This is also the case when we’re in a short position, and market
conditions generate another short entry order.

:KYZOTMúôú/SVXU\OTM
We applied the Momentum Retracement System to a weekly chart of General Electric. The total
net profit was $3,032 per 100 shares. Sixty-seven percent of the trades were profitable with a
ratio of average win to average loss of 2.85. The system had seven consecutive winning trades
but only three consecutive losing trades. Momentum Retracement let profits run by staying in
winning trades for an average of 20 bars but cut losses short by exiting losing trades in only
three bars. The profit factor was excellent at 5.70 – our system made $5.70 in profits for each
dollar it lost. The maximum drawdown was only $787.50 per 100 shares during the test period
of more than 20 years. The system was profitable on both the long and short sides. Figure 20
shows the sample System Report for the weekly chart of General Electric.

,OM[XKúèêìú9GSVRKú9_YZKSú8KVUXZúLUXúZNKú3USKTZ[Sí8KZXGIKSKTZú9_YZKSúUTúGú]KKQR_ú-+úINGXZ

9[MMKYZOUTYúLUXú/SVXU\KSKTZ
This system was tested without any optimization. The results could almost certainly be
improved by proper optimization. Inputs that could be optimized include the values for the
EMA of highs, EMA of lows, EMA of closes, MACD, RSI, and DMI spread. We could also
optimize the levels of the RSI and DMI spread (currently 70 – 30 for RSI and +15, -15 for the
DMI spread). The percent of the countertrend move that must be “taken back” by a resumption
of the major trend is another candidate for optimization (the percent is currently fixed at 33%).
The system’s stops could also be optimized. The initial protective stop (currently set at one
average true range from our entry point) could be optimized for the best value in a range of
1/2 of an ATR to 3 ATRs.
The breakeven stop for this system has a floor equal to or greater than the initial risk. For
example, if the risk on a trade was $500, we would move our stop to breakeven when our open
åäúúúúúúúúúú:NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKú)XUYYU\KXú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

profits were equal to (or greater than) $500. The breakeven stop could be optimized for values
between 75% of the initial risk and two times the initial risk.

:NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKú)XUYYU\KXú9_YZKS
In Chapter 1, General System Development Concepts, we used a triple moving average system
to illustrate the basics of system optimization. We applied one of TradeStation’s built-in
systems, the MovAvg(3) Crossover system to IBM daily data. Then we optimized the length of
the three moving averages to fine-tune a system that was already producing profitable results.
We found that the 4-10-14 combination of simple moving averages performed much better than
the default values of 4-9-18 on the market we were studying.
Now, we’d like to see if we can improve the system further. We’ll start by changing from simple
moving averages to exponential moving averages. We don’t think that this will make too much
of a difference because simple moving averages and exponential moving averages are fairly
similar.
A simple moving average adds the data (generally closing prices) for a specified number of bars
and divides the total by the number of bars in the lookback period. For example, a 10-bar simple
moving average of closes adds the closing prices of the past 10 bars and divides the total by 10.
The term moving is included in the name of the indicator because the average moves forward
with each new bar that is created. In other words, the 10-bar simple moving average always
looks back to just the most recent 10 bars. Of course, you can construct simple moving averages
of any number of bars. The smaller the number of bars, the more sensitive the simple moving
average. For example, a 5-bar SMA is more sensitive than a 40-bar SMA.
Although the simple moving average is a good indicator, we have a slight preference for another
indicator — the exponential moving average. The EMA addresses two shortcomings of the
SMA. In the SMA, each data point counts exactly the same as any other data point in the
lookback period, and the SMA ignores all data points that occurred before the lookback period.
For example, in a 50-bar SMA of closing prices, each of the 50 closes counts the same as any
other close, and the 50-bar SMA ignores data earlier than 50 bars ago.
Many traders believe that more recent closing prices should be given more statistical weight,
and that the moving average should be calculated in such a way that it takes into consideration
the data that occurred before the lookback period.
Therefore, the EMA assigns more weight to recent data and does include all the available data
points in its calculation. Through geometric progression, each older price is assigned less
weight as the EMA moves forward in time. Thus, the effects of the earliest prices in the data
series are never eliminated, but they do diminish as more prices are included in the calculation.
In the MovAvg(3) Crossover System that we tested earlier in this volume, the basic rules were
as follows:
7. Buy when SMA1 is greater than SMA2, and SMA2 is greater than SMA3.
8. Sell when SMA1 is less than SMA2, and SMA2 is less than SMA3.
We noticed that this system can be very slow to exit from a position that has large open profits.
When a market has moved strongly in the direction of our trade, the three moving averages can
pull very far apart. Not exiting our trade until the conditions are met to actually reverse our
position (from long to short or short to long) can result in the loss of an unacceptable amount
of our open profit.
In an attempt to solve this problem, we wrote a revised set of rules for our Three Exponential
Moving Averages Crossover System. In our new 3 XAvg Crossover System, we’ll call the
fastest moving average Avg1, the second fastest moving average Avg2, and the third fastest
moving average Avg3. The new rules are as follows:
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY :NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKú)XUYYU\KXú9_YZKSúúúúúúúúúúåã

1. Buy when Avg1 crosses over Avg2 AND when Avg2 is greater than Avg3.
2. Sell when Avg1 crosses under Avg2 and Avg2 is less than Avg3.
We’ll exit our long positions on the open of the next bar when Avg1 is less than Avg2. Likewise,
we’ll exit our short positions on the open of the next bar when Avg1 is greater than Avg2.
We’ll also place a trailing stop for the first bar, exiting our long position at the low price minus
the 4-bar average of the range. On subsequent bars, the stop price will be the initial stop price
plus the value that results from subtracting the stop price from the low and dividing by 4. For
the short side, on the first bar, we’ll exit our position at the high price plus the 4-bar average of
the range. On subsequent bars, the stop price will be the initial stop price minus the value that
results from subtracting the high from the initial stop price and dividing by 4.

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined both long and short entries as well as exit orders. The long and short
entries reverse your position, whereas the exits close out your existing position and exit you
from the market. We also performed some setup work, which involved identifying the Inside
Day and subsequent breakouts. The setup, entry and exits are described next.

9KZ[Vú
a) Calculate the three exponential moving averages.

2UTMú+TZXOKYú
a) When Avg1 crosses over Avg2 and when Avg2 is greater than Avg3, buy on the next bar at
the open.

9NUXZú+TZXOKYú
a) When Avg1 crosses under Avg2 and Avg2 is less than Avg3, sell on the next bar at the open.

+^OZYú
a) Exit all long positions on the next bar at the open when Avg1 is less than Avg2.
b) Exit all short positions on the next bar at the open when Avg1 is greater than Avg2.
c) On the first bar of a long position, place a trailing stop that exits at the low minus the 4-bar
average of the range. On the first bar of a short position, place a trailing stop that exits at the
high plust the 4-bar average of the range.
d) On subsequent bars, place a trailing stop to exit long positions at the original stop price plus
the value that results from subtracting the stop price from the low and dividing by 4. We’ll place
a trailing stop to exit short positions at the initial stop price minus the value that results from
subtracting the high from the initial stop price and dividing by 4.

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.

+GY_2GTM[GMKú/TYZX[IZOUTY ú:NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKYúò9:'*úæ úúç>'\KXGMKYñ

/TV[ZY ú6XOIKò)RUYKñîú'\M2KTéòäñîú'\M2KTèòéèñîú'\M2KTçòèâñ!
<GXY ú'\Méòêñîú'\Mèòêñîú'\Mçòêñîú36òêñîú9ZUV6XOIKòêñ!
'\Méú#ú>'\KXGMKò6XOIKîú'\M2KTéñ!
'\Mèú#ú>'\KXGMKò6XOIKîú'\M2KTèñ!
'\Mçú#ú>'\KXGMKò6XOIKîú'\M2KTçñ!
åâúúúúúúúúúú:NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKú)XUYYU\KXú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

/Lú'\Méú)XUYYKYú5\KXú'\Mèú'4*ú'\Mèú$ú'\MçúZNKTú([_úTK^ZúHGXúGZú5VKT!
/Lú'\Méú)XUYYKYú;TJKXú'\Mèú'4*ú'\Mèú"ú'\MçúZNKTú9KRRúTK^ZúHGXúGZú5VKT!
/Lú'\Méú"ú'\MèúZNKT+^OZ2UTMúTK^ZúHGXúGZú5VKT!
/Lú'\Méú$ú'\MèúZNKT+^OZ9NUXZúTK^ZúHGXúGZú5VKT!
36ú#ú3GXQKZ6UYOZOUT!
/Lú36ú#úéúGTJú36AéCú"$úéúZNKT9ZUV6XOIKú#ú2U]úíú'\KXGMKò8GTMKîæñ!
/Lú36ú#úéúZNKTú(KMOT
+^OZ2UTMúòø+^OZ:XGJKøñúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúïúò2U]úíú9ZUV6XOIKñëæ!
+TJ!
/Lú36ú#úíéúGTJú36AéCú"$úíéúZNKTú9ZUV6XOIKú#ú.OMNúïú'\KXGMKò8GTMKîúæñ!
/Lú36ú#úíéúZNKTú(KMOT
+^OZ9NUXZúò¦+^OZ:XGJK§ñúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúíúò9ZUV6XOIKúíú.OMNñëç!
+TJ!
IMPORTANT NOTE: The instructions above in the bold font are the trailing stop instructions
for the short side of the system. They were inadvertently left out of the system on your CD. For
this system to work properly, you will have to open the system in the PowerEditor and type these
instructions. Once you verify the system, you can apply it to your chart.

/TV[ZYú
Following is the list of the inputs we used in this system:

Inputs Default Description


Price Close Price on which the exponential moving averages will be based.
Length, expressed in bars, for the fast exponential moving
AvgLen1 6
average.
Length, expressed in bars, for the medium exponential moving
AvgLen2 12
average.
Length, expressed in bars, for the slow exponential moving
AvgLen3 28
average.

In addition to these inputs, we identified the following variables:


<GXY ú'\Méòêñîú'\Mèòêñîú'\Mçòêñîú36òêñîú9ZUV6XOIKòêñ!

9KZ;V
The exponential moving average values are calculated and assigned to variables. This allows
for easy reference later, without recalculation of the >'\KXGMK function.
'\Méú#ú>'\KXGMKò6XOIKîú'\M2KTéñ!
'\Mèú#ú>'\KXGMKò6XOIKîú'\M2KTèñ!
'\Mçú#ú>'\KXGMKò6XOIKîú'\M2KTçñ!

2UTMú+TZXOKY
A buy order will be triggered on the open of the next bar if '\Mé (fast average) crosses above
'\Mè (medium average) and '\Mè is greater than '\Mç (slow average).
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY :NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKú)XUYYU\KXú9_YZKSúúúúúúúúúúåá

/Lú'\MéúIXUYYKYúU\KXú'\Mèú'4*ú'\Mèú$ú'\MçúZNKTú([_úTK^ZúHGXúGZú5VKT!

9NUXZú+TZXOKY
A sell order will be triggered on the open of the next bar if '\Mé crosses below '\Mè and '\Mè
is less than '\Mç.
/Lú'\MéúIXUYYKYú[TJKXú'\Mèú'4*ú'\Mèú"ú'\MçúZNKTú9KRRúTK^ZúHGXúGZú5VKT!

+^OZú5XJKXY
If '\Mé is greater than '\Mè, nearly the opposite of the first part of the Buy Entry criteria, a long
exit will be triggered on the open of the next bar.
/Lú'\Méú"ú'\MèúZNKTú+^OZ2UTMúTK^ZúHGXúGZú5VKT!
If '\Mé is less than '\Mè, nearly the opposite of the first part of the sell entry criteria, a short exit
will be triggered on the open of the next bar.
/Lú'\Méú$ú'\MèúZNKTú+^OZ9NUXZúTK^ZúHGXúGZú5VKT!
The value of the 3GXQKZ6UYOZOUT function is assigned to the variable 36 so that we can reference
previous market position values.
36ú#ú3GXQKZ6UYOZOUT!
If the current market position is long (1) and the market position on the previous bar was short
or flat (-1 or 0), a stop price is calculated by subtracting the average range of four bars from the
low. Thus, the stop price is calculated each time the market position becomes long.
/Lú36ú#úéúGTJú36AéCú"$úéúZNKTú9ZUV6XOIKú#ú2U]úíú'\KXGMKò8GTMKîæñ!
If the current market position is long (1) an long exit order is generated on the stop price
(9ZUV6XOIK) calculated above. In addition, this trailing stop is moved up by ¼ of the 9ZUV6XOIK
value.
/Lú36ú#úéúZNKTú(KMOT
+^OZRUTMúòø+^OZ:XGJKøñúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúïúò2U]úíú9ZUV6XOIKñëæ!
+TJ!
If the current market position is short (-1) and the market position on the previous bar was long
or flat (1 or 0), a stop price is calculated by adding the average range of four bars to the high.
Thus, the stop price is calculated each time the market position becomes short.
/Lú36ú#úíéúGTJú36AéCú"$úíéúZNKTú9ZUV6XOIKú#ú.OMNúïú'\KXGMKò8GTMKîúæñ!
If the current market position is short (-1) an long exit order is generated on the stop price
(9ZUV6XOIK) calculated above. In addition, this trailing stop is moved up by ¼ of the 9ZUV6XOIK
value.
/Lú36ú#úíéúZNKTú(KMOT
+^OZ9NUXZúò¦+^OZ:XGJK§ñúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúíúò9ZUV6XOIKúíú.OMNñëç!
+TJ!

-KTKXGRú9_YZKSú,UXSGZ
When we apply this system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified 1 as the default contract size to trade.
äêúúúúúúúúúú:NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKú)XUYYU\KXú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

Note: Remember that Commissions are calculated on a per contract/share basis. When you are
trading stocks, you would enter the average commission you are charged divided by the number
of shares the system is buying and selling.
Under the Stops tab, we enabled a money management stop (the Money Mngmnt check box)
and entered an appropriate dollar amount in the edit box. This option can hold the dollar amount
per position or a dollar amount per contract/share you want to risk before exiting from the
position.
Note: When you are trading stocks and you choose the stop to be tracked on a per share
(contract) basis, you will type in the number of points you are willing to lose before you are
exited out.When you are trading futures or any instrument that has a different dollar-point
value, you would type the maximum number of dollars you are willing to risk per contract
traded.
In the Properties tab, we selected the option Do not allow multiple entries in the same
direction. If the system is in a long position, and market conditions generate another long entry
order, the order is ignored. This is also the case when we’re in a short position, and market
conditions generate another short entry order.

:KYZOTMúôú/SVXU\OTM
We optimized the length of the three exponential moving averages to determine the combination
that produced the best results for our 3 XAvg Crossover System. The values we tested were 2
through 6 for Avg1, 7 through 11 for Avg2, and 14 through 20 for Avg3. We also enabled a
$1,000 money management stop. Figure 26 shows the resulting system applied to a daily chart
of the Yen.

,OM[XKúèäìú:NKú:NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKYú)XUYYU\KXú9_YZKSúGVVROKJúZUúGúJGOR_úINGXZúULúZNKú?KTú
)NGVZKXúèúúúúú:XKTJOTMú9_YZKSY :NXKKú+^VUTKTZOGRú3U\OTMú'\KXGMKú)XUYYU\KXú9_YZKSúúúúúúúúúúäé

When we performed the test on a daily continuation chart of Japanese Yen futures, the strongest
combination of moving averages was 2, 7, 15. Figure 27 shows the supporting Optimization
Report.

,OM[XKúèãìú:NKú5VZOSO`GZOUTú8KVUXZúLUXúZNKú:NXKKú+^VUTKTZOGRú'\KXGMKYú9_YZKSú

The system generated a total net profit of $29,625 per contract during the approximately 5-year
period. Figure 28 shows the sample System Report.

,OM[XKúèâìú:NKúYGSVRKú9_YZKSú8KVUXZúLUXúZNKú:NXKKú+^VUTKTZOGRú'\KXGMKYú9_YZKSúGVVROKJúZUúGúJGOR_úINGXZúULúZNKú?KTú

The trades were 31% profitable with a ratio of average win to average loss of 3.65. The average
trade (win + loss) was $379.81. Even if we deduct $50 - $100 per trade for slippage and
äèúúúúúúúúúú/T\KYZOTMúGú,O^KJú*URRGXú'SU[TZúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

commission, the system still looks promising. Other positive factors include that the system
was profitable on both the long and short sides, and that it stayed in the average winning trade
more than seven times as long as the average losing trade.

9[MMKYZOUTYúLUXú/SVXU\KSKTZ
The most negative feature of this system’s performance was its dependence on the largest
winning trade for the good results. This, of course, is not unusual in a trend-following system,
as the whole purpose of this type of system is to capture large profits in a big trend and to
minimize losses in periods of choppy market activity. Although having the largest winning
trade represent a major portion of the system’s profits is a potential problem (what if the market
doesn’t provide an exceptional trend again before our money or patience runs out?), the solution
is clearly not to reduce the size of the largest winning trade. The most practical solution is found
in portfolio management. Since no one really knows for sure when and where the next explosive
trend will occur, most successful trend-followers diversify their portfolios to increase their
chances of participation in an exceptional trend. Trading a carefully selected “basket” of stocks
and/or commodities rather than limiting your efforts to only one market has the potential to
smooth your equity curve and increase your profits.

/T\KYZOTMúGú,O^KJú*URRGXú'SU[TZ
A somewhat overlooked factor when back-testing a system on stocks (or any instrument whose
price changes significantly over time) is that a 100-share trade on a 10 dollar stock is not the
same as a 100-share trade on a 100 dollar stock. Because the dollar amount required to make
these transactions is so different, the return of these two trades cannot be compared in dollar
amounts (a return of $1,000 for a $5,000 investment is very good whereas the same return on
$100,000, while still good, is not nearly as significant).
One way to avoid this is to invest a fixed dollar amount instead of a fixed number of shares.
Therefore, we created the 4[S;TOZY function to perform this calculation for you.
The function is listed below, and it is also included on your STAD Club Volume 4 CD.

+GY_2GTM[GMKú/TYZX[IZOUTY ú4[S;TOZYú,[TIZOUTúò4[S;TOZYñú

/TV[ZY ú'STZòT[SKXOIñîú3OT2UZòT[SKXOIñ!
4[S;TOZYú#ú/TZ6UXZOUTòú/TZ6UXZOUTò'STZúëúò)RUYKð(OM6UOTZ<GR[Kñúñúëú3OT2UZúñúðú3OT2UZ!

Let’s see how we developed this function. First, we multiply the closing price by the value
returned by the (OM6UOTZ<GR[Kúfunction. The (OM6UOTZ<GR[K function returns the dollar value of a
1 point move for the specific stock). Then, we divide the amount of dollars we want to invest
(specified using the 'STZ input) by the resulting value. For example, if we decide to invest
$15,500 in lots of 100 shares, and the last price of the stock is $65 a share, the first operation
will be:
éåîåêêúëúòúäåúðúéúñ
The result is 238.46 shares. Now, we can’t trade fractions, so we will truncate the decimals of
this expression using the /TZ6UXZOUT function (built in to TradeStation). The result is:
/TZ6UXZOUTòúéåîêêêúëúòäåúðúéúñú
The resulting number of shares is 238. However, we only want to trade in lots of 100 shares, so
we divide our 238 shares by our minimum lot amount (specified using the 3OT2UZ input), truncate
the decimals once more, and then multiply the result by the minimum lot:
/TZ6UXZOUTòú/TZ6UXZOUTòéååêêúëúòäåúðúéñúñúëúéêêúñúðúéêê
The final result is 200. Therefore, we would be able to trade 200 shares of a $65 stock with
$15,500.
CHAPTER 3

9[VVUXZúôú8KYOYZGTIKú9_YZKSY
Support & Resistance systems are designed for sideways or directionless markets, and
they typically have the following attributes:
„ They buy low and sell high in an attempt to take advantage of the sideways price
movement characterizing directionless markets.
„ They have a high number of winning trades, with small profits on each trade. They
sell as the market goes higher and take small losses until the market finally turns
down and results in a profitable trade.
„ They are easier to trade emotionally.
By design, these systems miss the big move — they usually have small profits and
larger losses as markets trend. The system keeps shorting a market that is in an uptrend
or buying a market that is in a downtrend. Therefore, when traders use Support
&Resistance systems, they use them within a group of systems that also includes
trending systems and perhaps one or more volatility systems.
In this chapter, we present two Support & Resistance systems, designed to make the
most of the sideways movement of a market. We also show how these two systems can
be used in conjunction to more effectively take advantage of market movement.

/Tú:NOYú)NGVZKX

„ Spread System: Beta Up .................. 64 „ Spread System: Beta Down..............67


äæúúúúúúúúúú9VXKGJú9_YZKS ú(KZGú;Vúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVKSKTZú)R[Húíú<UR[SKúæ

9VXKGJú9_YZKS ú(KZGú;Vú
Market Guide Beta is traditionally defined as a measure of a stock’s price volatility relative to
the S&P 500 Index. Up Beta is the volatility of the company’s stock relative to the index for the
period in which the index increases, and Down Beta is the volatility of a stock relative to the
index for the periods in which the index decreases.
3GXQKZú-[OJKú(KZGúXKZ[XTYú A stock with a strong Up Beta (greater than 1) will tend to move upwards — accompanying and
ZNKúYRUVKúULúZNKúäêíSUTZNú usually exceeding moves of the S&P 500 Index — so we can design a system around this
XKMXKYYOUTúROTKúULúZNKú concept in an effort to capture the reactions of the stock to the market. If the S&P 500 Index
VKXIKTZGMKúVXOIKúINGTMKúULú moves upward, we would expect the stock to rally with it. If the index makes the move and the
ZNKúYZUIQúXKRGZO\KúZUúZNKú stock hasn’t reacted, we may want to establish a long position in an effort to capture the rally
VKXIKTZGMKúINGTMKúULúZNKú
the stock likely will experience as it catches up to (or even exceeds) the S&P’s performance.
9ô6úåêêîúGJP[YZKJúLUXú
XKMXKYYOUTúZKTJKTIOKYú Inversely, a stock with a strong Beta Down (greater than 1) will tend to decline —
XKVUXZKJúH_ú(R[SKì
accompanying and usually exceeding an S&P 500 Index decline. Therefore, if a stock with a
strong Down Beta is over-performing the S&P 500 Index, and the index drops without the stock
accompanying it immediately, we would expect the stock to decline and we’ll look to establish
a short position.
We will design two systems with this idea. Once for strong Beta Up stocks, the second for
strong Beta Down stocks. This section describes the Beta Up system, the next section describes
the Beta Down system.
Both systems will calculate the percent change of the traded stock and of the S&P 500 Index of
the last 10 days. The Beta Up system will then look for a day in which the S&P’s percent change
rose while the stock remained unchanged or declined. When this happens, we will buy on the
next bar at the high of the current day.
To exit, will use the trailing stop we have used in previous volumes of the STAD Club. This
consists of obtaining the low of the bar of entry and subtracting from it the average range of the
last four bars. This will be our exit point for the first bar after establishing a long position. From
the second bar, we will calculate the distance from the low to our previous exit price, and divide
it by three. We will add this value to our previous exit price obtain our exit for the next day.

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined only long entries and exit orders. We also did some setup work,
which consists of calculating the percent change between the two data series. The setup, entry
and exits are described next.

9KZ[V
a) Divide the close of the current bar by the close 10 bars ago. Make sure to check for division
by zero before dividing.
b) Divide the close of current bar for the second data series by the close of the second series 10
bars ago. Again, make sure to check for division by zero before dividing.

2UTMú+TZXOKYú
a) When we are not in a long position and the percent change for the first data series is less than
the percent change for the second data series, and the 8-bar exponential average of the closing
prices is greater than the 15-bar exponential average of the closing prices, then we will buy on
the next bar at the open.

+^OZYú
a) On the first bar of entry, we will set a trailing stop at the low of the current bar minus the 4-
bar average of the range.
)NGVZKXúçúúúúúú9[VVUXZúôú8KYOYZGTIKú9_YZKSY 9VXKGJú9_YZKS ú(KZGú;Vúúúúúúúúúúäå

b) On subsequent bars, our exit price will be the initial stop price plus the value resulting from
subtracting the initial stop price from the low and dividing by 3.

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system. This section
presents the EasyLanguage instructions and formatting for the system, with the EasyLanguage
instructions broken down and explained line by line.

+GY_2GTM[GMKú/TYZX[IZOUTY ú9VXKGJú9_YZKS ú(KZGú;Vúò9:'*úæ ú9VXKGJú(ïñ

/TV[ZY ú6XOIKéò)RUYKñîú6XOIKèò)RUYKúULú*GZGèñîú2KTòéêñîú:XGJKòéåêêêñîú2UZòéêêñ!
<GXY ú6ITZ)NGTMKéòêñîú6ITZ)NGTMKèòêñ!
<GXY ú36òêñîú9ZUV6XOIKòêñ!
/Lú6XOIKéA2KTCú"$úêúZNKTú6ITZ)NGTMKéú#ú6XOIKéúëú6XOIKéA2KTC!
/Lú6XOIKèA2KTCú"$úêúZNKT6ITZ)NGTMKèú#ú6XOIKèúëú6XOIKèA2KTC!
/Lú3GXQKZ6UYOZOUTú"$úéúGTJú6ITZ)NGTMKéú"ú6ITZ)NGTMKèú'TJú>'\KXGMKò)RUYKîâñú$ú>'\KXGMKò)îéåñúZNKT
([_ú4[S;TOZYò:XGJKîú2UZñúYNGXKYúTK^ZúHGXúGZú5VKT!
36ú#ú3GXQKZ6UYOZOUT!
OLú36ú#úéúGTJú36AéCú"$úéúZNKT9ZUV6XOIKú#ú2U]úíú'\KXGMKò8GTMKîæñ!
/Lú36ú#úéúZNKTú(KMOT
+^OZ2UTMúòø+^OZ2:XGJKøñúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúïúò2U]úíú9ZUV6XOIKñëç!
+TJ!

/TV[ZYú
Following is the list of the inputs we used in this system:

Inputs Default Description


Price1 Close Data used to calculate the first element of the spread.
Price2 Close of Data2 Data used to calculate second element of the spread.
Period, expressed in bars, used to calculate the percent change
Len 10
of Price1 and Price2.
Trade 15,000 Investment, in dollars, per trade.
Lot 100 Miminum lot size per transaction.

In addition to these inputs, we identified the following variables:


<GXY ú6ITZ)NGTMKéòêñîú6ITZ)NGTMKèòêñ!
<GXY ú36òêñîú9ZUV6XOIKòêñ!

9KZ[V
First, we calculate the percent change for both data series, we divide the close of the current bar
with the close of 10 bars ago (for both data series). Since we will be dividing, we first make sure
that our divisor, 6XOIKé and 6XOIKè of 2KT bars ago, are not equal to zero. We store the resulting
percent change values in the variables 6ITZ)NGTMKé and 6ITZ)NGTMKè.
/Lú6XOIKéA2KTCú"$úêúZNKT6ITZ)NGTMKéú#ú6XOIKéúëú6XOIKéA2KTC!
/Lú6XOIKèA2KTCú"$úêúZNKT6ITZ)NGTMKèú#ú6XOIKèúëú6XOIKèA2KTC!
ääúúúúúúúúúú9VXKGJú9_YZKS ú(KZGú;Vúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVKSKTZú)R[Húíú<UR[SKúæ

2UTMú+TZXOKY
If this system is not in a long position and the percent change of the first data stream is less than
the percent change of the second data stream, and the 8-bar exponential average of the closing
prices is greater than the same 15-bar average, then we will look to establish a long position at
the next bar’s open.
We specify the number of shares to buy using the 4[S;TOZY function. Please refer to the section
at the end of Chapter 2, titled, “Investing a Fixed Dollar Amount,” for a description of the
4[S;TOZY function and how it calculates the number of shares to buy.
/Lú3GXQKZ6UYOZOUTú"$úéúGTJú6ITZ)NGTMKéú"ú6ITZ)NGTMKèúGTJú>'\KXGMKò)RUYKîâñú$ú>'\KXGMKò)îéåñúZNKT
([_ú4[S;TOZYò:XGJKîú2UZñúYNGXKYúTK^ZúHGXúGZú5VKT!

+^OZú5XJKXY
We will use a version of the trailing stops that we have used in previous volumes of the STAD
Club. We will use the variable 36 to store the value of the keyword 3GXQKZ6UYOZOUT. This with
the intention of being able to reference the values of 3GXQKZ6UYOZOUT of previous bars.
36ú#ú3GXQKZ6UYOZOUT!
If we are in a long position, and one bar ago we were not in a long position, then we will assign
the low of the current bar minus the 4-bar average of the range to the variable 9ZUV6XOIK.
/Lú36ú#úéúGTJú36AéCú"$úéúZNKT9ZUV6XOIKú#ú2U]úíú'\KXGMKò8GTMKîæñ!
If we are in a long position, we will place a stop order to exit from the position at the 9ZUV6XOIK
or anything lower. Then, we will calculate a third of the distance between the low of the current
bar and the 9ZUV6XOIK and we will add that to the current stop price; the resulting value is our
new 9ZUV6XOIK.
/Lú36ú#úéúZNKTú(KMOT
+^OZRUTMúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúïúò2U]úíú9ZUV6XOIKñëç!
+TJ!

-KTKXGRú9_YZKSú,UXSGZ
When we apply this system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified 1 as the default contract size to trade.
Note: Remember that Commissions are calculated on a per contract/share basis. When you are
trading stocks, you would enter the average commission you are charged divided by the number
of shares the system is buying and selling.
Under the Stops tab, we enabled a money management stop (the Money Mngmnt check box)
and entered an appropriate dollar amount in the edit box. This option can hold the dollar amount
per position or a dollar amount per contract/share you want to risk before exiting from the
position.
Note: When you are trading stocks and you choose the stop to be tracked on a per share
(contract) basis, you will type in the number of points you are willing to lose before you are
exited.When you are trading futures or any instrument that has a different dollar-point value,
you would type the maximum number of dollars you are willing to risk per contract traded.
In the Properties tab, we selected the option Do not allow multiple entries in the same
direction. If the system is in a long position, and market conditions generate another long entry
order, the order is ignored.
)NGVZKXúçúúúúúú9[VVUXZúôú8KYOYZGTIKú9_YZKSY 9VXKGJú9_YZKS ú(KZGú*U]Túúúúúúúúúúäã

:KYZOTMúôú/SVXU\OTM
Please see the description of the next system, Beta Down, for a description of the system results
and suggestions for improvement. The two systems, although, they are two separate systems,
were designed to be used together, so their use is described in the next section.

9VXKGJú9_YZKS ú(KZGú*U]T
Market Guide Beta is traditionally defined as a measure of a stock’s price volatility relative to
the S&P 500 Index. Up Beta is the volatility of the company’s stock relative to the index for the
period in which the index increases, and Down Beta is the volatility of a stock relative to the
index for the periods in which the index decreases.
3GXQKZú-[OJKú(KZGúXKZ[XTYú A stock with a strong Up Beta (greater than 1) will tend to move upwards — accompanying and
ZNKúYRUVKúULúZNKúäêíSUTZNú usually exceeding moves of the S&P 500 Index — so we can design a system around this
XKMXKYYOUTúROTKúULúZNKú concept in an effort to capture the reactions of the stock to the market. If the S&P 500 Index
VKXIKTZGMKúVXOIKúINGTMKúULú moves upward, we would expect the stock to rally with it. If the index makes the move and the
ZNKúYZUIQúXKRGZO\KúZUúZNKú stock hasn’t reacted, we may want to establish a long position in an effort to capture the rally
VKXIKTZGMKúINGTMKúULúZNKú
9ô6úåêêîúGJP[YZKJúLUXú
the stock likely will experience as it catches up to (or even exceeds) the S&P’s performance.
XKMXKYYOUTúZKTJKTIOKYú Inversely, a stock with a strong Beta Down (greater than 1) will tend to decline —
XKVUXZKJúH_ú(R[SKì
accompanying and usually exceeding an S&P 500 Index decline. Therefore, if a stock with a
strong Down Beta is over-performing the S&P 500 Index, and the index drops without the stock
accompanying it immediately, we would expect the stock to decline and we’ll look to establish
a short position.
We will design two systems with this idea; one for strong Beta Up stocks, the second for strong
Beta Down stocks. This section describes the Beta Down system, and the previous section
describes the Beta Up system.
Both systems will calculate the percent change of the traded stock and of the S&P 500 Index of
the last 10 days. The Beta Down system will look for a day in which the S&P 500 index percent
change declines and where the stock’s remains at zero or increases. When a day such as this is
found, it will establish a short entry order (sell to open) at the low of the current bar.
To exit, we’ll use the trailing stop we have used in previous volumes of the STAD Club. This
consists of obtaining the high of the bar of entry and adding to it the average range of the last
four bars. This will be our exit point for the first bar after establishing a short position. From
the second bar, we will calculate the distance from our initial stop price to the high of the current
bar and divide it by three. We will subtract this value from the previous stop price in order to
obtain our exit for the next day.
äâúúúúúúúúúú9VXKGJú9_YZKS ú(KZGú*U]Túúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVKSKTZú)R[Húíú<UR[SKúæ

Figure 1 shows the Beta Down applied to a daily chart of Arcadia Financial and the S&P 500
Index:

,OM[XKúéìú(KZGú*U]Tú9_YZKSúGVVROKJúZUú'XIGJOGú,OTGTIOGRúGTJúZNKú9ô6úåêêú/TJK^

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined only short entries and exit orders. We also did some setup, which
involved calculating the percent change for the two data series. The setup, entry and exits are
described next.

9KZ[V
a) Divide the close of the current bar by the close 10 bars ago. Make sure to check for division
by zero before dividing.
b) Divide the close of current bar for the second data series by the close of the second series 10
bars ago. Again, make sure to check for division by zero before dividing.

9NUXZú+TZXOKYú
a) When we are not in a short position and the percent change for the second data series is less
than the percent change for the second data series one bar ago, and the percent change for the
first data series is greater than or equal to the percent change for the first data series one bar
ago, then we will place a stop order for the next bar at the low of the current bar.

+^OZYú
a) On the first bar of entry, we will set a trailing stop at the high of the current bar plus the
4-bar average of the range.
b) On subsequent bars, our exit price will be the initial stop price minus the value resulting from
subtracting the high from the initial stop price and dividing by 3.
)NGVZKXúçúúúúúú9[VVUXZúôú8KYOYZGTIKú9_YZKSY 9VXKGJú9_YZKS ú(KZGú*U]Túúúúúúúúúúäá

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.

+GY_2GTM[GMKú/TYZX[IZOUTY ú9VXKGJú9_YZKS ú(KZGú*U]Túò9:'*úæ ú9VXKGJú(íñ

/TV[ZY ú6XOIKéò)RUYKñîú6XOIKèò)RUYKúULú*GZGèñîú2KTòéêñîú:XGJKòéåêêêñîú2UZòéêêñ!
<GXY ú6ITZ)NGTMKéòêñîú6ITZ)NGTMKèòêñ!
<GXY ú36òêñîú9ZUV6XOIKòêñ!
/Lú6XOIKéA2KTCú"$úêúZNKT6ITZ)NGTMKéú#ú6XOIKéúëú6XOIKéA2KTC!
/Lú6XOIKèA2KTCú"$úêúZNKT6ITZ)NGTMKèú#ú6XOIKèúëú6XOIKèA2KTC!
/Lú3GXQKZ6UYOZOUTú"$úíéúGTJú6ITZ)NGTMKèú"ú6ITZ)NGTMKèAéCúGTJú6ITZ)NGTMKéú$#ú6ITZ)NGTMKéAéCúZNKTú
9KRRú4[S;TOZYò:XGJKî2UZñúYNGXKYúTK^ZúHGXúGZú2U]ú9ZUV!
36ú#ú3GXQKZ6UYOZOUT!
OLú36ú#úíéúGTJú36AéCú"$úíéúZNKT9ZUV6XOIKú#ú.OMNúïú'\KXGMKòXGTMKîæñ!
/Lú36ú#úíéúZNKTú(KMOT
+^OZ9NUXZúòø+^OZ9:XGJKøñúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúíúò9ZUV6XOIKúíú.OMNñëç!
+TJ!
IMPORTANT NOTE: When you compare the above instructions in bold to the same line in the
system in the PowerEditor, you will notice a difference. The above instructions are correct;
please correct your system in the PowerEditor.

/TV[ZYú
Following is the list of the inputs we used in this system:

Inputs Default Description


Price1 Close Data used to calculate the first element of the spread.
Data used to calculate second element of the spread (we used
Price2 Close of Data2
the S&P 500 Index).
Period, expressed in bars, used to calculate the percent change
Len 10
of Price1 and Price2.
Trade 15,000 Investment, in dollars, per trade.
Lot 100 Minimum lot size per transaction.

In addition to these inputs, we identified the following variables:


<GXY ú6ITZ)NGTMKéòêñîú6ITZ)NGTMKèòêñ!
<GXY ú36òêñîú9ZUV6XOIKòêñ!
If 6XOIKé and 6XOIKè of 2KT bars ago is something other than zero, we will divide the current value
with the value of Len bars ago. These IF-THEN statements are included in order to avoid a
division by zero.
/Lú6XOIKéA2KTCú"$úêúZNKT6ITZ)NGTMKéú#ú6XOIKéúëú6XOIKéA2KTC!
/Lú6XOIKèA2KTCú"$úêúZNKT6ITZ)NGTMKèú#ú6XOIKèúëú6XOIKèA2KTC!
ãêúúúúúúúúúú9VXKGJú9_YZKS ú(KZGú*U]Túúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVKSKTZú)R[Húíú<UR[SKúæ

9NUXZú+TZXOKY
If this system is not in a short position and the percent change of the second data stream is less
than the percent change from the second data stream one bar ago, and the percent change from
the first data series is greater than or equal to the same value one bar ago, then we will look to
establish a short position at the low of the current bar or anything lower.
We use the 4[S;TOZY function to determine the number of shares to sell. Please see the last
section in Chapter 2, titled, “Investing a Fixed Dollar Amount,” for a description of how the
function calculates the number of shares to trade.
/Lú3GXQKZ6UYOZOUTú"$úíéúGTJú6ITZ)NGTMKèú"ú6ITZ)NGTMKèAéCúGTJú6ITZ)NGTMKéú$#ú6ITZ)NGTMKéú
ZNKTú9KRRú4[S;TOZYò:XGJKî2UZñúYNGXKYúTK^ZúHGXúGZú2U]úYZUV!

+^OZú5XJKXY
We will use a version of the trailing stops that we have used in previous volumes of the STAD
Club. We will use the variable 36 to store the value of the keyword 3GXQKZ6UYOZOUT. This enables
us to be able to reference the values of 3GXQKZ6UYOZOUT of previous bars.
36ú#ú3GXQKZ6UYOZOUT!
If we are in a short position, and one bar ago we were not in a short position, then we will assign
the high of the current bar plus the four bar average of the range to the variable 9ZUV6XOIKì
/Lú36ú#úíéúGTJú36AéCú"$úíéúZNKT9ZUV6XOIKú#ú.OMNúïú'\KXGMKò8GTMKîæñ!
If we are in a short position, we will place a stop order to exit from the position at the 9ZUV6XOIK
or anything higher. Then we will calculate a third of the distance between the 9ZUV6XOIK and the
high of the current bar and we will subtract this value from the current stop price; the resulting
value is our new 9ZUV6XOIK.
/Lú36ú#úíéúZNKTú(KMOT
+^OZYNUXZúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúíúò9ZUV6XOIKúíú.OMNñëç!
+TJ!

-KTKXGRú9_YZKSú,UXSGZ
When we apply this system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified 1 as the default contract size to trade.
Note: Remember that Commissions are calculated on a per contract/share basis. When you are
trading stocks, you would enter the average commission you are charged divided by the number
of shares the system is buying and selling.
Under the Stops tab, we enabled a money management stop (the Money Mngmnt check box)
and entered an appropriate dollar amount in the edit box. This option can hold the dollar amount
per position or a dollar amount per contract/share you want to risk before exiting from the
position.
Note: When you are trading stocks and you choose the stop to be tracked on a per share
(contract) basis, you will type in the number of points you are willing to lose before you are
exited.When you are trading futures or any instrument that has a different dollar-point value,
you would type the maximum number of dollars you are willing to risk per contract traded.
In the Properties tab, we selected the option Do not allow multiple entries in the same
direction. If the system is in a long position, and market conditions generate another long entry
order, the order is ignored. This is also the case when we’re in a short position, and market
conditions generate another short entry order.
)NGVZKXúçúúúúúú9[VVUXZúôú8KYOYZGTIKú9_YZKSY 9VXKGJú9_YZKS ú(KZGú*U]Túúúúúúúúúúãé

:KYZOTMúôú/SVXU\OTM
We see how both the Beta Positive and Beta Negative systems perform very well, with nearly
or over 50% of winning trades and a very healthy average winning versus losing trades ratio
(over 2). Figures 2 and 3 show the System Reports for the Beta Up and Beta Down Systems.
We applied Beta Up System to a daily chart of IBM, and the Beta Down System to a daily chart
of Arcadia Financial.

,OM[XKúèìú(KZGú;Vú9_YZKSúGVVROKJúZUúGúJGOR_ú/(3úINGXZú

,OM[XKúçìú(KZGú*U]Tú9_YZKSúGVVROKJúZUúGúJGOR_ú'XIGJOGú,OTGTIOGRúINGXZú
ãèúúúúúúúúúú9VXKGJú9_YZKS ú(KZGú*U]Túúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVKSKTZú)R[Húíú<UR[SKúæ

These two systems present a unique opportunity. If a basket of beta positive stocks are traded
with the B+ system together with a basket of beta negative stocks with the B- system, you will
create a portfolio that will tend to perform well whether the market is rising or falling. These
two systems, applied to such a group of stocks, should complement each other perfectly. While
one of them is standing by waiting for the market to change, the other should be taking profits
from the market that is moving in its direction. Adding stocks with both a strong beta positive
and a strong beta negative should result in a portfolio with a smooth and constant up-rising
equity curve.
Such ideas can be easily tested with Portfolio Maximizer, as it will allow merging of multiple
systems applied to multiple securities. Displaying detailed portfolio system results as well as
equity and many other analysis. Figure 4 shows the Portfolio Maximizer report for the two
systems; the Beta Up system applied to IBM and the Beta Down system applied to AAC:

,OM[XKúæìú6UXZLUROUú3G^OSO`KXú8KVUXZúLUXúZNKúZ]UúY_YZKSY

9[MMKYZOUTYúLUXú/SVXU\KSKTZ
?U[úIGTúKGYOR_úUHZGOTúGúROYZú This system seems to work very well for most stocks, yet you can use this idea with any timing
ULúHKZGí6UYOZO\KúGTJúHKZGí analysis on both the stock and the index. And again, trading a basket of beta positive and beta
4KMGZO\KúYZUIQYú]OZNú negative stocks will allow the equity curve of your portfolio to perform well if the market rises
:XGJK9ZGZOUTúOLú_U[úGXKú or drops.
[YOTMúZNKú5SKMGú8KYKGXINú
*U]TRUGJKXú]OZNú*OGRú*GZGìúúú First, create a new workspace with one chart with a symbol from the directory or custom
?U[ú]ORRúHKúGHRKúZUú security list you want to scan. Then apply both the S_BetaDn > X and the S_BetaUp > X
JU]TRUGJúL[TJGSKTZGRú ShowMe Studies. Both studies will have an input called X which you can set to 1. This will
OTLUXSGZOUTúLUXúGRRú_U[ú
produce an alert for any stock with Beta Up or Beta Down greater than one. Save this workspace
YZUIQYîúGTJúZ]UúULúZNKú
G\GORGHRKúLOKRJYúGXKú(KZGí;Vú and access the ChartScanner by using the Tools - ChartScenner menu sequence.
GTJú(KZGí*U]Tìú:]Uú
Click the S button (for ChartScanner setup) and select the workspace you saved with these two
9NU]3KúYZ[JOKYúTGSKJú
¦9E(KZG*Tú$ú>§úúGTJú ShowMe studies. (Remember to set up the rest of the options of this window. If you need to,
¦9E(KZG;Vú$ú>§úúò]NOINúGXKú refer to your TradeStation User’s Manual for information on setting up ChartScanner). Once
YNOVVKJú]OZNú:XGJK9ZGZOUTú you’ve set up your options, click OK and then click the RUN button one the ChartScanner
GTJú9[VKX)NGXZYñúGTJúZNKú report window.
)NGXZ9IGTTKXú]ORRúGOJú_U[ú
OTúZNOYúVXUIKJ[XKì Once the ChartScanner is finished, you will have a list of all the securities that are Beta Up and
Beta Down. Figure 5 shows the resulting ChartScanner report. You will be able to get a list of
)NGVZKXúçúúúúúú9[VVUXZúôú8KYOYZGTIKú9_YZKSY 9VXKGJú9_YZKS ú(KZGú*U]Túúúúúúúúúúãç

all the Beta Up and Beta Down stocks separately by using the drop down list (on upper right,
shown with all the option) on the upper right.

,OM[XKúåú)NGXZ9IGTTKXú8KVUXZúROYZOTMúGRRúYKI[XOZOKYúSKKZOTMúIXOZKXOG
ãæúúúúúúúúúú9VXKGJú9_YZKS ú(KZGú*U]Túúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVKSKTZú)R[Húíú<UR[SKúæ
CHAPTER 4

<URGZOROZ_ú(XKGQU[Zú9_YZKSY
Volatile markets are characterized by sharp jumps in price, and volatility breakout
systems are designed to take advantage of this type of change in volatility. Volatility
breakout systems generally have the following characteristics:
„ Substantial amount of time out of the market.
„ High percentage of winning trades, but with a small profit per trade.
„ Don’t take advantage of big moves.
„ Exciting to trade because trades are quick and short-term.
„ Based solely on price movement.
When designing this type of system, the key is to effectively anticipate and take
advantage of a significant change in volatility and then exit the position before a loss
of profit. In this chapter, we present two volatility breakout systems, which, like all
volatility breakout systems, are designed to capture significant change in volatility and
limit losses during directionless and/or trending phases.

/Tú:NOYú)NGVZKX

„ Displaced Moving Average „ Price Distribution System ................82


& Volume System............................ 76
ãäúúúúúúúúúú*OYVRGIKJú3U\OTMú'\KXGMKúôú<UR[SKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

*OYVRGIKJú3U\OTMú'\KXGMKúôú<UR[SKú9_YZKS
A displaced moving average allows us to shift a moving average forward by a specified number
of bars. In other words, rather than plotting the moving average we calculated today on today’s
price bar, we plot the moving average on a later bar. Displaced means that the moving average
is displaced from its conventional bar and placed on a future bar. Displaced moving averages
tell us the numeric value a moving average will have on a bar “ahead of time” and help to reduce
“whipsaw” losses.
The second component of this system is volume. Volume is the number of shares or contracts
that change hands during a specified time period. Daily volume, for example, refers to the
number of shares or contracts traded in one day. A market move that is accompanied by an
increase in volume is more likely to continue in the same direction than a market move with a
decrease in volume. In a healthy uptrend, volume should increase on the up bars and decrease
on the down bars; in a robust downtrend, volume should increase on the down bars and decrease
on the up bars.
In our Displaced Moving Average and Volume system, we apply a displaced moving average
(DMA) to both price and volume. Our buy setup is a close above a DMA of closing prices
accompanied by volume that is above a DMA of volume. Our sell setup is a close below a DMA
of closing prices accompanied by volume greater than a DMA of volume.
Our entries include a volatility condition. Instead of simply buying at the market on the next
open after a setup, we’ll require that prices make a move away from the opening price before
we buy or sell. To go long, we’ll wait for prices to rally to the open plus 20% of the 10-bar
average true range. If our entry requirements are not met on the first bar after the setup, we’ll
pass on the trade. To sell short, we’ll wait for prices to decline to the open minus 20% of the
10-bar average true range. If the entry doesn’t occur on the first bar after the setup, we’ll pass
on the trade. Figure 1 shows the system, along with a displaced volume indicator, applied to the
chart.

,OM[XKéìú*OYVRGIKJú3U\OTMú'\KXGMKúGTJú<UR[SKú9_YZKSúGVVROKJúZUúGúJGOR_úINGXZ

When we enter a new position, we’ll place a money management stop. To lock in profits when
prices move in our favor, we’ll trail a % risk trailing stop. A % risk trailing stop enables us to
specify the percent of the maximum open profit we are willing to give back before our position
is closed out. To set a % risk trailing stop, we must also indicate the minimum profit level
)NGVZKXúæúúúúúú<URGZOROZ_ú(XKGQU[Zú9_YZKSY *OYVRGIKJú3U\OTMú'\KXGMKúôú<UR[SKú9_YZKSúúúúúúúúúúãã

(known as a floor) that our position must reach before the % risk trailing stop takes effect. The
maximum profit is calculated from our entry point to the highest high if we are long and from
our entry point to the lowest low if we are short. Then the percent of this amount that we are
willing to risk is subtracted and the trailing stop is set at that point. For example, let’s say that
we place a 30% risk trailing stop with a $400 floor. When open profits reach the floor value of
$400, the stop will become active and will be placed at the maximum profit-to-date minus 30%.
Our exit strategy will be to exit on the close when prices close on the opposite side of the
displaced moving average. In other words, we’ll exit a long position on a close below the DMA
and a short position on a close above the DMA.

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined both long and short entries as well as exit orders. The long and short
entries reverse your position, whereas the exits close out your existing position and exit you
from the market. We did some minor setup work, which involved calculating the displaced
moving averages. The entry and exits are described next.

9KZ[Vú
a) Calculate the 7-bar moving average of the closing prices, and displace it by 5 bars.
b) Calculate the 7-bar moving average of the volume, and displace it by 5 bars.

2UTMú+TZXOKYú
a) When the close crosses above the average of the closing prices, and the volume is greater than the
average of the volume, then place a buy stop order at the open plus a certain number of points. The
number of points is 20% of the 10-bar average true range.

9NUXZú+TZXOKYú
a) When the close crosses below the average of the closing prices, and the volume is less than the
average of the volume, then place a sell stop order at the open minus a certain number of points. The
number of points is 20% of the 10-bar average true range.

+^OZYú
a) Place a trailing stop that exits long positions at the lowest low of the last 5 bars.
b) Place a trailing stop that exits short positions at the highest high of the last 5 bars.
c) Exit long positions on the next bar at market when the close crosses below the moving
average.
d) Likewise, exit short positions on the next bar at market when the close crosses above the
moving average.

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.

+GY_2GTM[GMKú/TYZX[IZOUTY ú*OYVRGIKJú3U\OTMú'\KXGMKúôú<UR[SKúò9:'*úæ úú*3'ú)ë<ñ

/TV[ZY ú6XOIKò)RUYKñîú62KTòãñîú6*OYVòåñîú<2KTòãñîú<*OYVòåñîú':86ITZòìèêñîú:XGJKòéêêêêñîú2UZòéêêñ!
<GXY ú*3'òêñîú*3'<òêñ!
a'YYOMTSKTZúULú*OYVRGIKJú3U\OTMú'\KXGMKú\GR[KYúZUú\GXOGHRKYc
*3'ú#ú'\KXGMKò6XOIKîú62KTñA6*OYVC!
*3'<ú#ú'\KXGMKò<UR[SKîú<2KTñA<*OYVC!
ãâúúúúúúúúúú*OYVRGIKJú3U\OTMú'\KXGMKúôú<UR[SKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

a([_ú)XOZKXOGú+\GR[GZOUTc
/,ú)RUYKú)XUYYKYú'HU\Kú*3'ú'4*ú<UR[SKú$ú*3'<ú:NKT
([_ú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú5VKTú4K^Zú(GXúïúò':86ITZúðú'\M:X[K8GTMKòéêññú
6UOTZYú9ZUV!
a9KRRú)XOZKXOGú+\GR[GZOUTc
/,ú)RUYKú)XUYYKYú(KRU]ú*3'ú'4*ú<UR[SKú"ú*3'<ú:NKT
9KRRú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú5VKTú4K^Zú(GXúíúò':86ITZúðú'\M:X[K8GTMKòéêññú
6UOTZYú9ZUV!
a:XGOROTMú9ZUVYc
+^OZ2UTMú4K^Zú(GXúGZú2U]KYZò2U]îúåñú9ZUV!
+^OZ9NUXZú4K^Zú(GXúGZú.OMNKYZò.OMNîúåñú9ZUV!
a9_YZKSú+^OZYc
/,ú)RUYKú)XUYYKYú(KRU]ú*3'ú:NKT
+^OZ2UTMú4K^Zú(GXúGZú3GXQKZ!
/,ú)RUYKú)XUYYKYú'HU\Kú*3'ú:NKT
+^OZ9NUXZú4K^Zú(GXúGZú3GXQKZ!

/TV[ZYú
Following is the list of the inputs we used in this system:

Inputs Default Description


Price Close Price to use when calculating displaced moving average.
Length, expressed in bars, to use to calculate the moving
PLen 7
average of the price.
Length, expressed in bars, by which to displace the moving
PDisp 5
average of the price.
Length, expressed in bars, to use to calculate the moving
VLen 7
average of the volume.
Length, expressed in bars, by which to displace the moving
VDisp 5
average of the volume.
Percentage of the average true range to add to the open as
ATRPcnt .20
points to determine the buy and sell entry price.
Trade 10,000 Dollar amount to invest per transaction.
Lot 100 Minimum shares to trade per transaction.

In addition to these inputs, we identified the following variables:


<GXY ú*3'òêñîú*3'<òêñ!

9KZ[V
First we calculate the displaced moving averages for both the close and the volume. We store
the displaced moving average of the closing prices in the variable *3'. We store the displaced
moving average of the volume in the variable *3'<.
*3'ú#ú'\KXGMKò6XOIKîú62KTñA6*OYVC!
*3'<ú#ú'\KXGMKò<UR[SKîú<2KTñA<*OYVC!
)NGVZKXúæúúúúúú<URGZOROZ_ú(XKGQU[Zú9_YZKSY *OYVRGIKJú3U\OTMú'\KXGMKúôú<UR[SKú9_YZKSúúúúúúúúúúãá

2UTMú+TZXOKY
When the close price crosses above *3' and the volume is greater than *3'<, then we’ll place
a buy stop order. The number of shares to buy is determined using the 4[S;TOZY function. Please
refer to the section in Chapter 2, titled, “Investing a Fixed Dollar Amount,” for information on
using the 4[S;TOZY function. The entry price is determined by adding 20% of the 10-bar average
of the true range to the open price.
/,ú)RUYKú)XUYYKYú'HU\Kú*3'ú'4*ú<UR[SKú$ú*3'<ú:NKT
([_ú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú5VKTú4K^Zú(GXúïú
ò':86ITZúðú'\M:X[K8GTMKòéêññú6UOTZYú9ZUV!

9NUXZú+TZXOKY
When the close price crosses below *3' and the volume is less than *3'<, then we’ll place a
sell stop order. Again, the number of shares to sell is determined using the 4[S;TOZY function.
Please refer to the section in Chapter 2, titled, “Investing a Fixed Dollar Amount,” for
information on using the 4[S;TOZY function. The entry price is determined by subtracting 20%
of the 10-bar average of the true range from the open price.
/,ú)RUYKú)XUYYKYú(KRU]ú*3'ú'4*ú<UR[SKú"ú*3'<ú:NKT
9KRRú4[S;TOZYò:XGJKî2UZñú9NGXKYú4K^Zú(GXúGZú5VKTú4K^Zú(GXúíú
ò':86ITZúðú'\M:X[K8GTMKòéêññú6UOTZYú9ZUV!

+^OZú5XJKXY
To exit, we’ll look for the 5-bar extreme. We’ll exit long positions when the price reaches the
lowest low of the last 5 bars. Likewise, we’ll exit short positions when the price reaches the
highest high of the last 5 bars.
+^OZ2UTMú4K^Zú(GXúGZú2U]KYZò2U]îúåñú9ZUV!
+^OZ9NUXZú4K^Zú(GXúGZú.OMNKYZò.OMNîúåñú9ZUV!
We’ll also exit long positions when the close crosses below DMA; we’ll exit on the next bar at
market. We’ll also exit short positions on the next bar at market when the close crosses above
DMA.
/,ú)RUYKú)XUYYKYú(KRU]ú*3'ú:NKT+^OZ2UTMú4K^Zú(GXúGZú3GXQKZ!
/,ú)RUYKú)XUYYKYú'HU\Kú*3'ú:NKT+^OZ9NUXZú4K^Zú(GXúGZú3GXQKZ!

-KTKXGRú9_YZKSú,UXSGZ
When we apply a system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified $10,000 as the trade size and 100 shares as the lot size.
Note: Remember that Commissions are calculated on a per contract/share basis. When you are
trading stocks, you would enter the average commission you are charged divided by the number
of shares the system is buying and selling.
Under the Stops tab, we enabled a % risk trailing stop. This type of stop enables you to indicate
what percent of the maximum open profit you are willing to give back before the position is
automatically closed out. The % risk trailing stop also requires that you specify a minimum
profit level that must be reached before the stop takes effect.
Note: When you are trading stocks and you choose the stop to be tracked on a per share
(contract) basis, you will type in the number of points you are willing to lose before you are
exited out. When you are trading futures or any instrument that has a different dollar-point
value, you would type the maximum number of dollars you are willing to risk per contract
traded.
âêúúúúúúúúúú*OYVRGIKJú3U\OTMú'\KXGMKúôú<UR[SKú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

In the Properties tab, we selected the Do not allow multiple entries in the same direction
option. If the system is in a long position and market conditions generate another long entry
order, the order is ignored. This is also the case when we’re in a short position and market
conditions generate another short entry order.

:KYZOTMúôú/SVXU\OTM
Figure 2 shows a sample System Report for the Displaced Moving Average and Volume
System.

,OM[XKúèìú9GSVRKú9_YZKSú8KVUXZúLUXúZNKú*OYVRGIKJú3U\OTMú'\KXGMKúGTJú<UR[SKú9_YZKSú

Trading both the long and short sides of the market, we are able to produce only 39% of
profitable trades. Still, since most stock traders (for the last 20 years especially) have focused
their efforts on going long and avoiding the short side of the market, our results are promising.
The ratio of the average win to the average loss was 1.92 and the profit factor (the number of
dollars won for every dollar lost) was 1.22. The system let profits run by staying in the winning
trades for 11 bars and cut losses short by staying in the losing trades for only four bars.
We optimized for the length of the moving average of volume and for the number of bars
forward the average is displaced. Figure 3 shows the resulting Optimization Report.

,OM[XKúçìú5VZOSO`GZOUTú8KVUXZúLUXúRKTMZNúULúJOYVRGIKSKTZú
)NGVZKXúæúúúúúú<URGZOROZ_ú(XKGQU[Zú9_YZKSY 6XOIKú*OYZXOH[ZOUTú9_YZKSúúúúúúúúúúâé

The best results were obtained with a 7-bar average displaced forward 7 bars. This combination
produced the best net profit, profit factor, and average trade, and the lowest maximum
drawdown. The bar graph shown in Figure 4 illustrates the effect on the size of the average trade
varying the length of the moving average of volume from five to nine.

,OM[XKúæìú(GXúMXGVNúLUXú5VZOSO`GZOUTú8KVUXZúULúRKTMZNúJOYVRGIKSKTZú

9[MMKYZOUTYúLUXú/SVXU\KSKTZ
We can almost certainly improve the performance of this system by optimizing the length and
the displacement of the moving average of closes. Another idea would be to average a price
other than the closing price. For example, would basing the moving average on the midpoints
of the bars be better than averaging the closes? Would it make sense for this system to
incorporate two displaced moving averages of price — one of the highs and the other of the
lows? In system development there is almost always something else to consider and to test,
some new possibility to be explored.

6XOIKú*OYZXOH[ZOUTú9_YZKS
Two concepts commonly used in statistics when referring to distribution of data are skewness
and Kurtosis. The concepts can be defined as follows:
Skewness: Returns the skewness of a distribution. Skewness characterizes the degree of
asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an
asymmetric tail extending toward more positive values. Negative skewness indicates a
âèúúúúúúúúúú6XOIKú*OYZXOH[ZOUTú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

distribution with an asymmetric tail extending toward more negative values. Figure 5 illustrates
this concepts:

,OM[XKúåìú9QK]TKYYúORR[YZXGZKJ

Kurtosis: Kurtosis characterizes the relative peakedness or flatness of a distribution compared


with the normal distribution. Positive kurtosis indicates a relatively peaked distribution.
Negative kurtosis indicates a relatively flat distribution. Figure 6 illustrates this concept:

,OM[XKúäìú1[XZUYOYúORR[YZXGZKJ

We can use Kurtosis to determine if the market is trending or choppy. When we have a normal
or peaked distribution (Kurtosis greater than 0) then we can assume that the market is going
sideways. When the distribution of prices is starting to flatten, that is a sign that the market is
starting to move directionally, so we can look to establish a position. When applying Kurtosis
to a distribution of prices, it will work in a similar fashion to the ADX; it will tell you whether
or not the market is moving sideways, but it will not tell you the direction.
Therefore, we will use skewness to determine in which direction the market is leaning. If the
distribution curve is displaced to the right (positive skewness), it would mean that the higher
prices have dominated. If the distribution curve is displaced to the left (negative skewness) then
we can assume that lower prices are dominating.
If we draw the distribution of prices of both a sideways and a directional market, we will see
that generally the sideways market will tend to have distribution that approaches a normal
distribution, or even a distribution with a positive Kurtosis; the concept of sideways market is
that the prices are condensing into a defined area and have market support and resistance zones
(the support and resistance zones would be the tails of the distribution). If a market is moving
)NGVZKXúæúúúúúú<URGZOROZ_ú(XKGQU[Zú9_YZKSY 6XOIKú*OYZXOH[ZOUTú9_YZKSúúúúúúúúúúâç

significantly in one direction, we can assume that the distribution will be much flatter than
normal (or negative Kurtosis) and that the prices will not linger in the same area for much time.
Figure 7 illustrates this concept:

,OM[XKúãìú6UYOZO\KúGTJúTKMGZO\Kú1[XZUYOY

So one way of trying to find the change in mode of the market is to follow the Kurtosis of the
last 40 closes. If the Kurtosis is positive, it probably means that the market is stagnant, and is
moving sideways. When Kurtosis crosses under zero, we can assume that the market is starting
to move in some direction, so we can use the skew to determine the direction in which the
market is thinner (has more support or resistance).
Our system will look for Kurtosis to cross under zero, and then if the skew is positive, we will
establish a long position. If the skew is negative, we will establish a short position.
To exit, we will apply a trailing stop to for both sides: once we enter the market on the buy stop,
we’ll calculate the 4-bar average of the range and subtract this value from the low. This will be
our long exit price for bar 2. On the subsequent bar, we’ll get the exit price calculated in the last
point and add to it a third of the difference between the low and the previous stop price.
Repeating this operation at the end of every bar will give us our exit price for bar 3 and beyond.
Likewise, once we enter the market on the sell stop, we’ll calculate the 4-bar average of the
range and add this value to the high. This will be our short exit price for bar 2. On the subsequent
bar, we’ll get the exit price calculated in the last point and subtract from it a third of the
difference between the previous stop price and the high. Repeating this operation at the end of
every bar will give us the exit price for bar 3 and beyond.

*KLOTOTMú_U[Xú:XGJOTMú8[RKY
In this system, we defined both long and short entries as well as exit orders. The long and short
entries reverse your position, whereas the exits close out your existing position and exit you
from the market. We also performed some setup work, which involved identifying the Inside
Day and subsequent breakouts. The setup, entry and exits are described next.
âæúúúúúúúúúú6XOIKú*OYZXOH[ZOUTú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

9KZ[Vú
a) Calculate Kurtosis and Skew.

2UTMú+TZXOKYú
a) Check for Kurtosis to cross under zero. If the skew is positive, we will establish a long
position.

9NUXZú+TZXOKY
a) Check for Kurtosis to cross under zero. If the skew is negative, we will establish a short
position.

+^OZú5XJKXY
a) Once the bar of entry of a long position has closed, calculate the 4-bar average of the range
and subtract this value from the low. This is our long exit price for bar 2.
b) On the subsequent bar, get the exit price calculated in the last point and add to it a third of
the difference between the low and the previous stop price. Repeating this operation at the end
of every bar gives us our exit price for bar 3 and beyond.
c) Once the bar of entry of a short position is closed, calculate the 4-bar average of the range
and add this value to the high. This is our short exit price for bar 2.
d) On the subsequent bar, we’ll get the exit price calculated in the last point and subtract from
it a third of the difference between the previous stop price and the high. Repeating this operation
at the end of every bar gives us the exit price for bar 3 and beyond.

*KYOMTOTMúôú,UXSGZZOTM
This section presents the EasyLanguage instructions and formatting for the system, with the
EasyLanguage instructions broken down and explained line by line.

+GY_2GTM[GMKú/TYZX[IZOUTY ú6XOIKú*OYZXOH[ZOUTúò9:'*úæ úú6XOIK*OYZñ

/TV[ZY ú1[XZ2KTòæêñîú9QK]2KTòéåñ!
<GXY úú36òêñîú9ZUV6XOIKòêñîú1[XZòêñîú9QK]\òêñ!
1[XZú#ú1[XZUYOYò)RUYKî1[XZ2KTñ!
9QK]\ú#ú9QK]ò)RUYKî9QK]2KTñ!
a+TZX_úUXJKXYc
/Lú1[XZúIXUYYKYú[TJKXúêúZNKTú(KMOT
/Lú9QK]\ú$úêúZNKTú
([_úZNOYúHGXúGZúIRUYK!
/Lú9QK]\ú"úêúZNKT
9KRRúZNOYúHGXúGZúIRUYK!
+TJ!
aú:XGOROTMúYZUVYúc
36ú#ú3GXQKZ6UYOZOUT!
/Lú36ú#úéúGTJú36AéCú"$úéúZNKT9ZUV6XOIKú#ú2U]úíú'\KXGMKò8GTMKîæñ!
/Lú36ú#úíéúGTJú36AéCú"$úíéúZNKT9ZUV6XOIKú#ú.OMNúïú'\KXGMKò8GTMKîæñ!
/Lú36ú#úéúZNKTú(KMOT
+^OZRUTMúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúïúò2U]úíú9ZUV6XOIKñëç!
+TJ!
)NGVZKXúæúúúúúú<URGZOROZ_ú(XKGQU[Zú9_YZKSY 6XOIKú*OYZXOH[ZOUTú9_YZKSúúúúúúúúúúâå

/Lú36ú#úíéúZNKTú(KMOT
+^OZYNUXZúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúíúò9ZUV6XOIKúíú.OMNñëç!
+TJ!

/TV[ZYú
Following is the list of the inputs we used in this system:

Inputs Default Description


KurtLenNumber 40 Number of bars used to calculate Kurtosis
SkewLenNumber 15 Number of bars used to calculate skew

In addition to these inputs, we identified the following variables:


<GXY úú36òêñîú9ZUV6XOIKòêñîú1[XZòêñîú9QK]\òêñ!

9KZ[V
The formulas for Kurtosis and skew are provided on your CD as functions, 1[XZUYOY and 9QK],
respectively. We begin by using the functions to calculate Kurtosis and skew and store the
values in variables:
1[XZú#ú1[XZUYOYò)RUYKî1[XZ2KTñ!
9QK]\ú#ú9QK]ò)RUYKî9QK]2KTñ!

2UTMúôú9NUXZú+TZXOKY
If Kurtosis crosses under zero, then we will assume that the market is changing from choppy to
directional, so we will look to establish a position; we will establish a long position if the Skew
of the prices is positive and a short position if the skew of the distribution of prices is negative.
/Lú1[XZúIXUYYKYú[TJKXúêúZNKTú(KMOT
/Lú9QK]\ú$úêúZNKTú([_úZNOYúHGXúUTú)RUYK!
/Lú9QK]\ú"úêúZNKT9KRRúZNOYúHGXúUTú)RUYK!
+TJ!

+^OZú5XJKXY
We will use a version of the trailing stops that we have used in previous volumes of the STAD
Club. We will use the variable 36 to store the value of the keyword 3GXQKZ6UYOZOUT. We do this
so that we can reference the values of 3GXQKZ6UYOZOUT of previous bars.
36ú#ú3GXQKZ6UYOZOUT!
If we are in a long position, and one bar ago we were not in a long position, then we will assign
the low of the current bar minus the 4-bar average range to the variable 9ZUV6XOIK.
/Lú36ú#úéúGTJú36AéCú"$úéúZNKT
9ZUV6XOIKú#ú2U]úíú'\KXGMKò8GTMKîæñ!
If we are in a short position, and one bar ago we were not is a short position, then we will assign
the high of the current bar plus the four bar average of the range to the variable 9ZUV6XOIK
/Lú36ú#úíéúGTJú36AéCú"$úíéúZNKT
9ZUV6XOIKú#ú.OMNúïú'\KXGMKò8GTMKîæñ!
If we are in a long position, we will place a stop order to exit from the position at the 9ZUV6XOIK
or anything lower. Then we will calculate a third of the distance between the low of the current
bar and the 9ZUV6XOIK and we will add that from the current stop price, the resulting value will
be the new 9ZUV6XOIK.
âäúúúúúúúúúú6XOIKú*OYZXOH[ZOUTú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

/Lú36ú#úéúZNKTú(KMOT
+^OZRUTMúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúïúò2U]úíú9ZUV6XOIKñëç!
+TJ!
If we are in a short position, we will place a stop order to exit from the position at the 9ZUV6XOIK
or anything higher. Then we will calculate a third of the distance between the the 9ZUV6XOIK and
the high of the current bar and we will subtracat that from the current stop price, the resulting
value will be the new 9ZUV6XOIK.
/Lú36ú#úíéúZNKTú(KMOT
+^OZYNUXZúTK^ZúHGXúGZú9ZUV6XOIKú9ZUV!
9ZUV6XOIKú#ú9ZUV6XOIKúíúò9ZUV6XOIKúíú.OMNñëç!
+TJ!

-KTKXGRú9_YZKSú,UXSGZ
When we apply this system to a chart, we normally use the options in the Format dialog box to
format costs, stops, and properties. However, in this system we did not enter an amount for
slippage and commission although those costs must certainly be taken into account before a
system is traded. We specified 1 as the default contract size to trade.
Note: Remember that Commissions are calculated on a per contract/share basis. When you are
trading stocks, you would enter the average commission you are charged divided by the number
of shares the system is buying and selling.
Under the Stops tab, we enabled a money management stop (the Money Mngmnt check box)
and entered an appropriate dollar amount in the edit box. This option can hold the dollar amount
per position or a dollar amount per contract/share you want to risk before exiting from the
position.
Note: When you are trading stocks and you choose the stop to be tracked on a per share
(contract) basis, you will type in the number of points you are willing to lose before you are
exited.When you are trading futures or any instrument that has a different dollar-point value,
you would type the maximum number of dollars you are willing to risk per contract traded.
In the Properties tab, we selected the option Do not allow multiple entries in the same
direction. If the system is in a long position, and market conditions generate another long entry
order, the order is ignored.

:KYZOTMúôú/SVXU\OTM
As you can see from Figure 8, this system has the typical results of a support and resistance
system. This system identifies areas of strong support and resistance levels (choppy segments)
by following the values of kurtosis, and when these levels start to weaken we will attempt to
establish a position in the direction which the market is moving. Knowing all this, we would
)NGVZKXúæúúúúúú<URGZOROZ_ú(XKGQU[Zú9_YZKSY 6XOIKú*OYZXOH[ZOUTú9_YZKSúúúúúúúúúúâã

probably want to improve on the percentage of winning trade, probably by improving how the
system picks the direction in which to enter the market.

,OM[XKúâìú9GSVRKú9_YZKSú8KVUXZúLUXúZNKú6XOIKú*OYZXOH[ZOUTú9_YZKS

Aside from this, the system appears to have a very strong ratio of average winning versus losing
trades, and essentially overall good results.

9[MMKYZOUTYúLUXú/SVXU\KSKTZ
In order to further filter out bad signals, you can change the entry orders to stop orders. This
way you can establish a long or short position only when the market follows through. This
should improve the percentage of wining trades, and somewhat (maybe) reduce the drawdown.
Alternatively, instead of looking for skew of the distribution to determine the direction of the
market, you can place a long entry stop order above the market (at the highest high of the last
6 bars) and a short entry stop order under the market. This way you will let the market tell you
in what direction it is moving.

'JJOZOUTGRú,UXS[RGY
1[XZUYOY
The formula for the Kurtosis function is quite complex. The mathematical formula is as follows:

The Kurtosis function is included on your CD and its EasyLanguage is described here. We will
use two inputs:
6XOIK <GR[KúUTú]NOINú1[XZUYOYú]ORRúHKúIGRI[RGZKJ
2KTMZN 4[SHKXúULúVUOTZYúòHGXYñúZUúHKúOTIR[JKJúOTúZNKúIGRI[RGZOUTúULú1[XZUYOY
ââúúúúúúúúúú6XOIKú*OYZXOH[ZOUTú9_YZKSúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

The EasyLanguage is as follows:


/TV[Z ú6XOIKòT[SKXOI9KXOKYñîú2KTMZNòT[SKXOIñ!
<GXY ú6éòêñîú6èòêñîú6çòêñîú'\Mòêñîú9ZJòêñ!
The following EasyLanguage instruction represents the first section of the formula:

6éú#ú2KTMZNðò2KTMZNïéñëòò2KTMZNíéñðò2KTMZNíèñðò2KTMZNíçññ!
The following EasyLanguage instruction represents the third section of the formula:

6çú#úçúðú9W[GXKò2KTMZNíéñëòò2KTMZNíèñðò2KTMZNíçññ!
We calculate the average and the standard deviation of the last 2KTMZN elements:
'\Mú#ú'\KXGMKò6XOIKîú2KTMZNñ!
9ZJú#ú9ZJ*K\9ò6XOIKîú2KTMZNñ!
Finally, we will calculate the second section of the formula. This involves a summation of the
4th power of each of the prices minus the average divided by the standard deviation. Here is the
formula and its EasyLanguage:

6èú#úê!
,UXú\GR[Kéú#úêúZUú2KTMZNíéú(KMOT
6èú#ú6èúïú6U]KXòò6XOIKA\GR[KéCí'\Mñë9ZJîúæñ!
+TJ!
1[XZUYOYú#ú6éúðú6èúíú6ç!

9QK]
The formula for skew is another complex statistical expression, following are both the math and
EasyLanguage versions:

We will use two inputs:


6XOIK <GR[KúUTú]NOINú1[XZUYOYú]ORRúHKúIGRI[RGZKJ
2KTMZN 4[SHKXúULúVUOTZYúòHGXYñúZUúHKúOTIR[JKJúOTúZNKúIGRI[RGZOUTúULú1[XZUYOY

/TV[ZY ú6XOIKò4[SKXOIñîú2KTMZNò4[SKXOIñ!
)NGVZKXúæúúúúúú<URGZOROZ_ú(XKGQU[Zú9_YZKSY 6XOIKú*OYZXOH[ZOUTú9_YZKSúúúúúúúúúúâá

Additionally, we will use the following variables in this function


<GXY ú9[SSòêñîú'\Mòêñîú9ZJòêñîú?òêñ!
We calculate the Average and the standard deviation of the last 2KTMZN elements.
'\Mú#ú'\KXGMKò6XOIKîú2KTMZNñ!
9ZJú#ú9ZJ*K\9ò6XOIKîú2KTMZNñ!ú
The following EasyLanguage line calculates this first section of the Skew formula:

?ú#ú2KTMZNúëúòò2KTMZNíéñúðúò2KTMZNíèññ!
The following for-loop will calculate this part of the statistical function:

9[SSú#úê!
,UXú\GR[Kéú#úêú:5ú2KTMZNíéú(KMOT
9[SSú#ú9[SSúïú6U]KXòò6XOIKA\GR[KéCúíú'\Mñúëú9ZJúîçñ!
+TJ!
9QK]ú#ú?úðú9[SS

9ZGTJGXJú*K\OGZOUT
Note that we use the 9ZJ*K\9 function (provided with version 4 of STAD Club) instead of the
9ZJ*K\ function provided with TradeStation. 9ZJ*K\() calculates the standard deviation of a
population, also referred as the “n” or the “biased” method. Kurtosis traditionally uses the
“unbiased” or “n-1” method for its calculations, this method is known as the standard deviation
using a sample, and we provide it through the 9ZJ*K\9 function. Following is the formula for
both functions:

Following is the EaysyLanguage function for Standard Deviation of a sample. Note that it is
identical to the Standard Deviation of a population provided with TradeStation ( StdDev ),
except that it divides the result into (Length - 1) instead of just dividing it into (Length):
/TV[ZYú ú6XOIKò4[SKXOI9KXOKYñî2KTMZNò4[SKXOI9OSVRKñ!
<GXYúúúú ú9[S9WXòêñî'\Mòêñî)U[TZKXòêñ!

/Lú2KTMZNú"$úêúZNKTú(KMOT
'\Mú#ú'\KXGMKò6XOIKî2KTMZNñ!
áêúúúúúúúúúúúúúúúúúúúú 5SKMGú8KYKGXINú9_YZKSú:XGJOTMúGTJú*K\KRUVSKTZú)R[Húíú<UR[SKúæ

9[S9WXú#úê!
,UXúIU[TZKXú#úêúZUú2KTMZNúíúéú(KMOT
9[S9WXú#ú9[S9WXúïúòú6XOIKAIU[TZKXCúíú'\Múñúðúòú6XOIKAIU[TZKXCúíú'\Múñ!
+TJ!
9ZJ*K\9ú#ú9W[GXK8UUZòú9[S9WXúëúòú2KTMZNúíúéúñúñ!
+TJ!
+RYKú
9ZJ*K\9ú#úê!
/4*+>
' 1
Additional Educational Resources ................................... 2 Keltner Channel System .................................................19
EasyLanguage Resource Center ............................... 2 Kurtosis ..........................................................................82
workshops ................................................................. 2
AT$ ................................................................................. 30 2
Limitation of Liability ......................................................2
( Linear Regression & Momentum System ......................25
Beta Down System ......................................................... 67
Beta Up System .............................................................. 64 3
Market Guide Fields .......................................................64
) Momentum-Retracement System ...................................46
Consecutive Close System ............................................. 39
Contents at a Glance ........................................................2 4
Counters ......................................................................... 23 Notice ...............................................................................2
NumUnits Function .........................................................62
*
Disclaimer ........................................................................ 2 5
Directional Movement Index (DMI) System .................. 12 Obtaining Technical Support ...........................................3
Displaced Moving Average & Volume System ............. 76 EasyLanguage Support Department ..........................4
STAD Club E-Mail Address .....................................4
+ Open Interest ..................................................................33
EasyLanaguage Support Department ............................... 4 Optimization .....................................................................5
EasyLanguage Resource Center .......................................2 avoiding over-optimization .......................................8
Educational Resources ..................................................... 2 choosing criteria ........................................................8
EasyLanguage Resource Center ............................... 2 number of tests ..........................................................8
workshops ................................................................. 2 simple numeric inputs ............................................... 6
E-Mail Address ................................................................ 4 stops ..........................................................................8
what is it? ..................................................................6
,
Functions 6
Kurtosis .................................................................... 82 Points ..............................................................................15
NumUnits ................................................................ 62 Price Distribution System ..............................................81
Skew......................................................................... 81
StdDev ..................................................................... 83 8
Fundamental Data Fields ............................................... 64 Resources .........................................................................2
EasyLanguage Resource Center ................................2
- workshops ................................................................. 2
General System Development Concepts.......................... 5
Getting Started ................................................................. 2 9
Simple Numeric Inputs, optimizing .................................6
. Skew ...............................................................................81
Herrick Payoff Index & Channel Breakout on Spread System, Beta Down ............................................67
Close System ................................................... 32 Spread System, Beta Up .................................................64
STAD Club E-Mail Address ............................................ 4
/ Stops, optimizing ..............................................................8
Important Notice ..............................................................2 Support & Resistance Systems........................................63
Installing ........................................................................... 2 Spread System, Beta Down .....................................67
Introduction ...................................................................... 1 Spread System, Beta Up ..........................................64
Investing a Fixed Dollar Amount ................................... 62
áèúúúúúúúúú/TJK^úúúúúúúúú

Systems
Consecutive Close ............................................... 39
Displaced Moving Average & Volume .............. 76
Directional Movement Index (DMI) ................... 12
Herrick Payoff Index & Channel Breakout on Close
32
installing ................................................................ 2
Keltner Channel .................................................. 19
Linear Regression & Momentum ....................... 25
Momentum-Retracement .................................... 46
Price Distribution ................................................ 81
Spread System, Beta Down ................................ 67
Spread System, Beta Up ..................................... 64
support & resistance............................................ 63
Three Exponential Moving Average Crossover . 56
trending ............................................................... 11
volatility breakout ............................................... 75

:
Technical Support ........................................................ 3
Three Exponential Moving Average
Crossover System ........................................ 56
Trending Systems ....................................................... 11
Consecutive Close ............................................... 39
Directional Movement Index (DMI).................... 12
Herrick Payoff Index & Channel Breakout
on Close ................................................ 32
Keltner Channel .................................................. 19
Linear Regression & Momentum ....................... 25
Momentum-Retracement .................................... 46
Three Exponential Moving Average Crossover . 56
Tying price to bar of entry ......................................... 30

<
Volatility Breakout Systems ...................................... 75
Displaced Moving Average & Volume .............. 76
Price Distribution ................................................ 81

=
What Can be Optimized ............................................... 6
Workshops ................................................................... 2

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy