<< . .

. 27
( : 30)

. . >>

with one of the three more responsive, dynamic stops, The parameter modeltype
selects the stop, and depending on which is to be tested, up to three other con-
trolling parameters are set and adjusted. For the two-bar highest-high/lowest-
low (HHLL) stop, the parameter (mmsrp) is the multiple of the average true
range that is added to or subtracted from the entry price to obtain the stop price
for the entry bar. The stop price on the entry bar is set to either the lowest low
of the last two bars or the entry price plus or minus the specified multiple of the
average true range, whichever is further away from the current market price. For
the other two kinds of stops (ATR-based and MEMA), the stop price on the entry
bar is initialized to the usual value, i.e., the entry price minus (long) or plus
(short) the money management stop parameter (mmsrp) multiplied by the aver-
age true range.
On each bar after the entry bar, the stop price is adjusted. The adjustment
used depends on the particular type of stop being employed, as selected by the
modeltype parameter. For the HHLL stop, the highest high or lowest low is cal-
culated according to whether the position is short or long (respectively). If the
result of the calculation is closer to the current market price than the current stop
price is, then the current stop price is replaced with the new value. For the next
model (dynamic ATR-based stop), a second money management stop parameter
(srpa) is multiplied by the average true range. Then the resultant number is sub-
tracted from (long) or added to (short) the current closing price. If the resultant
number is closer to the market than the current value of the stop price, the stop
price is replaced with that number and, therefore, moved in closer to the market.
For the third type of stop (MEMA), a stop parameter (stpa) is multiplied by the
average true range, and then subtracted from the current high (longs) or added to
the current low (shorts) as a kind of offset. The stop price is then subtracted from

the resultant number. The result of this last calculation is placed in a variable
(nap). The stop price is updated on successive bars by adding tmp multiplied by
another parameter (sfpb, a correction rate coefficient) to the existing stop price.
The current stop price is adjusted, however, only if the adjustment will move the
stop closer to the current price level. The computations are identical to those used
when calculating an exponential moving average (EMA). The only difference is
that, in a standard exponential moving average, the stop price would be correct-
ed regardless of whether the correction was up or down and there would be no
offset involved. In this model, stpb determines the effective length of an expo-
nential moving average that can only move in one direction, in toward the prices.

Test of Highest-High/Lowest-Low Stop
In this test (modeltype = l), tire initial money management stop parameter con-
trols the maximum degree of the stop™s tightness on the first bar. It is stepped from
0.5 to 3.5 in increments of 0.5.
Each row in Table 14-2 presents data on the in-sample performance of each
of the values through which the parameter was stepped (ZNSTP). The last row
describes the behavior of the model with the best parameter value (as found in the
stepping process) retested on the out-of-sample data. Table 14-2 may be interpret-
ed in the same way as the other optimization tables presented in this book, in the
table, DRAW represents drawdown, in thousands of dollars.
This stop appears to have been consistently too tight, as evidenced by a decreased
percentage of winning trades when compared with the baseline MSFS model. In the
previous test, the best solution (mmcrp parameter 1.5, ptlim parameter 4.5) had 39%
wins, had a risk-to-reward ratio of - 1.46, and lost an average of $1,581 per trade. In
the current test, the best solution has only 28% of the trades winning in-sample and
29% out-of-sample. Many potentially profitable trades (some of the trades that would
have been profitable with the basic MSES, using an optimal fixed stop) were convert-
ed to small losses. The tightness of this stop is also demonstrated by the total number
of bats the average trade was held (4), compared with the usual 6 to 8 bars. The aver-
age risk-to-reward ratio (-2.52 in-sample and -2.38 out-of-sample) and the average
loss per trade ($1,864 in-sample, $1,818 out-of-sample) have also significantly wors-
ened when compared with the optimal fixed stop. The 2-bar HI-ILL stop is obviously
no great shakes, and one would be better served using a fixed, optimally placed stop,
like that which forms part of the MSES when used with optimized parameters, such
as those discovered and shown in the test results in Table 14-1.

Test of the Dynamic ATR-Based Stop
In this model, the two parameters (represented in the code as mmsip and apa) are
multipliers for the average true range. They are used when calculating placement of
the stop on the entry bar and later bars, respectively. The entry bar stop parameter


Portfolio Performance for the l-Bar Highest-High/Lowest-Low Trailing
Stop with the Optimal Fixed Profit Target Found in Table 14-l

2.50 [ -32591 -15111 -1748l -22.41 -2.381 1.000˜ 17931 281 -1SlSl
0.711 34501 4

(FIRST in Table 14-3) and the parameter for the stop after the entry bar (LATER) are
both stepped from 0.5 to 3.5 in increments of 0.5.
As with the previous tests of stops, the parameters had a gradual effect on
performance and did not interact with one another to any great extent. An exami-
nation of the average performance for each value of the entry bar stop parameter
reveals that the best results, in terms of risk-to-reward ratio, were obtained when
that parameter was set to 2. For the parameter that applied to later bars, the best
average result was achieved with values of either 2 or 2.5. For individual combi-
nations of parameters, a FIRST parameter of 2 and a LATER parameter of 2.5 pro-
duced the best overall performance, with the least bad risk-to-reward ratio and
nearly the smallest loss per trade. This stop model was marginally better than the
optimal fixed stop, used as a baseline, that had a risk-to-reward ratio of - 1.46, as
opposed to - 1.40 in the current case. As in Table 14-1, the best solution is shown
in boldface type. The percentage of winning trades (42%) was also marginally bet-
ter than that for the optimal fixed stop (39%).

Test of the MEMA Dynamic Stop
There are three parameters in this model: the initial money management stop pxa-
meter, which sets the stop for the first bar; the ATR offset parameter (ATRO in
Table 14-4); and the correction or adaptation rate coefficient (COEFF), which
determines the relative rate at which the stop pulls in to the market or, equivalently,
the speed of the modi@ed exponential moving average underlying this model. All
three parameters are optimized with an extensive search.
Table 14-4 shows portfolio performance only as a function of the ATR offset
and the adaptation rate coefficient, the most important parameters of the model.
The initial stop parameter was fixed at 2.5, which was the parameter value of the
optimal solution.

Portfolio Performance as a Function of First-Bar and Later-
Bar Stop Parameters Using the Dynamic ATR-Based Stop-
Loss Model

Again, the model responded in a well-behaved manner to changes in the para-
meter values. There was some interaction between parameter values. This was
expected because the faster the moving average (or adaptation rate), the greater the
average true range offset must be to keep the stop a reasonable distance from the
prices and achieve good performance. The best overall portfolio performance (the
boldfaced results in Table 14-4) occurred with an ATR offset of 1 and an adaptation
rate coefficient of 0.3 (about a 5-bar EMA). Finally, here is a stop that performed
better than those tested previously. The risk-to-reward ratio rose (- 1.36), as did the
percentage of winning trades (37%) and the average trade in dollars ( - $1,407).

This test is the best stop thus far produced: The MEMA stop had an initial money
management parameter of 2.5, an average true range offset of 1, and an adaptation
rate coefficient of 0.30. In the original MEMA test above (the results reported in
Table 14-4), the optimal fixed profit target was used. In the current test, the optimal
fixed profit target is replaced with a shn™nking profit target, i.e., one that starts out
far away from the market and then pulls in toward the market, becoming tighter
over time. The intention is to try to pull profit out of languishing trades by exiting
with a limit order on market noise, while not cutting profits short early in the course
of favorably disposed trades. The approach used when constructing the shrinking

TABLE 14-4

Portfolio Performance of the EMA-Like Dynamic Stop as a Function
of the ATR Offset and Adaptation Rate Coefficient with an Initial Stop
Parameter of 2.5 ATR Units

profit target is very similar to the one used when constructing the MEMA stop. An
exponential moving average is initialized in an unusual way; i.e., the running sum
is set to the entry price plus (long) or minus (short) some multiple @Tim) of the
average true range. In this way, the profit target limit begins just as the fixed profit
target limit began. After the first bar, the price at which the limit is set is adjusted
in exactly the same way that an exponential moving average is adjusted as new bars
arrive: The distance between the current limit price and the current close is multi-
plied by a parameter @rga). The resultant number is then subtracted from the cur-
rent limit price to give the new limit price, pulling the limit price in tighter to the
current close. In contrast to the case with the stop, the limit price is allowed to move
in either direction, although it is unlikely to do so because the limit order will take
the trade out whenever prices move to the other side of its current placement. The
second parameter (p&z) controls the speed of the moving average, i.e., the shrink
age rate. The rules are identical to those in the test of the MEMA stop above, except
as they relate to the profit target limit on bars after the first bar.

limprice = entryprice + ptlim l atr;

stpprice = min ˜Lawest˜lo, 2, cbl,

entryprice mstp + atr,;


case 2:

case 3:

case 4:

limprice = entryprice + ptlim * atr;

stpprice = entryprice mmtp * atr;


stpprice = max (Highestthi. 2, cb),
entryprice + mwtp * atr);
case 2:
case 3:
case 4:
limprice = entryprice ptlim l atr;

stpprice = entryprice + nmletp f atr;

default: nrerror("mvalid modeltype");
ts.exitshortlimit('C', limprice);
ts.exitshortstop('D', stpprice);
else (

stpprice = max(stpprice, Lowesf(lo,Z,cb));
case 2:
stppcice = max(stpprice, cls[cbl -stpa*atr);
case 3:
trap = tbiicbl atpa * at=) - stpprice;
if(tmp > 0.0) stpprice += stpb l tmp;
case 4:
mp = ChiIcbl sepa * atrl sfpprice;
if(tmp > 0.0) stpprice += stpb * tmp;
limprice = limprice - ptga'(limprice-cls[cbl);
ts.exiflonglimit('F', limprice);
ts.exitlongstopC'G', stpprice);
if(cb-entrybar >= maxhold) ts.exitlongclose('E'l;
else if(ts.positionO < 0) ( // shorts
ewitch(modeltype) (
case 1:
stpprice = min(stpprice, Highesf(hi,P,cb));
case 2:
stpprice = min(stpprice, cls[cbl+stpa*atr);

case 3:

ts.exitshortatop(˜J™, stpprice);

if<&-entrybar >= maxhold) ts.exitshortclose(˜H™);



The code fragment above shows the implementation of the shrinking limit,
along with the MEMA stop reported in Table 14-4.
Table 14-5 provides information on the portfolio performance as the initial
profit target limit @lim in the code, INIT in the table) and the shrinkage coeffi-
cient @&a in the code, COEFF in the table) are varied. The parameter that con-
trolled the initial placement of the profit target, in average tree range units away
from the price, was stepped from 2 to 6 in increments of 0.5. The shrinkage coef-
ficient was stepped from 0.05 to 0.4 in increments of 0.05. The best combination
of parameters produced a solution that was an improvement over the fixed profit
target limit. The risk-to-reward ratio became - 1.32, the percentage of winning
trades remained the same at 37%, but the average loss per trades was less at
$1,325. Again, the model was well behaved with respect to variations in the para-
meters. The results indicate that care has to be taken with profit targets: They tend
to prematurely close trades that have large profit potential. As can be seen in Table
14-5, as the initial profit target placement became tighter and tighter, the percent-
age of winning trades dramatically increased, as more and more trades hit the prof-
it target and were closed out with a small profit. On the down side, the
risk-to-reward ratio and the average worsened, demonstrating that the increased
percentage of winning trades could not compensate for the curtailment of profits
that resulted from the tight profit target. Sometimes it is better to have no profit
target at all than to have an excessively tight one. The same was tme for the shrink-
age rate. Profit targets that too quickly moved into the market tended to close
trades early, thereby cutting profits short.

In all the tests conducted so far, a position was held for only a maximum of 10
days. Any position that still existed-that had not previously been closed out by
Portfolio Performance as a Function of the initial Profit Target Limit
Placement and the Shrinkage Coefficient

the stop or profit target-was closed out after 10 days, regardless of its profitabil-
ity. In this test, an exit strategy that uses an adaptive MEMA stop, with optimal
parameters and a shrinking profit target, is examined. The only difference between
the test reported in Table 14-6 and the one reported in Table 14-5 is in the exten-
sion of the maximum time a trade may be held, from 10 to 30 days. The initial
profit target limit is reoptimized by stepping it from 5 to 7 in increments of 0.5.
Likewise, the shrinkage rate coefficient is stepped from 0.05 to 0.4 in increments
of 0.05. The code is the same as for the previous test. Only the setting of the max-
hold parameter, which controls the maximum time a trade may be held, is
The best performance was achieved with an initial target parameter of 5.5
and a shrinkage coefficient of 0.1. The average risk-to-reward ratio went from
- 1.32 to ˜ 1.22. The percentage of wins remained the same, but the average trade
lost only $1,236, rather than $1,325 in the previous test. Extension of the time
limit improved results, but not dramatically. Most trades were closed out well
before the time limit expired; i.e., the average trade only lasted between 6 and 10
bars (days).

Table 14-7 reports on performance broken down by market for the best exit strat-
egy discovered in these tests, i.e., the one that used the MEMA stop and the
shrinking profit target and in which the time limit was extended to 30 days. Both
in- and out-of-sample results are presented, and consistency between the two can

Portfolio Performance as a Function of the Initial Profit Target Limit
Setting and the Shrinkage Coefficient When the Trade Limit Is
Increased to 30 Days
be seen.
In both samples, profits for the NYFE occurred on the long side, but not on
the short. Substantial profits occurred in both samples for Feeder Cattle-for long
and short positions in-sample, but only for short positions out-of-sample. Live
Hogs were profitable in both samples for both long and short positions. The
Deutschemark and Japanese Yen showed profits in-sample on the long side, but
had overall losses out-of-sample. The only exception was a small profit in the
Japanese Yen on the short side, but it was not enough to overcome the losses on
the long side. Lumber was strongly profitable on the long side in-sample, but only

TABLE 14-7

Performance Broken Down by Market for Best Exit Strategy
with EMA-Like Stop, Shrinking Profit Target, and Trade Time Limit
Extended to 30 Days
332 PART III The Study of Exits

had a very small profit on the long side out-of-sample. The two most outstanding
performers were Feeder Cattle and Live Hogs which, even despite the random
entries, could actually be traded. In-sample, there was a 10.9% annualized return
for Feeder Cattle and a 15.5% return for Live Hogs. Out-of-sample, the returns
were 43.1% and 3 1.9%, respectively. There were more profitable results out-of-
sample than in-sample, but this could easily have been due to the smaller sample
and fewer trades taken in the out-of-sample period.

Exits do make a big difference. By improving the risk management and profit tar-
get elements in an exit strategy, losses can be cot and the risk-to-reward ratio can
be enhanced. The improvements in the tests above, however, were not as good as
expected. For example, although the best exit did appear capable of pulling prof-
its from random trades taken in two markets, no profits were obtained on the port-
folio, which is somewhat inconsistent with our earlier experiences (Katz and
McCormick, March 1998, April 1998) in which profitable systems were achieved
with random entries on the S&P 500. In those studies, exits were toned to the mar-
ket under examination, rather than keeping parameters constant across an entire
portfolio as done in the investigations above. This difference may account for the
poorer results in the current set of tests. In general, better results can be obtained
(albeit with much greater risk of curve-fitting and over-optimization) by tuning the
various components of a trading model to the specific characteristics of an indi-
vidual market. It should also be kept in mind that the tests conducted here were
fairly harsh with respect to transaction costs. For some markets (e.g., the S&P
500), commissions are almost negligible in terms of its typical dollar volatility,
and only slippage is a factor. However, in many smaller markets, great numbers of
contracts would have to be traded, causing the issue of commissions to become a
very significant consideration. In our earlier study, little or no transaction costs
were assumed, and a market in which the commission component would be fairly
small (i.e., the S&P 500) was examined. This factor may also have contributed to
the difference in findings.
When compared with the standard exit strategy used in the tests of entry
methods, which lost an average of $2,243 per trade and had a standard deviation of
$304, the best exit strategy thus far developed reduced the loss per trade to $1,236,
representing a reduction in loss per trade of over 44%. The reduction is substantial
enough that many of the better (albeit losing) entry models would probably show
overall profitability if they were combined with the best exit strategy.


. Exits can make a substantial difference in overall performance. The
attempts described in this chapter have yielded an extra $1,000 per trade
over the standard exit strategy used in tests of entry models.
. Just as with entries, finding a good exit is like searching for a tiny island
of inefficiency in a sea of &cient market behavior. While such islands

<< . .

. 27
( : 30)

. . >>