+1)/2);pe = n3[ix}*100/n2[div];print (Wed£ix]:5:0, n3Cix]:4:0, pe:4:0);end;print (*Thursday");for ix = 1 to 8 begin408 PATTERN RECOGNITION
 
div = @intportion((ix+1)/2);pe = n4[ix}*100/n3ldivd;print (Thurs(ix}:5:0, n4lix}:4:0, po:4:0); 'end;print ("Friday");for ix = 1 to 16 begindiv = @intportion({ix#1)/2);pe = n5Lix]*100/n4ldivi;print (FriCix}:5:0, m5(ix}:4:0, pe:4:0);end;end;
Weekend Patterns
Of all patterns studied, this test was expected to be the most promising. Two factors leadto the anticipation of strong weekend patterns:
1. Friday liquidation—the aversion of waders to hold a market position over theweekend, .
2. Setting of new positions and resetting of old ones on Monday, especially during atrending market.
If the patterns can be identified, the 2-day wéekend delay should result in large pricejumps and good profits for those willing to take the weekend risk. Not knowing what toexpect but anticipating combining the results with the study of weekday patterns, a num-ber of different trend indicators and patterns were tested. These were limited to closingprice relationships.
Trend indicators
Prior Thursday-to-Friday directionFriday-to-Friday directionMost frequent direction last week
Following each of the trends or patterns, the prices on Monday were tabulated todetermine the frequency and consistency of the opening price, closing price, and high orlow prices that were in the same direction as each of the trends or patterns. Table 15-7 liststhe results for the six markets studied for the 10 years from 1986 through February 1996.Based on the three trend patterns, none of the markets show any significant tendency tocarry the trend over the weekend reflected in the open or Close of the following Monday.The extreme on Monday, that is, the high or low price, normally provides an opportunityto exit at a profit from a trend position taken on Friday’s close sometime on Monday.
It seems surprising that the price pattern on Monday no longer reflects the directionof the previous Thursday-to-Friday move, nor the trend of the previous week. In the samestudy performed in the prior 10 years, there was a clear pattern based on Thursday to Fri-day. Considering the fact that there have been dominant trends in the equities markets andirfterest rates, the only reasonable conclusion is that markets are more complex, based ongreater participation. It will be necessary to look at longer trends or other patterns to findhigh-probability cases. :
Combining Weekend and Weekday Patterns
The direction of Monday’s prices is more interesting when viewed in terms of the previousweekday patterns. Seen side by side, the frequency of each pattern and the way the six sam-ple markets react with respect to the following Monday closing price give insight into mar-THREE STUDIES IN MARKET MOVEMENT—WEEKDAY, WEEKEND, AND REVERSAL PATTERNS 409
 
 
TABLE 15-7 Weekend Pattern Based on Possible Trends during the Prior Week,January 1986-February 1996
 
Continued Direction Monday (%)
 
Market Trend Open Close ExtremeDeutschemark Thurs to Fri 55 5 74Fri to Fri 56 55 78Most frequent direction 54 51 99S&P 500 Thurs to Fri 49 49 87Fri to Fri 46 5 88Most frequent direction 47 50 98US.T-bonds Thurs to Fri 46 47 87Fri to Fri 46 51 89Most frequent direction 46 49 9%Heating oil Thurs to Fri 49 49 77Fri to Fri 49 48 80Most frequent direction 50 49 9%Gold Thurs to Fri 53 47 76Frito Fri 50 46 76Most frequent direction 5st 47 7Soybeans Thurs to Fri 33 45 76Frito 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.
Overail, the fluctuating patterns are more common than persistent direction. For exam-ple, XOXOX and XOOXO are among the most common patterns. 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 oyer 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 Study
The following Omega Easy Language program prints the results used in the weekendstudy 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. All rights reserved.|4l0 PATTERN RECOGNITION
 
TABLE 15-8 Combining Weekend and Weekday Patterns, January 1986—February 1996*——
D-marks S&P 500 US.T-Bonds Heating Oil GoldPattern Total %X Total %X Total %X *Total %X “Total %X “*Total %X
XOXXX 63 60 63 37 65 35 57 37 68 53 75 42XOXXO 8.6 44 65 48 49 39 4.0 32 5.9 50 59 32XOXOX 69 58 75 33 57 70 6.1 55 10.5 52 6.1 38XOXO0O 77 38 71 44 72 44 6.6 39 76 56 63 33XOOXX 6.1 52 65 él 72 47 44 52 44 62 él 48XOOXO 71 44 67 44 72 4l 76 47 9.9 sl 7 56XOOOX 48 52 5.2 56 63 43 7.2 56 3.8 50 él 45XO00O0 3.8 44 64 35 6.5 32 5.3 40 720 47 44 62XXXXX 5.6 4l 4.6 55 3.0 71 44 38 25 50 3.1 60XXXXO 23 64 3.1 40 42 55 42 45 42 55 48 57XXXOX 44 7I 67. 44 53 32 5.1 58 46 36 él 45XXXOO 65 58 5.4 58 40 63 76 50 5.1 42 46 45XXOXX 61 45 6.1 31 42 45 44 57 42 50° 6.1 34XXOXO 56 44 3.6 53 5.5 65 6.6 58 5.5 35 7A 50XXOOX 54 54 6.3 50 7.0 42 6.6 48 65 45° 59 57
XXO00O0 69 él 6.1 48 72 56 7.6 47 59 54. 57 4l
a*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, .
Soybeans
 
 
{update weekend study in "Trading Systems and Methods"}vars: dow(0), ix(0), mx(0), error(O}, Mon(0), weekly(0), cases(0),div(0), pe(0), prevfri(0), savedir(O), start(O}, change(O),TFopen(0), TFclose(0), TFext(0), FFopen(0);FFclose(O}, FFext(0), Frqopen(0), Frqclose(0), Frgext(0);arrays: week[16}(0), oweek{16](0), xweek[163(0), pattern(5](0), cpricel5J(0);
dow = @dayofweek(date);if currentbar = 1 then beginweek[1] = 10111; week[2J = 10110; week(3] = 10101; week[4] = 10100;week(5] = 10011; week(6] ~ 10010; week(7] = 10001; week[8] = 100Q0;week(9] = 11111; week(10J = 11110; week(11J = 11101; week(12] = 11100;week[13J] = 11011; week[14] = 11010; week[15] = 11001; week{16] = 11000;end;{Monday}if dow = 1 then degin(Process weekend pattern}if start ~ 1 then begincases = cases + 1; *(Thursday to Friday direction}change = close(1] - closel2];if (open - close{1}) * change > 0 then TFopen = TFopen + 1;if (close - close{lJ) * change > 0 then TFclose = TFctose + 1;if (change > 0 and high > closelLIJ or (change < 0 and low < close{1])thenTFext = TFext +1;(Friday to Friday direction}change = closel1] - prevfri;if (open - close[1]) * change > 0 then FFopen. = FFopen + 1;- if (close - close{1J) * change > 0 then FFclose = FFclose + 1;if (change > 0 and high > close[1J) or (change < 0 and low <~closef1j) then“ FRext = Frext + 15THREE STUDIES IN MARKET MOVEMENT—WEEKDAY, WEEKEND, AND REVERSAL PATTERNS 411——— EEE ee
(Most common direction}change = close - close[ll;
nx = 0;
for ix = 1 to 5 begin .if pattern[ix] = 1 then nx = nx + 1;end;
if (nx >= 3 and (open - close(1])*savedir > 0) or(nx < 3 and (open - close[i])*savedir < 0} then Frqopen =Frqopen + 1;if (nx >= 3 and (close ~ closel1])*savedir > 0) or(ax < 3 and (close - close[1])*savedir < 0) then Frqclose =Frqclose + 1;if (nx >= 3 and ((change > 0 and high > close{1]) or(change < 0 and low < close[1J))) or(nx <3 and ((change < 0 and low < closeLij) or(change > 0 and high > closef1J))) then Frqext = Frqext + 1;{Pattern match}for ix = 1 to 16 beginif weekly ~ week[ix] then beginif (close - closé(1])*savedir > 0 then xweek[ix} =xweekLix] + 1;if (close - close[iJ)*savedir < 0 then oweek[ix] =oweek[ix} + 1;end;
end;
end;for ix = 1 to 5 begin
pattern[ix] = 0;
end;if close > close{1lj then pattern({1] = 1 else pattern(1) = -1;Cpricell] = close;prevfri = closelli;savedir = pattern(1J;
end;(Tuesday!if dow = 2 then beginif close > close{1] then pattern{2] = 1 else pattern{2) = -1; .cprice(2] = close;end;{Wednesday}if dow = 3 then beginif close > close(1j then pattern[3] = 1 else pattern(3] = -1;cpricel3] = Close;end;{Thursday} —_if dow = 4 then begin -Sf close > close(1] then pattern[4} ~ 1 else pattern[4] = -1;
cpricel4] = close;end;
{weekday}{f dow = 5 then beginif close > close{1] then pattern[5J = 1 else pattern[5] = -1;cprice(5] = close; ”error = 0;[process pattern for entire week, convert to pattern beginning with 1}for ix = 2 to 5 beginif pattern[ix} = 0 then error = 1;if error = 0 then begin -- :if patternlix] * pattern{1] > 0 then patternlix] = 1 elsepattern[ix] = 0;4l2 PATTERN RECOGNITIONee
end;
efid;
pattern(1j = 1;
weekly = 05
if error = 0 then begin
{create a weekly pattern}
weekly = 10000 + pattern[2j*1000 + pattern[3]*100 + pattern[4j*10 +pattern(5];end;
start = 1;
end;
tf lastcalcdate = date then beginprint ("Thursday to Friday", cases:4:0, TFopen:4:0, TFclose:4:0, TFext:4:0,TFopen*100/cases » TFclose*100/cases:4:0,TFext*100/cases:4:0);print ("Friday to Friday", cases:4:0, FFopen:4:0, FFclose:FFopen*100/cases » FFclose*100/casesFFext*100/cases :4:0};print ("Most frequent direction", cases:4:0, Frqopen:4:0, Frqclose:4:0,Frqext:4:0, Frqopen*100/cases:4:0, Fraclose*100/cases:4:0,Frqext*t00/cases:4:0);print ("All patterns:");for ix = 1 to 16 begin .print week(ix]:6:0, xweeklix] + oweeklix]:4:0,(xweekCix] + oweeklix])*100/cases:xweek(ix]*100/(xweeklix]+oweekLix]) :4
 
 
   
30, FFext:4:0,Qo,
 
 
  
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 Merrili’s Holiday Resuits
 
 
 
Period Tested Hosiday or Hotiday Period “ % Upward Moves1897-1984 Day prior to all holidays 67.9%1897-1964 Day after all holidays 50.81897-1964 Thanksgiving to New Year 74
- 1897-1964 July 4th to Labor Day 691931-1965- Before Christmas 74
1931-1965 Before New Year 75THREE STUDIES IN r1ARKET MOVEMENT—WEEKDAY, WEEKEND, AND REVERSAL PATTERNS 413ee
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
 
 
1900-1937
 
 
fark:
#oftimes Up - Dow Up Down Right = Wrong
January up January up # Barometer# times # timesFeb-Dec Feb-Dec
 
Source: Jay Kaeppel, “The January Barometer: Myth and Reality,” Technical Anolysis of Stocks & Commodities, 8,no. 7 (July 1990). ©1990 Technical Analysis, Inc. Used with permission.4ta PATTERN RECOGNITION
 
 
TABLE 15-10 The January Barometer Patterns, 1938-1989
 
 
S&P 500 ‘
During First 5 By the End ExpectationsPattern Days of the Year of January for Feb-Dec| 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 the
same 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
 
 
Reversal Analysis for Six Sample Markets, January 1986—-February 1996
 
 
TABLE 15-11Higher 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 4l 3t 45 79 74S&P 500 —~ Trend 42 5} 46 42 940 7AReversal 49 42 20 2 375 342Extreme 43 46 35 48 82 8U.S. T-bonds Trend 7 49 48 47 44 882 778Reversal Sl 44 25 22 347 366Extreme 46 42 4l 42 92 it4Heating oil Trend +45 46 449 46 86F 8i8Reversal 53 45 16 16 247 283Extreme 50 45 58 39 42 62Gold Trend 44 40 52 45 833 830Reversal 57 44 15 14 320 267Extreme 57 39 36 34 70 76Soybeans Trend 46 43 47 =45 874 831Reversal 57 45 21 20 289 ~ 344Extreme 53 47 52 45 74 99THREE STUDIES IN harKET MOVEMENT—WEEKDAY, WEEKEND, AND REVERSAL PATTERNS 415— ee
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 isgreater 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. ATi 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 and close3. Outside Reversal: Higher high, close below prior Tow, then next open and close}
vars: trend(0), TUopen(0), TUclose(0), TOopen(0), TOclose(or,RUopen(O), RUctose(0), RDopen(O), ROCLoseco),Evopen(0), EUctose(0), EDopen(O), EOclose(o),“nTUCO), nTD(O), nRUCO), MRDLO?, MEUCO), NEDO);
trend = close - close[5];{Continued trend} *if MighL1] > highL2] and closeli} > close[2] then beginnTU = nTU + 1;if open > close[1] then TUopen = TUopen + 1;if close > close[1] then TUclose + TUctose + i;end; ~¥f low{1] < lowl2] and closefi} < close[2} then beginnT0 = aTD + 1;if open < close[1] then TDopen = TDopen + 1;if close < close[l] then TOclose ~ TOclose + 1;end;{Reversal}if high[1] > high[2] and close [1] < close[2} then beginnRU = mRU + Tyif open < closef{1} then RUopen = RUopen + 1;if close < closeli] then RUclose ~ RUcTose + 1;end;if Yowli] < lowl2} and closeli} > close[2] then beginnRD = nRO + 1;if open > closef{1} then RDopen = RDopen + i;if close > closeli] then RDclose = RDclose + 1;end;lExtreme Reversal}if highl1} > high{2} and closelijl < towl2] then beginnf = n€U +1;if open < closeLi} then EUopen = EUopen + 1;if close < closeli] then EUctose ~ EUclose + i;end;¥f lowL1] < lowl2) and closell} > high{2} then beginnEO = nED + 1;if open > close[i] then EDopen = EDopen + 1;if close > closeli] then EDclose = EDclose + i;eid;
if lastcaledate ~ date then beginprint ("Total cases:", currentbar:5:D);print (* open clase open close");print ("Trend *, TUopen*i00/nTU:4:0, TUclose*100/nTU:4:0,TDopen*100/nTD:4:0, TOctose*i00/nT0:4:0, " (*, nTU:4:0, nTD:4:0,46 PATTERN RECOGNITION
 
5
print ("Reversat*, RUopen*100/nRU:4:0, RUctose*100/nRU:4:0,RDopen*100/nT0:4:0, RDclose*100/nT0:4:0, * ¢", mRU:4:10, nRD:4:0,"5
print ("Extreme”, EVopen*100/nEU:4:0, EUclose*100/nEU:4:0,EDopen*100/nED:4:0, EDclose*100/nED:4:0, * (", mEU:4:0, n€O:4:0,"yds
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 ofpattern recognition, however, that would hardly be considered without the availability of acomputer.
Rather than the conventional price patterns in which recurring sequences of higherand 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 35Year's 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%.
_Either 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 movementcan be designated self days (see Figure 15-9).
The computer now contains the set of all buy and sell days—those days on which itwould 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/Partern Recognition App