Fri 52 46 77Most frequent direction 51 45 97
——————
ket behavior. Table 15-8 shows the percentage of total cases for each weekday pattern(based on about 480 weeks) and the percentage of days for which Monday’s price closedin the X direction, continuing the direction of the previous Monday.
In Table 15-8 there are two interesting items to observe, the frequency of patterns andthe percentage of cases that Monday follows specific patterns. The most consistent patternseems to be the low percentage associated with XXXXX, the case in which the marketmoves the same direction every day. While it appears most often in the Deutschemark, con-
~ sidered the most trending of these markets, it is not a common pattern in the other mar-
kets. When it does occur, the D-mark and heating oil are most likely to reverse direction onMonday, while the U.S. Treasury bonds and soybeans are likely to continue the trend.
Overall, the fluctuating patterns are more common than persistent direction. For exam-ple, XOXOX and XOOXO are among the most common paiterns. These both show Tuesdayreversals and the results can be compared with the weekday study. While there is consistencyin the reaction of the financial markets, soybeans tend to move in the opposite direction.
Specific market patterns, such as weekday and weekend, can provide an edge fortraders in a very different and more complex market environment. By finding patterns thatare more likely, or even less likely, to occur over groups of similar markets, with 10%greater frequency, traders can vary their position size based on expectations and therebygain a market advantage.
Programming the Weekend StudyThe following Omega Easy Language program prints the results used in the weekend
study to the Print Log. Some of the techniques used are the same as those used in theweekday study.
(SYSTEM: Weekend Study)(Copyright 1985-1998. PJ Kaufman. AIl rights reserved.) 
3|{:
 
 
“410 PATTERN RECOGNITION
 
TABLE 15-8 Combining Weekend and Weekday Patterns, January 1986-February 199%S&P 500 US.T-Bonds Heating Oil GoldPattern ‘%Total Total %X %Total %X Total %X Total %X *lotal %X
HXXOXXX 63 60 6.3 37 65 35 57 37 6.8 53 75 42XOXXO «8644 65 4B 4.9 389 40D 59 50 59 32
D-marks Soybeans
XOXOX 69 58 75 33 57 70 61 55 10.5 52 61 38xOxXOO 77) 38 71 44°72 «442 66 39 76 S663 53XOOxXx 64 52 656 720 47 44 582 44 62 61 48xOOxO 7.1 44°67 «44-72 Ad 76 47 99 SI 7 56xXOOOX 48 52 52 S6 63 43 72 56 38 «506 45xO00O «038 446 55 65 0 32 340 720 47 44 62XXXXX 56 Al 46 55 30 71 44 38 25 50 31 60XXXXO, 2300 64 3. 40 42 55 42 45 42 55 48 87XXXOX 440 71 67.44 53 32° SI 58 46 36 61 45XXXOO 6S 58 54 58 4.0 63 76 50 5.1 42 AG 45XKOXX 6.1 45 64 31 42 45 44 37 42 50 6.1 34
XxXOxXO 56 «44 «036 «653 55 65 66 SB 55 35 7.1 50XXOOX 54 54 63 SO 70 42 66 48 65 45 5.9 57XxOOO 69 ~~ 6t 6.1 48 °#«72 «S676 AT 59 54. 57 4lae“For each market. the first column shows the percentage of total cases and the second column gives the percentage that Monday's close wasin the X direction,(Update weekend study tn “Trading Systems and Methods")vars: dow(0), ix(Q), nx(O), error(O), Mon(O), weekly(0), cases(O),div(O), pe(O), prevfri(O), savedir(0), start(O), change(a),TFopen(0), TFclose(@), TFext(O), FFopen(O),FFclose(O), FFext(0), Fraopen(), Fraclose(0), Frgext(O);arrays: week[161(0), oweek{16](0), xweek{16](0), pattern(5](0), cpricelS3(O);
dow = @dayofweek(date) ;
if currentbar ~ 1 then beginweekL1] = 10111; week{2] = 10110; week{3] = 10101; weekt4} ~ 10100;week[5J = 10011; week(6] ~ 10010; week(7] = 10001; week[8] = 100Q0;week(9} = 12111; week[10] = 11110; week(11] = 11101; week{12] = 111005week[13] ~ 11011; week(14] = 11010; week(15] = 11001; week(16] = 12000;end;
 
(Monday!if dow = 1 then begin(Process weekend pattern}if start = 1 then begincases ~ cases + 1;(Thursday to Friday direction)change = close{l] - close(2];if (open - closell]) * change > O'then TFopen = TFopen + 1;if (close - close[1]) * change > 0 then TFclose = TFctose + 1;if (change > 0 and high > close{LIT or (change < @ and low < closel1])thenTrext = Trext + 1;{Friday to Friday direction!change = close(i] - prevfri;if (open - close{1]) * change > 0 then Fropen.= FFopen + 1;
- if (close - closef1]} * change > 0 then FFclose = FFclose + 1;if (change > 0 and high > closef1]) or (change< @ and Tow <”close(1]) then
Frext ~ Frext + 15
 
 
eee
THREE STUDIES IN MARKET MOVEMENT—WEEKDAY, WEEKEND, AND REVERSAL PATTERNS 411
 
(Most common directiontchange = close - closef1l;nx =for ix = 1 to 5 begin .
if pattern[ixJ ~ 1 then nx = ax + 1;end;if (nx >= 3 and (open - close[1])*savedir > 0) or(nx ¢ 3 and (open - close(1])*savedir < 0) then Fraopen =Frqopen + 1;if (nx >= 3 and (close ~ closeL1})*savedir > 0) or(nx < 3 and (close = closeli])*savedir ¢ 0) then Fraciose =Frqclose + 1;if (nx >= 3 and ((change > 0 and high > close(1]) or(change ¢ 0 and low < closef1]))) or(mx © 3 and ({change < 0 and low < closefi}) or(change > 0 and high > close{1])}) then Fraext ~ Frqext + 1;
 
{Pattern match}for ix = 1 to 16 beginif weekly = week{ix] then begin
if (close - close{i})*savedir > 0 then xweekfix] =xweektix] + 1;if (close - close(1])*savedir <0 then oweekLix] =oweekix] + 1;end;
end;end;for ix 1 to 5 beginpatternCix] = 0;end;if close > closet} then pattern{1] = 1 else patterntl) = -1;epricel1} = close;prevfri = close(1);savedir = patterntl];end;(Tuesday!if dow = 2 then beginif close > close(1] then pattern{2] = 1 else patternf2}eprice(2] = close;end;
 
(Wednesday)if dow = 3 then beginif close > close{1] then pattern[3] = 1 else pattern{3]eprice(3] = close;end;
{Thursday}if dow = 4 then beginif close > close(1) then pattern{4] = 1 else pattern(4}cprice[4] = close; -end;
 
Iweekday!if dow = 5 then begin -if close > closef1] then pattern£$] = 1 else pattern(5]eprice(S} = close; -error = 05(process pattern for entire week, convert to pattern beginning with 1)for ix = 2 to § beginif pattern[ix] = 0 then error ~ 13if error = 0 then begin -if patternlix] * pettern{1] > 0 then pattern{ix] = 1 elsepatterntix} = 0;
 - 412
 
 
PATTERN RECOGNITION
end;ef;patternf1] = 15weekly = 0;if error = 0 then beginlcreate a weekly pattern}weekly ~ 10000 + pattern{2}*1000 + pattern(3}*100 + pattern(4]*10 +patternt 5];end;start = 1;end;if lastcalcdate = date then beginprint ("Thursday to Friday", cases:4:0, TFopen:4:0, TFclose:TFopen*100/cases:4:0, TFclose*100/cases:4Trext*100/cases:4:0);print ("Friday to Friday", cases:4:0, FFopen:4:0, FFclose:FFopen*100/cases:4:0, FFclose*l00/cases:4FFext*100/cases:4:0);print ("Most Frequent direction", cases:4:0, Frqopen:4:0, Fraclose:4:0,Frqext:4:0, Frqopen*100/cases:4:0, Frqclose*100/caseFrqext*100/ceses:4:0);print ("AIT patterns:")5for ix = 1 to 16 begin :print weeklix3:6:0, xweekCix] + oweek(ix]:4:0,(xweek(ix] + oweeklix])*100/cases:4:1," S1=",xweeklix]*100/ (xweekCix]+oweek[ix]):4:
0, TRext:4:0,
   
   
     
20, FFext:4:0,
 
 
420,
  
 
 
 
end;end;
A Comment on Testing and Holidays
‘The weekday and weekend tests did not include any weeks in which there was a holiday orlong holiday weekends. It would have been perfectly reasonable to view the opening of thefirst day of the following week as a “Monday,” even though it occurred on a Tuesday fol-lowing a Monday holiday. In fact, those special cases may have proved very consistent. Sim-ilarly, a holiday on Friday could have been worked out to fit the weekday patterns andallow the Monday direction to be added into the total results. These tests shown here onlyused complete 5-day trading weeks.
‘A well-known work that studies price movement prior to holidays is by Merrill, whoseresults are based on the stock market and demonstrate a strong bullish tendency before aholiday with a weak day immediately after. Remembering the bullish bias of the stock mar-ket (about 54% of all days were higher from 1897 to January 1964), Merrill’s results areshown in Table 15-9. In relation to trading, this would indicate the possibility of a sharptrending move prior to or throughout a holiday season.
 
TABLE 15-9 Merrill's Holiday Resuits
 
 
Period Tested Holiday or Holiday Period ~ % Upward Moves1897-1954 Day prior to all holidays 67.9%1897-1964 Day after all holidays 50.81897-1964 ‘Thanksgiving to New Year 741897-1964 July 4th to Labor Day 691931-1965- Before Christmas 741931-1965 Before New Year 75
 
THREE STUDIES IN rs ARKET MOVEMENT—WEEKDAY, WEEKEND, AND REVERSAL PATTERNS 413
 
The January Effect
Another bias in the pattern of prices may be seen in the action of the stock market duringthe month of January. There are many investors who are not as anxious to trade in and outof the market as professional managers and speculators. It is perfectly sensible to look fora pattern in the way many of the long-term investors set positions at the beginning of theyear, the result of a reallocation of their portfolios, or resetting positions liquidated beforethe end of the year for tax reasons.
If January is a leading indicator of stock market movement throughout the rest of theyear, there is a combination of patterns that should be considered based on the few daysimmediately after the year begins, and the net market direction for the month of January.Using the Dow Industrials as a stock market indicator, the January pattern was viewed from1900 to 1989 in two parts, 1900 to 1937 and 1938 to 1989. The results are shown in Fig-ure 15-8 for all years and Table 15-10 for the past 52 years.
Figure 15-8 shows that the early part of the century had no significant pattern. Therewere nearly the same number of bullish and bearish indications resulting in a larger numberof incorrect predictions. The past 52 years are very different, with a much larger number ofcorrect moves. One should note, however, that the ratio of up to down moves is more than7: 1. During the past 10 years it is likely that this pattern would continue to be successful ifthe prognosis was a bull market. To offset the market bias, it should be noted that the pat-tern§ shown in Table 15-10 are very logical. The direction of the first 5 days, confirmed by acontinuation in that pattern for the balance of January, is then followed by the same patternfor the year. In the case in which the market changes direction after the first 5 days and netsa loss for the month, the pattern conforms to the new direction for the balance of the year.
 
Reversal Patterns
The last of the three studies looks at reversal patterns. The intention is to find a pattern inthe open, high, low, and closing prices of the day that will help predict the next day’s pat-tern or direction. Three combinations are tabulated here:
“Jay Kaeppel, “The January Barometer: Myth and Reality,” Technical Analysis of Stocks & Commodities (July 1990)———————FIGURE 15-8 Results of January patterns.
January Barometer results
EE] 1900-1937EI 1938-1989
0 e ee#oftimes Up - Down Up Down Right Wrong
 
January up January up # Barometer# times # timesFeb-Dec Feb-Dec
 
Source: Jay Kaeppel,"‘The January Barometer: Myth and Reality,” Technical Analysis of Stocks & Commodities, 8,no. 7 (July 1990). ©1990 Technical Analysis, Inc. Used with permission. 
 
#
r
44 PATTERN RECOGNITION
————
TABLE 15-10 The January Barometer Patterns, 1938-1989
 
 
 
S&P 500
During First $ By the End ExpectationsPattern Days of the Year of January for Feb-Dec1 Declines Further decline Bearish2 Declines Less decline, but loss for the month Bearish3 Declines Gain for the month Bullish4 Advances Further gains Bullish5 Advances Less gain, but gain for the month Bullish6 Advances Loss for the month Bearish
 
Intraday trend continued (“Trend”). A continued upward trend is set up when yester-day's high is greater than the previous high and yesterday's close is greater than theprevious close. We then find the percentage of days that open higher or close higherthan yesterday. Continued downtrends are the opposite pattern.
Reversal day (“Reversal”). Beginning with yesterday’s pattern of a higher high but aclose below the prior close, a reversal day opens lower or closes lower than the previ-ous close. An upward reversal starts with a lower trend day.
Extreme reversal (“Extreme”), Yesterday's high was greater than the prior high, butyesterday’s close was below the prior low. The reversal from up to down is continuedif today's open or close is lower than yesterday's close.
Results for these trend and reversal combinations are shown in Table 15-11 for thesame six markets tested in the previous studies. In general, the financial markets show fewextreme values, while gold and soybeans show a tendency for continued reversals follow-ing an upward move. An unusual and very consistent result that appears for all markets is
SS
 
 
 
 
 
 
TABLE 15-1! Reversal Analysis for Six Sample Markets, January 1986—February 1996Higher High Lower Low «No. of CasesMarket Pattern Open Close Open Close Up DownDeutschemark Trend 46 48 50 45 948 907Reversal 55 45 16 15 268 261Extreme 48 4 5! 45 79 74‘S&P 500 — Trend 42 5 46 42 940 791Reversal 49 42 20 - 22 375 342Extreme 3 46 35 48 82 ctUS.T-bonds Trend ~ 49 48 47 44 882 778Reversal sl 4 25 22 347 366Extreme 46 Ad 4 4207 92 4Heating oil Trend 45 46 49 46 Bee 818Reversal 53 - 45 16 16 247 283Extreme 50 45 58 39 42 62Gold Trend 44 40 52 45 833 830Reversal 57 a4 15 14 320 267Extreme s7 39 36 34 70 76Soybeans Trend 46 43 47 45 874 831Reversal 57 45 21 20 289 - 344Extreme 53 47 52 45 74 99
—
 
 
THREE STUDIES IN hRKET MOVEMENT—WEEKDAY, WEEKEND, AND REVERSAL PATTERNS 415
 
the low percentage of reversal follow-through after a lower price move. Readers areencouraged to verify the program printed at the end of this section, to be certain that thereare no errors. This unusually persistent pattern may be either a special trading pattern ora program error. If valid, whenever today’s low is below the prior low and today’s close isgreaier than yesterday's close, a short sale should prove profitable about 80% of the time.
Programming the Reversal Study
(SYSTEM: Reversal Study}(Copyright 1985-1998. PJ Kaufman. All rights reserved.)iNew reversal study for “Trading Systems and Methods”Each of the following based on direction of current pattern:1. Continued trend (higher high, higher close, then next open and close2. Reversal: Higher high, lower close, then next open end close3, Outside Reversal: Higher high, close below prior Tow, then next open and close!
vars: trend(0), TUopen(), TUclose(0), TOopen(9), TOclasecay,RUopen(0), RUclose(O), RDopen(G), ROclose(d),EVopen(0), EUctose(O), EDopen(d), EdcTose(O),MTUCO), MTO(O}, MRUC), MROCO), MEYLO), mEDLOD;
trend = close - close($];{Continued trend)if high{1] > nigh(2] and closef1] > close(2] then beginaTy = atu + 1;if open > close{1] then TUopen = TUopen + 1;if close > close{1] then TUclose = TUclose + 1;end; -if Vow{1} < lowL2] and closef1] < close(2] then beginTD = nTO + 1;if open < close[1] then TOopen = TDopen + 1;if close < close[1} then TOclose = TDclose + 1;end;tReversal}if high(L] > high[2] and close [1] < closef2] then beginnRU = nRU + 1;if open < close{1] then RUopen = RUopen + 1;if close < close{1] then RUclose ~ RUclose + 1; -end;if low£1] < TowL2} and close{i] > close{2] then beginRO = nO + 1;if open > close1] then RUopen = ROopen + 1;if close > close{1] then ROclose = ROclose + 1;end;{Extreme Reversal)if high{1] > high(2] and closeC1} < Vowl2] then beginneu ~ n€U + 1;if open < close{1] then EVopen ~ EUopen + 1;if close ¢ close(1] then EUclose ~ EUctose + 2;end;if VowL1] < Tow£2] and closet] > high{2] then beginnEO = n€O + 1;if open > close{1] then Eopen = E9open + 1;if close > close{1] then EOclose ~ EDclose + 1;end;
if lastcalcdate ~ date then beginprint (*Total cases:*, currentbar:5:0);print (* open close open close”);print ("Trend *, TUopen*100/nTU:4:0, TUcTose*100/nTU:4:0,TOopen*100/nTD:4:0, TOctose*100/nTD:4:0, * (*, nTU:4:0, nTD:4:0,
  
 
 
 
416 PATTERN RECOGNITION
295
print (*Reversal*, RUopen*100/nRU:4:0, RUcTose*l00/nRU:4:0,ROopen*100/nTD:4:0, RDclase*LO0/nTD:4:0, * (", MRUTaiO, nRO:4:0,NG
print ("Extreme", EUopen*100/nEU:4:0, EUclose*100/nEU:4:0,EDopen*100/nED:4:0, EDctose*100/nED:4:0, * (*, mEU:4:0, nED:4:0,DE
 
end;
COMPUTER-BASED PATTERN RECOGNITION
‘The methods previously discussed were based on patterns familiar to traders. The weeklyand weekend studies, as well as the intraday time patterns shown in the previous sections,were originally verified by hand and later recalculated using a computer. There is a type of
pattern recognition, however, that would hardly be considered without the availability of a
computer. :Rather than the conventional price patterns in which recurring sequences of higher
and lower days are found within certain qualified intervals, computer-based pattern recog-nition refers to sets of descriptors and classes of interest. For example, Aronson? describesthe sets and values that must be satisfied by a professional jockey as:
———_——_——_—_—_——Descriptor Value-RangeHeight Under 5’5”Weight Under 120 Ibs.Age 16 to 35
Years riding horses Over 10
‘The set of people who satisfy all four conditions are said to contain all professional jock-eys. The converse, that all people satisfying these conditions are professional jockeys, is nottrue. It will be necessary to qualify this set further to create a set that contains only profes-sional jockeys; however, these four conditions go a long way toward reducing the field.
How can this tool be applied toward the development of a trading strategy? If the sys-tem is defined in terms of the trade profile, it becomes obvious. Consider the followingcharacteristics of a trade: ‘
1. The price moves higher or lower by at least 3% of the starting price.2. The price move occurs within 20 days.3. There is no loss exceeding .5%._Bither a computer or an analyst can locate all price moves that satisfy these conditionswithin a price series. Each of the 5 days preceding an upward move, which satisfies theseconditions, can be marked as buy days, and the 5 days preceding a downward movement
can be designated sell days (see Figure 15-9).The computer now contains the set of all buy and sell days—those days on which it
would be good to geta buy or sell signal. Next, some likely indicators must be specified tobe used for identifying that these trades are about to’ begin. The following might be used:
1. The moving average direction2. An overbought/oversold indicator such as a relative strength indicator (RSI) or con-
trary opinion
5 David R. Aronson, Artificial Intelligence Methods (privately published). Also see David R. Aronson, “ArtificialIntelligence/Pattern Recognition Applied to Forecasting Financial Market Trends,” ‘Market Tecbnictans Associa-
tion Journal (May 1985, pp. 91-131).
 
ARTIFICAL INTELLNsENCE METHODS,47
FIGURE 15-9 Specific buying and selling days.
Selling days—
    
Selling days—
us
satis Buying days
 
3. The direction of changes in trading violu:4, A 10-day momentum svenme
pu Sotering a broad selection of indicators and trying to avoid duplication, the com.que values for combinations of indicators that pri during thepurer can find unique values fore at primarily occur during theai periods. Ideally, all buy signals should occur wh ill periods , en one indi-ator, oF the value of combining indicators, exceeds a specific value. For example ail buysis ral occur when the average value of the RSI and the market sentiment (contrary opin-0 level. However, having ail buy signals occur here isignals may appear at this level, which cause L oct ystems ol nave nonals , large losses. iipa may get a this eve -ge losses. The perfect system will have novate ornately in the real world there are no perfect solutions. The trades that ae sigions of indicators will have to be studied fc iother performance criteria. However, th i asses of indiana, tea. , the technique of setting up classes of iand sell days, is a new and valid aj Feat Tt ig onalonaee eke5 , proach to system development. It is analmultiple regression method used b ici Mine relationship herwecn sinanul ; y econometricians to find the relationship between sta-tsties and Beices, Although the econometricians use inflation, supply, interest rates, and soy nition cai ical i i i f _forth, pattern fe 2 in employ technical indicators and discrete patterns to forecast
 
ARTIFICIAL INTELLIGENCE METHODS -
Arificial intelligence refers to a computer process that performs an operation corre-ope nding £0, oF approaching, human thinking. This is intended to distinguish it from sim-I gnition, with which it is often confused. The st: fF i iintelligence is the separation of two id i formation that ic seared ake leas. The collection of informat that is iithe brain has been termed the kr {from reason, rulesowledge base. This is distinguiu i e d . guished from reason, rules,ind logic, called the inference engine, These ideas are not very different from the database
_ and trading strategies that are discussed here.
refer closest practical approach to artificial intelligence is heuristic programming. Thisrefers to computer learning in very much the same way as finding the way out of a maze.puter starts with rules relevant to the problem, then records the successful and 
 
 
 
iBHu:
PATTERN RECOGNITION418
 
it has a complete table of what to do for each
unsuccessful experiences? Eventually, « ahasie, intelligent approach when
lutions. This is a vion, or at least a table of probable solution proach whenthe same events can be expected to recur in the same way. It does not pee 2 acerehipstions without the added complication of incorporating extrapolation,
(e.g, price level to volatlip), and othe ty patter recognition i that it may continie 10isti roacl . uThe a ee ombinations eethat have already produced inconsistent or
‘ ne th:define exer ons oan er'to tently 2 liniess collection of patterns is justvvother case of overfitting, but this time at a highly sophisticated level, “optimization, and
Heuristic programs have improved current technology in searching, optimization, andgame-playing strategies; however, they are not readily available. Phere no dour that thistechnique will be quickly absorbed into trading strategies as it develops, pose readersinterested in the types of methods considered to be in the category of artificial intelligencesuch as neural networks and genetic algorithms, should refer to Chap
Techniques”)
heuristics and game playing are Judea Pearl, Heuris-
i© Two books of interest that represent the state of the art in curses and a ana Practice (a
tics (Addison-Wesley, Reading, MA, 1984), and M.A. Bramer,sted Press, New York, 1983).
 
| 