[ Pobierz całość w formacie PDF ]
Stocks & Commodities V. 20:8 (46-56): Developing A Trading System by Dennis D. Peterson
SYSTEM DESIGN
Combining Stochastic RSI And Bollinger Bands
Developing A Trading System
If you’ve ever tried it, you know that developing a trading
system is no easy task. But you may find that following a series
of steps could help you reduce the learning curve. Here’s an
example.
encode visual signals. In this article I will take two of the
better-known technical indicators and go through the steps
involved in developing a trading system.
The two indicators I will be using are Bollinger Bands
and stochastic relative strength index (StochR
SI
). StochR
SI
,
which combines the features of stochastics and R
SI
, was
detailed in Tushar S. Chande and Stanley Kroll’s book,
The New Technical Trader.
I selected this combination
because it is a useful way to determine when prices will
stop tagging a Bollinger Band and are likely to move all
the way from one band to the next. Of course, those prices
may not move all the way, so you will need to use stops for
protection. You will also want to use a simple money
by Dennis D. Peterson
T
here are three key features when it comes to
developing a trading system: entry and exit
signals, a plan for the type of stop, and a money
management strategy. The first involves
generating the signals, which can be purely
visual, a result of technical indicators, or a combination of
both. Most mechanical trading systems use indicators to
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 20:8 (46-56): Developing A Trading System by Dennis D. Peterson
management strategy of allocating only a portion of your
capital to any one position.
P
AY
ATTENTION
TO
THE
MARKET
:
U
SE
MONEY
MANAGEMENT
Since there is no crystal ball when it comes to the markets, it’s
important to protect yourself by using stops and money
management methods. You spread your risk with money
management; for example, you might decide to only invest
10% of your total capital in any one position.
Remember that not all stocks trade in the same fashion.
One group of stocks might do better than another, making it
necessary to build watchlists of stocks to compare your
system’s performance. You also need to realize that just as
individual stocks behave differently within a single market,
each market also behaves differently from the others.
The commodities markets are generally a more closed
G
ROUND
RULES
:
THE
BIGGER
PICTURE
First, let’s take a look at R
SI
and StochR
SI
. Stochastics, you
will recall, is simply a way of measuring, for a given period
of time, where today’s close is relative to the lowest low, and
where within the range of the highest high and lowest low the
price falls over the same time period. The formula for
stochastics for a 14-day period is:
Today's close – Lowest low of the last 14 days
Highest high of the last 14 days – Lowest low of the last 14 days
Note the use of range — high minus low
— in the denominator of the calculation.
Many trading techniques and strategies
are built around range in some form, and
if you use several indicators, you want
independent sources, so that the indicators
independently confirm one another.
Independent confirmation is one part
of Dow theory you should consider
embracing. For example, Larry Williams’
%R is the reverse of stochastics,
substituting the difference of highest high
over a given period minus today’s close
for the numerator. So if you want to use
this indicator together with stochastics,
you are not using independent indicators.
Instead, you should consider using an
indicator that does not involve a range,
such as volume, or one that is statistical in
nature, such as Bollinger Bands.
The next step is to identify the type of
stock that will work best. If you are
going to use an indicator that relies on price volatility such as
StochR
SI
, then you should examine your charts to see the
nature of the current volatility. For example, I have used A
OL
Time Warner (A
OL
) in Figure 1.
What differentiates the four
areas (A, B, C, and D) is the combination of price and volume
volatility. Area A has low price and high volume volatility.
Area B has both high price and volume volatility. Area C has
high price volatility, and low volume volatility for the stock.
Finally, area D has moderate volume and price volatility.
A useful rule to remember is that a price is “in gear” — that
is, in sync —
if price goes up on high volume or down on
lowered volume. Prices that reflect such moves are prices that
the market is comfortable with. If you were long in area A or
short in area D, you would have done well. A trading system
designed for areas A and D — “in-gear” moves — is likely to
have a terrible time in areas B and C. As you will discover
shortly, A
OL
represents the good, the bad, the ugly, and the
really
ugly when it comes to using a trading system that only
takes long positions.
B
C
D
FIGURE 1: DAILY AOL PRICE AND VOLUME.
Price volatility is less before June 1998. For indicators that use price
volatility such as StochRSI, you want to use fewer periods in the calculation to generate trading signals than you w
ould
prior to June 1998.
system: The price of pork bellies is less dependent on earnings
figures stated by accounting firms than, say, a company
traded on a stock exchange would be. Even among stock
exchanges, trading systems generate different results. A
system that takes long positions on extreme gapdowns, for
example, might produce a few trades a year for stocks traded
on the New York Stock Exchange (N
YSE
), while producing
many more trading the Nasdaq.
Within a given exchange, the behavior of an individual
stock — or possibly almost the entire exchange if it contains
similar stocks — can change because of shifts in expectations.
Remember that the market participants’ expectations are a
major factor in shaping the market’s behavior, and when you
start analyzing them, the apparent randomness of the markets
starts to disappear.
In addition, keep in mind that it is difficult to predict what
the market will do. Sideways price movements accompanied
by low volume will be random in nature and can be detrimental
to your trading capital, as you will see in a later example. You
Copyright (c) Technical Analysis Inc.
A
Stocks & Commodities V. 20:8 (46-56): Developing A Trading System by Dennis D. Peterson
should always trade stocks that have
trading volumes above 500,000 shares
per day, or even better, those that trade
above one million shares daily, on
average. Thus, this trading system is for
swing traders, not scalpers (who trade
noise).
RSI moves slowly and is indecisive
about staying above the black line
Within this green box StochRSI hits its extreme
faster than RSI and stays up better, i.e. above black line
RSI
VS
. S
TOCH
RSI
If you compare R
SI
and StochR
SI
measurements over a few months, you
will notice a difference: One of them
will hit the extreme faster and tend to
stay near the extreme better than the
other. The formula for StochR
SI
for a
14-day period is:
RSI – Lowest RSI over the last 14 days
Highest RSI over the last 14 days –
Lowest RSI over the last 14 days
FIGURE 2:
DAILY AOL PRICE AND VOLUME 2000 WITH RSI (TOP CHART) AND STOCHRSI (SECOND FROM TOP
CHART).
StochRSI not only responds quickly to price changes, but also hits its extreme and stays there better t
han
RSI (see green boxes); 14-day periods are used for both RSI and StochRSI
.
If you build this indicator, of course,
you can make the R
SI
use a 14-day
period or you can, for example, make the R
SI
based on a nine-
day period and retain the 14 days for the stochastics portion.
As you can see from Figure 2, StochR
SI
does a better job of
hitting its extreme and staying there than R
SI
does. StochR
SI
allows you to draw a line that acts as a threshold line better
than R
SI
(black lines drawn within green boxes). While both
R
SI
and StochR
SI
range between zero and one — although
cosmetic adjustments are made to R
SI
so it appears to range
between zero and 100 — StochR
SI
hits its extreme faster
because you are only looking at the R
SI
over a recent lookback period. Still,
there are times, as in April, when
StochR
SI
gives you a mixed message.
This is where Bollinger Bands can help.
If you overlay price with Bollinger
Bands, as in Figure 3, you begin to get
an idea of the setup for a long position:
Act when prices are tagging the lower
band (point A) with a move up (point
B), while StochR
SI
shows a significant
gain in value (point C).
However, this setup has potential
problems for long trades; look at the red
box in the chart. In April and May 2000,
you have examples of prices tagging the
lower band and then closing above. In
one instance (event D), StochR
SI
would
potentially give a confirming signal that
you should go long, but then prices go
back down to the lower band. This is an
example of the problem I referred to
earlier, that low volume is often
accompanied by randomness. Note that volume in late April
and May is significantly lower than in the preceding time
frame. I will try to incorporate some rules into the trading
system to account for this, but in such a situation it is often
best to exit and find another stock.
I will now execute a trading system, without stops and
money management, to see what it can do. The trading
system is going to have the following trading rules for a long
position:
D
C
B
A
FIGURE 3: DAILY AOL AND VOLUME AND STOCHRSI (UPPER CHART): FEBRUARY/JUNE 2000.
A 20-day, two
standard deviation Bollinger Band is overlaid on the price chart. On the left hand side is a setup that promises to enter
a long position. It starts with prices tagging the lower band, event A. Prices close above the lower band, event B, and at
the same time StochRSI has moved up to a value of 0.4, event C. What is distressing is the action in the red box, especially
in view of event D, a spike in StochRSI and a close above the lower band followed by a retreat of prices. But if you look
at volume below, the problem mentioned earlier is obviously apparent: low volume giving you a random price movement.
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 20:8 (46-56): Developing A Trading System by Dennis D. Peterson
Entry:
1 Look for prices tagging the
lower Bollinger Band
2 Look for a closing price of an
up day, that is (close>open),
that is above the lower band
after having prices follow (1)
3 Volume of this up day should
be greater than the volume of
the previous up day
4 StochR
SI
should be above a
threshold to ensure some mo-
mentum is associated with the
push up
5 The (close-open)/(high-
low)>0.2, to avoid days that
have short candlestick bodies.
A
B
C
D
Exit:
1 StochR
SI
should be less than
a threshold to assure loss of
momentum
2 Look for prices to reach the
upper band
3 Closing price should be near
the top Bollinger Band.
FIGURE 4: DAILY AOL AND VOLUME WITH EQUITY PERFORMANCE.
Starting with $1,000, a trading system that
goes long using Bollinger Bands and StochRSI is seen to have four trading behaviors, as indicated by areas A, B, C,
and D. Note the equity scales are X10. The second chart from the top is the equity performance without stops. In area
A, the system makes little money despite rising prices, breaks even in B, has a better performance in C, and then
performs poorly during D. Even area C is not especially appealing because you are faced with serious drawdowns,
unless you use stops (as seen in top chart). The top chart, using maximum stop-losses of 5%, provides better
performance.
move to the upper band, resulting in a trading system that
can do much better than buy and hold. But letting thresholds
optimize curve-fits the performance too much, so I set the
thresholds visually.
To get rid of the serious drawdowns, I used maximum-
loss stops of 5%, which improved the equity performance
(Figure 4: top chart). Still, area B just eats away at your
equity, although it does appear I took care of the low-
volume problem in area C.
You are looking for the stock to continue up if it has been
tagging a lower Bollinger Band and then made a convincing
move up, so that it conforms to entry rules 2 through 5 above.
I used weighted closes in calculating the Bollinger Bands:
(2*close+high+low)/4.
From Figure 4
you can see that investing $1,000 in 1997
and using this trading system without stops resulted in $58,000
(second chart from top), which beat buy/
hold by more than $47,000. However,
there are serious drawdowns in each of
the areas B, C, and D. The only factor
that varied in this trading system was the
number of periods for StochR
SI
and
Bollinger Bands. When using the initial
version of this system I optimized the
StochR
SI
thresholds as well. The equity
looked better in terms of drawdowns
and ended up with $300,000+, which
led me to believe that there might be
something to this approach.
Optimizing on everything — from
periods to thresholds — results in
spectacular equity performance (Figure
5), and although it is curve-fitting, it
shows the potential you are trying to
achieve. It also shows the trading system
is biased to take advantage of strong
uptrends: During uptrends, prices that
tag the bottom Bollinger Band will
FIGURE 5: DAILY AOL AND VOLUME WITH EQUITY PERFORMANCE FOR AREA A.
A $1,000 equity investment
reaches $45,000+, while buy and hold reaches $20,000+. While this kind of equity performance (top chart) is
spectacular, it comes from letting all the variables in the trading system be optimized —
curve-fitting
. What this shows,
however, is the potential of the system if the periods and thresholds are chosen correctly, along with the right (strong
uptrend) price movement. It also reflects the bias of the trading system, which takes advantage of the fact that in a strong
uptrend, prices that tag the lower Bollinger Band do so only briefly.
Copyright (c) Technical Analysis Inc.
Stocks & Commodities V. 20:8 (46-56): Developing A Trading System by Dennis D. Peterson
METASTOCK AND WEALTH-LAB SCRIPT
Here is the MetaStock script I captured for the StochR
SI
trading system, with explanations from MetaStock’s Help
function (the “syntax,” “function,” and “example” text). I
have also annotated the various sections of code with my
comments in italics.
Following that is the Wealth-Lab script. My thanks to
Wealth-Lab developer Dion Kurczek for writing the Wealth-
Lab chartscript.
adjust1:= rdv1-rdp1+11;
adjust1:=if(adjust1<8,8,adjust1);
adjust1:=if(adjust1>12,12,adjust1);
adjust2:=rdv1-rdp2+14;
adjust2:=if(adjust1<12,12,adjust2);
adjust2:=if(adjust1>20,20,adjust2);
ENTRY CONDITIONS
periods:=adjust1;
BBpds:=adjust2;
METASTOCK CODE
Fix the periods for finding the standard deviations
(standarddev) and the number of periods used in RSI:
Both thresholds (
howclosetoBBbot
and
longthresholdentry
)
need to be a factor of either
adjust1
or
adjust2
, but here they
will be set to constants, and I will substitute in the code of
what I want to use.
standarddev:= 60;
periods:= 14;
LLV is the lowest low value: see below.
howclosetoBBbot:=0.9;
longthresholdentry:=0.3;
Here is the explanation from MetaStocks’s Help function:
wprice:=(2*C+H+L)/4;
deviations:=.0625*BBpds+0.75;
Syntax
LLV( Data Array, Periods )
Function
Calculates the lowest value in the Data Array over
the preceding Periods (Periods includes the cur-
rent day).
Example
The formula “LLV( Close, 14 )” returns the lowest
closing price over the preceding 14 periods.
StochRSI:=(RSI(periods)-LLV(RSI(periods),periods))/
(HHV(RSI(periods),periods)-LLV(RSI(periods),periods));
Syntax
BBandBot(Data Array, Periods, Method, Devia-
tions )
Function
Calculates the bottom Bollinger Band of data array
using method calculation method and shifted down-
ward deviation standard deviations. Valid methods
are simple, exponential, weighted, time series,
triangular, and variable (these can be abbreviated
as S, E, W, T, TRI, and Var).
Example
BBandBot(close, 10, S, 2 )
HHV does a like thing for highest high value:
StochRSI:=(RSI(periods)-LLV(RSI(periods),periods))/
(HHV(RSI(periods),periods)-LLV(RSI(periods),periods));
Syntax
round( Data Array )
Function
Rounds Data Array to the nearest integer.
Example
The formula “round( +10.5 )” returns +11. The
formula “round( -10.4 )” returns -10.
Syntax
BBandTop(Data Array, Periods, Method, Devia-
tions )
Function
Calculates the top Bollinger Band of data array
using method calculation method and shifted up-
ward deviation standard deviations. Valid methods
are simple, exponential, weighted, time series,
triangular, and variable (these can be abbreviated
as S, E, W, T, TRI, and Var).
Example
BBandTop( close, 10, S, 2 )
Syntax
stdev( Data Array, Periods )
Function
Calculates the predefined Standard Deviation indi-
cator.
Example
stdev( Close, 21 )
Use the rounding functions to get an integer to be used for
periods:
botpercentage:=Abs((wprice-
BBandBot(wprice,BBpds,S,deviations))/
(BBandTop(wprice,BBpds,S,deviations)-
BBandBot(wprice,BBpds,S,deviations)));
rdp1:=Round(Stdev(stochrsi,standarddev)/.053);
rdp2:=Round(Stdev(stochrsi,standarddev)/.035);
rdv1:=Round(Stdev(Mov(V,periods,S)/
1000000,standarddev));
{entry conditions}
entry1:=botpercentage-howclosetoBBbot<0.3;
I need two adjustments. If the initial calculation is less than
8, then set adjust1 to 8, and if it’s greater than 12, set
adjust1 to 12. This is because I want RSI to range between
eight and 12 periods. Similarly for adjust2, if the initial
calculation is less than 12, then set it to 12, and if greater
than 20, set it equal to 20. This way the Bollinger Band
periods will range between 12 and 20.
The constant 1.05 in the following statement may also need
adjustment, but will require further testing.
entry2:=C*1.05>BBandBot(wprice,BBpds,S,deviations) and
StochRSI>longthresholdentry;
volbb:=If(C>Ref(C,-1),V,0);
Copyright (c) Technical Analysis Inc.
[ Pobierz całość w formacie PDF ]

  • zanotowane.pl
  • doc.pisz.pl
  • pdf.pisz.pl
  • xiaodongxi.keep.pl