where 256 2.27:
P= (P+ HM te + CAH _Cy(4) 236
   GAMBLING TECHNIQUE—THE THEORY OF RUNS 567
 
There is a single chance that there will be a run greater than 6 in 256 tries. The aver-age length of a run greater than 6 turns out to be 8, based on the decreasing probability ofoccurrences of longer runs. The average length of all runs greater than 7 will be 7+ 2. Thatmakes the table of runs complete, with the number of occurrences of red equal to 128.
Martingales and Anti-Martingales
The classic application of the Theory of Runs is called Martingales, In the simple versionof this approach, an initial bet is doubled each time a loss occurs; whenever there is a win,the betting begins again at the initial size. To demonstrate how this works, it is necessaryto use a table of uniform random numbers (which can be found in Appendix 1), Thesenumbers vary from 0 through 9. Let all those numbers beginning with digits 0 through 4be assigned to red and 5 through 9 to black. Figure 22-4, read left to right, where opensquares are red and solid squares are black, shows the first 257 assignments according toAppendix 1. Assuming that we bet on black, lasses will depend on the longest run of red.We must decide the size of the initial bet in advance, which should be as large as possibleand still withstand the longest run of red that is likely to occur. By using the results fromthe analysis of the length of runs, we find that for every 256 coups, it is likely that only onerun greater than 6 will occur, and that run would most probably be 8 in length. The prob-ability of a run of 9 is (4)"', or 1 in 1,024. In 256 coups, the odds are about 3 to 1 against arun of 9 occurring.
Having decided that capitalization must withstand a run of 8, we calculate that a bet of$1 doubled 8 times is $128. Divide the maximum amount of money to be risked by 128 andthe result is the size of the initial bet. Each $1,000 divided by 128 gives 7.8125, which mustbe rounded down to $7; therefore, on the eighth consecutive occurrence of red, the betwill be $897. Counting the occurrences of runs on the simulated roulette table (Table22-2), it is interesting to see that a run of 8, but not 7, appears.
The results are within expectations, and no runs greater than 8 occurred in either redor black. For the purposes of this example, the betting would then proceed as shown inFigure 22-5, using an initial bet of $1. The numbers in the squares represent winning bets.
 
FIGURE 22-4 Sequence of random numbers representing occurrences of red and black,
 
COUPS GENERATED FROM RANDOM NUMBERS
  
       
123 6 7 8 910 W113 14 ISQqQoqom gempomo ocogdeslogecmesme ogscoo #8 aoooom agaqoo @ aOogecoms sescsec 8 apOugs0 CBHBE 8 a6sOmmepO COOCBH 8 a ~7}z000m BOORB O a“siom@OoGO Oswoe weOnO9joH8ooo OfO0am8 OOOMswisBOOO OCOBOB &#OB8nlfw@OoOsoOo BOBO OBFRBO2jsOsmms COmBso BBOORBiemOnoO Osmmom OF 000Bj/OR2@ BB BOWOO BAOMRwjQgaqcno aQwgago #sOmnnow1J/OOGmo# OOeBoO FOO8D- ww@ooo0o0 andods aaagnangBios568 PRACTICAL CONSIDERATIONSEee eee
———TABLE 22-2 Simulated Runs
 
Red Black35 runs of | 35 runs of |12 runs of 2 14 runs of 27 runs of 3 SI runs of 37 runs of 4 3 runs of 42 runs of 5 2 runs of S2 runs of 6| run of 8138 total occurrences 418 total occurrences
 
Every occurrence of black is a winner. Although $64 is actually won on a single black coup,each sequence of runs nets only the initial bet because of the accumulated losses duringthat sequence. For the 256 coups shown in Table 22-2, there were a total of 65 distinct runsresulting in a profit of $65 (or $455 based on a $7 initial bet), or about one-half of the ini-tial capitalization ($128 or $1,000, respectively). Instead of using Martingales, if we hadused the benchmark strategy of betting equal amounts on black to win on every coup, wewould have lost $20 ona $1 bet. The Martingales method, therefore, has a good chance ofwinning a reasonable amount.” :
Anti-Martingales
The anti-Martingales approach offers a smaller chance of winning a large amount; it isexactly the opposite of applying Martingales. Instead of doubling each losing bet, the win-ners are doubled until a goal is reached. Because there is an excellent chance of 1 run of 6in 256 coups and a similar chance of a longer run, this method wins if the long run occursin the first half of the number of coups to be played (256 in this case). Once a run of 6occurs, you must immediately stop playing.
We already know that a run of 6 returns $32 on a bet of $1, and a run of 8 nets $128.This method would have lost if it had been applied to black in the test sequence; becausethere were 138 red coups with no black runs greater than 5, there would have been a lossof $138. If the bet had been on red, looking for a run of 6, there would have been threewins, each for $94, and a loss of $118 for that many appearances of black. Waiting for a runof 8 would have won $128 and lost $117 on black by stopping right after the win. The suc-cess of anti-Martingales depends on how soon the long mun appears. In 4,096 coups, a runof 11 will occur once, returning $1,024 on a bet of $1. In the same 4,096 spins, there will
? "The Martingales approach is likely to work if the player could withstand adverse runs of 11, but casinos tend rolimit bets co amounts significantly less than 2'° times the minimum bet.
 
FIGURE 22-5 Betting pattern.
 
12345 678910 12131415
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 GAMBLING TECHNIQUE—THE THEORY OF RUNS 569
be 2,048 losses, showing that if the long run happens in the middle of play, the methodbreaks even; if it occurs sooner, you win,
The Theory of Runs Applied to Trading
Before applying either Martingales or anti-Martingales to the markets, it must be deter-mined whether the movement of prices up or down is as uniform as in the case of roulette.A simple test was performed on a combined set of 21 diverse futures markets. The com-bined results of all up and down runs are shown in Table 22-3. The expected occurrencesof both up and down were twice the probability of either a red or black coup occurring.
Some differences between the random pattern previously used and actual results canbe seen in Table 22-3. These futures markets show fewer runs of 1 and more frequent runsof 2; their tendency to fluctuate in a narrowing pattern around the expected (random)length of a run (Figure 22-6) may be due to the smaller sample of longer runs. The proba-bilities found here might be used to decide the chances of the next trading day continuingin the direction of the prior day’s trend, noting that a 3- to 4-day run is as long as might beexpected. The most interesting applications are in the betting strategies of the Martingalesand anti-Martingales methods, applied to futures markets. The following sections showtwo possibilities.
Trading Daily Sequences
By combining the Theory of Runs with the direction of the trend, the-chances of being onthe correct side of the longest run are increased; and, the size of the price move in thedirection of the trend may also tend to be larger. To give yourself the best chance of iden-tifying the trend, it should be long-term. Assuming that the trend is up'as.determined froma chart or moving average, enter a long position on the close of a day in which the pricemoves lower. :
If Martingales is used, double the position each day that prices move adversely. A sin-gle day in which prices move up should recoup all losses and net a reasonable profit. If thetrend is sustained, there should be fewer days down and more days up, thereby yielding abetter return to capitalization ratio. A variation on Martingales might include holding thetrade for 2 consecutive days in the profitable direction because of the bias shown in the dis-tribution of runs. Another variation would take profits while prices are moving in a favor-
 
TABLE 22-3 Expected Occurrences of Ups and Downsfor a Diverse Set of Markets
 
21 Markets Combined
 
Length Expected Probability aa aanof Run of Occurrence Expected Actual-t 2 1,225 4,2142 4 — 612 620 =3 1/8 306 3114 16 153 1675 1/32 77 676 b+ 38 4l7 1/128 9 168 1/286 10 59 V/S12 ~ 5 3ald 1/1,024 4-0 7° 50
Total tested 2,449570 PRACTICAL CONSIDERATIONS.
FIGURE 22-6 Actual futures movement compared with random movement.
 
COPPER1970-75,
 
 
 
f\CATTLE: BAY, zt COMBINEDTAX!\
El h NANAHet LV A
 
 
 
 
z 3 4 3 6 7 8 9NUMBER OF CONSECUTIVE OCCURRENCES (RUNS)GAMBLING TECHNIQUE—THE THEORY OF RUNS. 571
 
able direction and set new trend positions after 1 or even 2 days of price reversal. Eithervariation might improve the return ratio after a random occurrence of runs.
For the anti-Martingales approach, double the position after each profitable day, takeprofits after runs of 3, and begin again after a reversal day. By trading with the trend, profitsequences may be increased to 4 days; it may also be expected that, on average, the pricechange will be smaller on days that move counter to the trend.
System Trading
A standard trend-following system can expect 30% to 40% successful trades (called its re/i-ability) of varying profitability, which can be defined in terms of a profit/loss ratio. In con-sidering the Martingales or anti-Martingales methods, it should be noted that the lowerprobability of profitable trades would make the wait for a long run of profits less attractive.If a system has a profile of 35% successful trades and a profit/loss ratio of 3 : 1, then trad-ing equal amounts on each signal results in the following, assuming $750 each profit and$250 each loss:
Total trades 100 x $25 (commission) = $—2,500Profitable trades , 35 & $750 = $26,250Losing trades . 65 x $250 = $-16,250Net ($75 per trade) $7,500
Taking these same figures and applying Martingales to a uniform sequence of twolosses and one profit gives $275 as the first loss ($250 plus a $25 commission), $550 forthe second loss, then $2,175 for the profit, netting $1,375 for three trades, which wouldreturn $229 per contract traded.
The disadvantage of applying Martingales to the irregular returns of high-leverage mar-kets is that a long run of losing trades requires a large amount of capital. If it is necessaryto keep a large reserve in the event of a long run of losses, why not simply trade equalamounts of a larger position on each signal, without using Martingales? A sound tradingstrategy should differ from a pure gambling situation because a specific system will win inthe long term, while you will lose at roulette. The results show that trading the same largerposition on each signal will return a higher profit than an application of Martingales, whichrequires the same available capital; however, a less aggressive betting method that assumesfavorable odds can improve the return on investment.
In another study of applying Martingales, an actual trading system based on Wilder'sRSI was used to create buy and sell signals.*? During the test, a total of 277 contracts wereheld at one point, which is far beyond the realm of the normal speculator. That means aninvestment of 277 times the initial margin, plus any accumulated loss, just to recover oneunit of your initial margin! It should not be surprising that the risk-to-reward ratio of thisbetting method was found to be unacceptably large.
Complex Martingales
The-simple Martingales discussed do not present an attractive way of managing risk; how-ever, a slightly more complex form is far more practical and has very different results.Instead of doubling the bet each time there is a loss, as in the case of simple Martingales,increase the bet by a smaller amount, for example, 40%.* This slows down the process andavoids the risk of ruin, or table limits. You may even choose to divide one bet into more than
3 Roger Altman, “Tactical Trading Revisited,” Technical Analysis of Stocks & Commodities (September 1993).
‘James William Furguson, “Martingales,” Technical Analysis of Stocks & Commodities (February 1990); and“Reverse Martingales,” Technical Analysts of Stocks & Commodities (March 1990).572 PRACTICAL CONSIDERATIONS
 
one, so that a situation in which you would trade 8 contracts may be traded in two trades of4 each. You must simply remember to stop the sequence and begin again when your prof-its have exceeded your losses. In the following example, each loss is followed by increasingthe bet by an equal amount. When a profit occurs, the bet size is reduced by one unit andthe sequence ends when there is a net profit. Profits and losses are equal to the bet size.
 
EXAMPLE | Equal-Size Bets with Equal Payoff
Bet Amount Result Net Profit or Loss#t $500 Loss —$500#2 $1,000 Loss $1,500#3 $1,500 Loss —$3,000#4 $2,000 Profit —$1,000#S $1,500 Profit $500
 
In Example 1, it was necessary to win twice to realize a profit the size of the original invest-ment; however, that profit could be achieved with 40% winning trades and 60% losingtrades, '
Applying this strategy to a more realistic trading profile, consider a system with anaverage loss of $1,000, an average profit of $2,000, and a win to loss ratio of 1 to 3. Thismeans that there are 2 losses and 1 profit in every 3 trades; a net system result of zero,equivalent to a gambling situation. Example 2 shows another sequence of trades. Eventhough there are 3 losses to start, a single win nets a profit for the sequence.
 
EXAMPLE 2 Equal-Size Bets with a Trading System Profile
. No. of .Bet Units Bet Result Net Profit or Loss#i | Loss -$1,000#2 2 Loss $3,000 ¥#3 3 ~ Loss -$6,000#4 4 Profit $2,000
 
When applying a more complex form to reverse Martingales, it is best to targetsequences of profitable runs that are likely to occur with reasonable frequency. Instead ofbetting the entire accumulated profit on the next trade, bet a fixed percentage of thoseprofits. Alternatively, if you are looking for profitable runs of 4, remove the amount of theinitial bet from the total bet after the system has returned two profits in sequence. Thistends to conserve capitai but slows down the process. —
’
SELECTIVE TRADING -
It may be unrealistic to think that you can always follow a technical, fully automatic systemwithout manual intervention. Overriding system signals may occur for reasons of soundrisk management during a crisis period when you feel that the system is not programmedto deal with the current volatility and that a conservative action is the best business policy.
The beginning system trader often has concerns that the impersonal buy and sellorders will not react properly to the underlying forces that are driving prices, This canSELECTIVE TRADING 573
 
cause the trader to override the system signals. For example, if the program is geared totake profits after a move of 2%, the trader might judge that the current price move is goingto continue; therefore, he will hold the trade rather than take profits. The application ofthis special intuztive filter generally favors holding a position through ups and downs untilit shows a profit, rather than applying consistently good risk management. Judgment tendsto interpret all news in favor of the position being held until it shows a profit. A trader whowill survive must learn not to take a loss personally, to keep losses small, to establish andstay with a trading plan, and to filter out unsupported opinions. Trading is a business, andbusiness principles must apply.
Technical systems can be taken to extremes in an effort to automatically select onlyprofitable trades. Two approaches to this are most common. The use of more than onetrend indicator, such as two moving averages, is one method of isolating the best trend. Itis intended to find a smaller piece of a trend that is more reliable or one that performs bet-ter than a single, longer trend. In principle, it is no different from using three, four, ormore trends of different periods to isolate the one point of a price move that always gen-erates profits. As you become more and more selective, you will find that your opportuni-ties have disappeared, you have used your capital poorly, and the performance profile hasactually deteriorated. Using multiple trends, just as any system with many rules, is anotherattempt at perfection, but only succeeds at overfitting the problem.
There are many systems that can be bought that promise profits. Trying to incorporatea black-box approach, a method that does not disclose its exact rules, to improve the per-formance of your own program is not a good idea. Without knowing everything about theother system, there may be inadvertent duplication of a faster trend, a 3-day cycle, or someother feature. You may think that an analysis of the correlation of results between theblack-box system and your own method will show if the methods work well together, butthere are still too many uncertainties. The unknown system may have been overfitted andwill not show its real risk, or it may havé a particular weakness to a market pattern that hasnot occurred during your testing period. You must understand every method that youtrade. It’s your risk.
The best way to create a successful trading system is to look for unique elements, eachwith a sound basis, and combine them one at a time, testing each to be sure they success-fully stand on their own. The selection of the speed of a moving average will be moreimportant than either the smoothing technique or the number of moving averages to beused. There may be an advantage to the double moving average approach, but a third,fourth, and so on, lose their significance. A momentum indicator bears a close resem-blance to.a moving average when its rules are to buy or sell in the direction of the pricemove, especially when it crosses the zero line. Both have great similarities and will notoffer much diversification when applied to the same data. Each system building blockshould be fundamentally different. A technique, such as a breakout method, that does notdepend on time would be a sensible complement to a moving average, which is driven bytime. The more complicated cycle and wave theories, contrary opinion, and other methodsall view price movement in a completely different way than a moving average, even whenapplied to the same data. The same moving averages may make the most sense when youapply the same period to different types of data, such as volume and open interest, or com-pare two related series, such as the Swiss franc and German bund exchange rates.
Filtering is a tool not restricted to price analysis, but applicable to money management,reliability, risk, portfolio selection, and other aspects of a trading program. Selection of whichmarkets to trade and position size is as important as the buy and sell signals. If the systemitself corrects for high-volatility markets by decreasing the distance of the stap-loss point(keeping the risk constant), it would be redundant to trade fewer positions of that market,thereby reducing the effects of any profits or losses relative to other items in a portfolio.574 PRACTICAL CONSIDERATIONS.
 
SYSTEMTRADE-OFFS
Although traders are continually searching for a system that has no losses,' they are realis-tic enough to know that most profit, loss, and risk decisions are dependent on oneanother. Just as in Gambling Theory, a system can be structured to have frequent smalllosses and occasional large profits—or frequent small profits with some large losses. It issimply not possible to create a system with such small losses that these losses are essen-tially zero without increasing the frequency of the losses to the point at which profits rarelyoccur. In short-term or high-leveraged trading, the cost of doing business prevents such anapproach from working.
The basic principles of systematic trading require that the trader choose between thefrequency of profits to losses, the relative size of those profits and losses, and the numberof opportunities that will be available to trade. These interrelationships will be different forvarious types of systems.
Trend-Foliowing Systems
The relative risks and rewards of a trend-following system are based primarily on the selec-tion of the trend speed. As an example, using a simple moving average system applied toclosing prices, Figure 22-7 shows that a faster moving average (smaller number of days)will stay closer to the current price than a moving average that uses a larger number ofdays. The maximum risk is equal to the largest lag, as measured from the current price tothe corresponding moving average value. This lag is limited by:
M=P-(LXN)/2
where P is the current closing price, Z is the limit move or 3 standard deviations of the aver-age daily true range, and N is the number of days in the moving average.
The smaller losses of the faster trend system are kept in proportion to the profitsbecause of the relative system sensitivity. The price changes of smaller magnitude, whichcause the moving average to change direction and hold losses to a minimum, also breakthe sustained trends into shorter movements. The net results are more frequent tradeswith relatively small losses and modest profits. Longer-term trends cause fewer trades by
eS
FIGURE 22-7 Relative risk of a moving average system.
Faster
moving7 averageSlowermovingaverage
      
Maximumrisk forfaster
movingaverage
    
Maximumrisk forsloweramovingaverage
off
 SYSTEM TRADE-OFFS 575
 
holding to the market direction for a longer time. This results in larger profits and corre-spondingly larger losses.
The risk of a single trade being small or large is not a complete measure of trading risk.Because there are more losses than profits in normal trend-following systems, it is impor-tant to consider the sequence of losses as part of the ultimate risk of trading. It is theaggregation of these losses that provides a reasonable comparison in determining whethera slow or fast moving average system has the best profit to loss ratio.
The feature of a trend system that is most appealing is the small losses relative to largeprofits. This feature also causes frequent small losses during sideways markets, and thenumber of these false signals cannot be significantly reduced simply by using a longer-termtrend. Testing will show that there is always some sideways price movement that coincideswith the trendline, resulting in a high percentage of whipsaw losses. It is unrealistic toexpect a smoothing technique to produce more than 40% to 45% profitable trades.
Countertrend Systems
The risk and reward structure of a countertrend method is different from that of a trend-following approach. Although the size of your profits and losses relates to the time periodof analysis in a manner similar to trend following, positions must be set in advance of anexpected price reversal. This clearly introduces more risk and makes the success of themethod dependent upon good timing. When countertrend methods are discussed here,those techniques that require a confirmation (i.e., they wait until prices reverse their direc.tion) are not included as countertrend systems.
Due to the greater risk of a countertrend system, its objectives are generally welldefined. In a trend system you let the profits run until prices reverse; however, most coun-tertrend methods rely on an oscillator, contrary opinion, or an overboughr/oversold analy-sis, and set goals for exiting when the overbought or oversold condition disappears. Thisresults in a profile that limits profits; therefore, it should not also limit losses.
Trade-Offs
The selection of a performance profile goes together with particular trading styles. Somecombinations are entirely incompatible. Ideally, you would want very large profits, highteliability, and small losses. Unfortunately, these combinations are not possible. The trade-offs that are readily available are:
1. A few large profits and frequent small losses
2. Many small profits and a few large losses
3. More opportunities with greater risk —_4, Fewer opportunities with less risk
It is easy to identify the first combination with trend following. To have fewer lossesyou must allow greater risk. Keeping losses smail means being stopped out because of mar-ket noise rather than underlying trend; therefore, you can expect many more losses thanprofits. In the case of a countertrend system you might profit from market noise, whichaccounts for a large percentage of the price variability. The moves caused by market noiseace also much smaller and more frequent than trend moves. To profit from noise you mustenter the market while prices are going in the opposite direction, as in a countertrendtechnique, and allow more risk. This causes the profile in option 2, many small profits anda few large losses. :
The last two choices are the result of a random distribution of price moves.. If you lookback at the study of runs, you will remember that price changes exhibit a pattern very simi-lar to random movement. For every 100 days of prices, there will be 50 days in which prices576 PRACTICAL CONSIDERATIONS
 
reversed after only 1 day of up or down movement, 25 days of price movement in the samedirection for 2 consecutive days, 12.5 days for 3 consecutive days, and so on. Although realprice patterns may vary slightly from that distribution, they are very close. For any fixed timeperiod, these patterns remain the same; that is, there are always more opportunities forsmaller moves than larger ones. To hold a trade for the long term, you must be able to with-stand all of the market noise that might occur during that period. The longer you hold atrade, the greater chance you will see larger market noise, or adverse price moves.
You can see how this applies to a countertrend trading using a typical price oscillator.Figure 22-8 shows the fluctuations of a sideways market, one that has no trend bias. Assum-ing that there is a normal distribution of prices, there is a clustering near the center andless frequent peaks and valleys as prices move further away from the middle. Construct anoverbought/oversold indicator, which can be categorized as slightly (S), moderately (M),or extremely (E) overbought or oversold, by drawing lines on Figure 22-8.
It can be seen that there are more opportunities to buy a slightly oversold market andsell a slightly overbought market; all prices must pass through the area closest to the cen-ter before reaching a more overbought or oversold condition. Therefore, the opportuni-ties must increase as profit goals decrease. But what about the risk? If profits are limited,risk must be restricted to a small part of the potential profits, or not limited by a dollaramount but by a patterned condition. In this countertrend system example, an attempt tomake losses small relative to profits entered during the slightly oversold zone would causethe number of losses to increase dramatically, overwhelming the potential profits (seen inFigure 22-8). If losses are not restricted, they will be larger when there are more opportu-nities with smaller price objectives, and smaller for the fewer cases when prices are in theextreme zone. The minimum risk occurs on a single trade taken at the absolute extremepoints. Figure 22-9 shows the relationships that exist in a standard countertrend system.
All systems have trade-offs. To reduce the losses, either the profits or the frequency ofOpportunities must be reduced whether the trading approach favors the trend or coun-tertrend. A trend follower looking for the big move must also take a big risk. In the devel-opment of a system or trading philosophy, personal preference determines thecombination of risk, reward, and opportunity. :
The Commodex Method of Combining Elements
\The Commodex system was first presented in 1959 and is still active, published daily byCommodity Futures Forecast in New York. Commodex combines the components mostacceptable to the experienced trader in a unique weighting method. It includes movingaverages, price momentum, and open interest to calculate a trend index.
The most interesting aspect of the Commodex system is its ranking process, intendedto produce a relative strength value for each trend. Using a 10- and 20-day double moving
 
 
FIGURE 22-8 Countertrend aiternatives using detrended price series.
 
  
Oversold , OverboughtSYSTEMTRADE-OFFS 377
 
 
FIGURE 22-9 Relationship of profits to risk per trade based on opportunities.
 
 
Overbought-oversoldModerately
              
 
Extremely Slightly
   
Profits per trade
Risk per trade
oO 12 3.
Opportunities
 
average, the system scores the current market performance to establish the value of thetrending component. Bullish and bearish values are calculated by looking at three situa-tions independently: the simple moving average signals derived from both the long- andshort-term trends, and the double moving average signal generated by combining the twotrends, The two techniques of single and double moving averages are exactly as treated inChapter 5. The most important of the three factors is the long-term trend; second is theshort-term trend, and last the relative position of the fast to the slow moving average. Thestrongest upward-moving trend is generated when current prices are above both the faster-and slower-moving averages and the faster average is below the slower. The opposite posi-tions would result in the strongest downward-trending component. Trends are consideredneutral if the most important element, the long-term moving average, conflicts with theother two factors. -
The rate of change in open interest is considered a secondary reinforcement of thetrend. Using a concept different from the usual charting techniques, Commodex considersit a bullish sign if there is an increasing growth momentum in open interest combined withrising prices. The growth momentum is the difference between the rate of increase of theopen interest and the 20-day moving average of the open interest. Continuing a bull movewith rising prices and rising open interest is a classic concept of charting. The bear moveis confirmed with rising