# Complete Strategy based on Sheldon Knight and William Brower Research

In my* Easing Into EasyLanguage: Hi-Res Edition,* I discuss the famous statistician and trader **Sheldon Knight** and his * K-DATA Time Line*. This

*enumerated each day of the year using the following nomenclature:*

**time line**First Monday in December = 1stMonDec

Second Friday in April = 2ndFriApr

Third Wednesday in March = 3rdWedMar

This enumeration or encoding was used to determine if a certain week of the month and the day of week held any seasonality tendencies. If you trade index futures you are probably familiar with Triple Witching Days.

**Four times a year, contracts for stock options, stock index options, and stock index futures all expire on the same day, resulting in much higher volumes and price volatility. While the stock market may seem foreign and complicated to many people, it is definitely not “witchy”, however, it does have what is known as “triple witching days.”**

**Triple witching, typically, occurs on the third Friday of the last month in the quarter. That means the third Friday in March, June, September, and December. In 2022, triple witching Friday are March 18, June 17, September 16, and December 16**

Other days of certain months also carry significance. Some days, such as the first Friday of every month (employment situation), carry even more significance. In 1996, Bill Brower wrote an excellent article in * Technical Analysis of Stocks and Commodities. *The title of the article was

*In this article, Bill devised 8 very simple day trade patterns and then filtered them with the*

**The S&P 500 Seasonal Day Trade.****Day of Week in Month.**Here are the eight patterns as he laid them out in the article.

- Pattern 1: If tomorrow’s open minus 30 points is greater than today’s close, then buy at market.
- Pattern 2: If tomorrow’s open plus 30 points is less than today’s close, then buy at market.
- Pattern 3: If tomorrow’s open minus 30 points is greater than today’s close, then sell short at market.
- Pattern 4: If tomorrow’s open plus 30 points is less than today’s close, then sell short at market.
- Pattern 5: If tomorrow’s open plus 10 points is less than today’s low, then buy at market.
- Pattern 6: If tomorrow’s open minus 20 points is greater than today’s high, then sell short at today’s close stop.
- Pattern 7: If tomorrow’s open minus 40 points is greater than today’s close, then buy at today’s low limit.
- Pattern 8: If tomorrow’s open plus 70 points is less than today’s close, then sell short at today’s high limit.

This article was written nearly 27 years ago when 30 points meant something in the S&P futures contract. The S&P was trading around the 600.00 level. Today the e-mini S&P 500 (big S&P replacement) is trading near 4000.00 and has been higher. So 30, 40 or 70 points doesn’t make sense. To bring the patterns up to date, I decided to use a percentage of ATR in place of a single point. If today’s range equals 112.00 handles or in terms of points 11200 and we use 5%, then the basis would equate to 11200 = 560 points or 5.6 handles. In the day of the article the range was around 6 handles or 600 points. So. I think using 1% or 5% of ATR could replace Bill’s point values. Bill’s syntax was a little different than the way I would have described the patterns. I would have used this language to describe Pattern1

– **I****f tomorrow’s open is greater than today’s close plus 30 points, then buy at market – its easy to see we are looking for a gap open greater than 30 points here. Remember there is more than one way to program an idea. Let’s stick with Bills syntax.**

- 10 points = 1 X (
**Mult**) X ATR - 20 points = 2 X (
**Mult**) X ATR - 30 points = 3 X (
**Mult**) X ATR - 40 points = 4 X (
**Mult**) X ATR - 50 points = 5 X (
**Mult**) X ATR - 70 points =7 X (
**Mult**) X ATR

We can play around with the **Mult** to see if we can simulate similar levels back in 1996.

// atrMult will be a small percentage like 0.01 or 0.05

atrVal = avgTrueRange(atrLen) * atrMult;

//original patterns

//use IFF function to either returne a 1 or a 0

//1 pattern is true or 0 it is false

patt1 = iff(open of tomorrow - 3 * atrVal > c,1,0);

patt2 = iff(open of tomorrow + 3 * atrVal < c,1,0);

patt3 = iff(open of tomorrow - 3 * atrVal > c,1,0);

patt4 = iff(open of tomorrow + 3 * atrVal < c,1,0);

patt5 = iff(open of tomorrow + 1 * atrVal < l,1,0);

patt6 = iff(open of tomorrow - 2 * atrVal > h,1,0);

patt7 = iff(open of tomorrow - 4 * atrVal > c,1,0);

patt8 = iff(open of tomorrow + 7 * atrVal < c,1,0);

## William Brower’s DoWInMonth Enumeration

The **Day of Week In A Month** is represented by a two digit number. The first digit is the week rank and the second number is day of the week. I thought this to be very clever, so I decided to program it. I approached it from a couple of different angles and I actually coded an encoding method that included the week rank, day of week, and month (**1stWedJan**) in my **Hi-Res Edition. **Bill’s version didn’t need to be as sophisticated and since I decided to use TradeStation’s optimization capabilities I didn’t need to create a data structure to store any data. Take a look at the code and see if it makes a little bit of sense.

newMonth = False;

newMonth = dayOfMonth(d of tomorrow) < dayOfMonth(d of today);

atrVal = avgTrueRange(atrLen) * atrMult;

if newMonth then

begin

startTrading = True;

monCnt = 0;

tueCnt = 0;

wedCnt = 0;

thuCnt = 0;

friCnt = 0;

weekCnt = 1;

end;

if not(newMonth) and dayOfWeek(d of tomorrow) < dayOfWeek(d of today) then

weekCnt +=1;

dayOfWeekInMonth = weekCnt * 10 + dayOfWeek(d of tomorrow);

Simple formula to week rank and DOW

**NewMonth** is set to **false** on every bar. If tomorrow’s day of month is less than today’s day of month, then we know we have a new month and **newMonth** is set to true. If we have a new month, then several things take place: reinitialize the code that counts the number Mondays, Tuesdays, Wednesdays, Thursdays and Fridays to 0 (not used for this application but can be used later,) and set the week count **weekCnt** to 1. If its not a new month and the day of week of tomorrow is less than the day of the week today (Monday = 1 and Friday = 5, if tomorrow is less than today (1 < 5)) then we must have a new week on tomorrow’s bar. To encode the day of week in month as a two digit number is quite easy – just multiply the week rank (or count) by 10 and add the day of week (1-Monday, 2-Tuesday,…) So the third Wednesday would be equal to **3X10+3 or 33**.

## Use Optimization to Step Through 8 Patterns and 25 Day of Week in Month Enumerations

Stepping through the 8 patterns is a no brainer. However, stepping through the 25 possible **DowInAMonth codes or enumerations** is another story. Many times you can use an equation based on the iterative process of going from 1 to 25. I played around with this using the **modulus** function, but decided to use the **Switch-Case construct **instead. This is a perfect example of replacing math with computer code. Check this out.

switch(dowInMonthInc)

begin

case 1 to 5:

value2 = mod(dowInMonthInc,6);

value3 = 10;

case 6 to 10:

value2 = mod(dowInMonthInc-5,6);

value3 = 20;

case 11 to 15:

value2 = mod(dowInMonthInc-10,6);

value3 = 30;

case 16 to 20:

value2 = mod(dowInMonthInc-15,6);

value3 = 40;

case 21 to 25:

value2 = mod(dowInMonthInc-20,6);

value3 = 50;

end;

Switch-Case to Step across 25 Enumerations

Here we are switching on the **input** (* dowInMonthInc). Remember this value will go from 1 to 25 in increments of 1. *What is really neat about EasyLanguage’s implementation of the

**Switch-Case**is that it can handle ranges. If the

**dowInMonthInc**turns out to be 4 it will fall within the first

*case block*(

**case 1 to 5**). Here we know that if this value is less than 6, then we are in the first week so I set the first number in the two digit

**dayOfWeekInMonth representation**to 1. This is accomplished by setting

**value3**to 10. Now you need to extract the day of the week from the 1 to 25 loop. If the

**dowInMonthInc**is less than

**6,**then all you need to do is use the

**modulus function**and the value 6

**.**

- mod(1,6) = 1
- mod(2,6) = 2
- mod(3,6) = 3

This works great when the increment value is less than 6. Remember:

- 1 –> 11 (first Monday)
- 2 –> 12 (first Tuesday)
- 3 –> 13 (first Wednesday)
- …
- …
- 6 –> 21 (second Monday)
- 7 –> 22 (second Tuesday).

So, you have to get a little creative with your code. Assume the iterative value is 8. We need to get 8 to equal 23 (second Wednesday). This value falls into the second case, so Value3 = 20 the second week of the month. That is easy enough. Now we need to extract the day of week – remember this is just one solution, I guarantee there are are many.

**mod(dowInMonthInc **– 5, 6**) – does it work?**

value2** = mod(8-**5,6**)** = 3 -> *value3* = value1 + value2 -> *value3* = 23. It worked. Do you see the pattern below.

- case 6 to 10 – mod(dowInMonthInc –
**5**, 6) - case 11 to 15 – mod(dowInMonthInc –
**10**, 6) - case 16 to 20- mod(dowInMonthInc –
**15**, 6) - case 21 to25 – mod(dowInMonthInc –
**20**, 6)

**Save Optimization Report as Text and Open with Excel**

Here are the settings that I used to create the following report. If you do the math that is a total of 200 iterations.

I opened the Optimization Report and saved as text. Excel had no problem opening it.

I created the third column by translating the second column into our week of month and day of week vernacular. These results were applied to 20 years of ES.D (day session data.) The best result was Pattern #3 applied to the third Friday of the month (35.) Remember the 15th DowInMonthInc equals the third (3) Friday (5). The top patterns predominately occurred on a Thursday or Friday.

Here is the complete code for you to play with.

inputs: atrLen(10),atrMult(.05),patternNum(1),dowInMonthInc(1);

vars: patt1(0),patt2(0),patt3(0),patt4(0),

patt5(0),patt6(0),patt7(0),patt8(0);

vars: atrVal(0),dayOfWeekInMonth(0),startTrading(false),newMonth(False);;

vars: monCnt(0),tueCnt(0),wedCnt(0),thuCnt(0),friCnt(0),weekCnt(0);

newMonth = False;

newMonth = dayOfMonth(d of tomorrow) < dayOfMonth(d of today);

atrVal = avgTrueRange(atrLen) * atrMult;

if newMonth then

begin

startTrading = True;

monCnt = 0;

tueCnt = 0;

wedCnt = 0;

thuCnt = 0;

friCnt = 0;

weekCnt = 1;

end;

if not(newMonth) and dayOfWeek(d of tomorrow) < dayOfWeek(d of today) then

weekCnt +=1;

dayOfWeekInMonth = weekCnt * 10 + dayOfWeek(d of tomorrow);

//print(date," ", dayOfMonth(d)," " ,dayOfWeek(d)," ",weekCnt," ",monCnt," ",dayOfWeekInMonth);

//original patterns

patt1 = iff(open of tomorrow - 3 * atrVal > c,1,0);

patt2 = iff(open of tomorrow + 3 * atrVal < c,1,0);

patt3 = iff(open of tomorrow - 3 * atrVal > c,1,0);

patt4 = iff(open of tomorrow + 3 * atrVal < c,1,0);

patt5 = iff(open of tomorrow + 1 * atrVal < l,1,0);

patt6 = iff(open of tomorrow - 2 * atrVal > h,1,0);

patt7 = iff(open of tomorrow - 4 * atrVal > c,1,0);

patt8 = iff(open of tomorrow + 7 * atrVal < c,1,0);

switch(dowInMonthInc)

begin

case 1 to 5:

value2 = mod(dowInMonthInc,6);

value3 = 10;

case 6 to 10:

value2 = mod(dowInMonthInc-5,6);

value3 = 20;

case 11 to 15:

value2 = mod(dowInMonthInc-10,6);

value3 = 30;

case 16 to 20:

value2 = mod(dowInMonthInc-15,6);

value3 = 40;

case 21 to 25:

value2 = mod(dowInMonthInc-20,6);

value3 = 50;

end;

value1 = value3 + value2 ;

//print(d," ",dowInMonthInc," ",dayOfWeekInMonth," ",value1," ",value2," ",value3," ",mod(dowInMonthInc,value2));

if value1 = dayOfWeekInMonth then

begin

if patternNum = 1 and patt1 = 1 then buy("Patt1") next bar at open;

if patternNum = 2 and patt2 = 1 then buy("Patt2") next bar at open;

if patternNum = 3 and patt3 = 1 then sellShort("Patt3") next bar at open;

if patternNum = 4 and patt4 = 1 then sellShort("Patt4") next bar at open;

if patternNum = 5 and patt5 = 1 then buy("Patt5") next bar at low limit;

if patternNum = 6 and patt6 = 1 then sellShort("Patt6") next bar at close stop;

if patternNum = 7 and patt7 = 1 then buy("Patt7") next bar at low limit;

if patternNum = 8 and patt8 = 1 then sellShort("Patt8") next bar at high stop;

end;

setExitOnClose;

The Full Monty of the ES-Seasonal-Day Trade

I think this could provide a means to much more in-depth analysis. I think the *Patterns* could be changed up. I would like to thank William (Bill) Brower for his excellent article, **The S&P Seasonal Day Trade in Stocks and Commodities, August 1996 Issue, V.14:7 (333-337). The article is copyright by Technical Analysis Inc. For those not familiar with Stocks and Commodities check them out at https://store.traders.com/**

Please email me with any questions or anything I just got plain wrong. George

>>By George Pruitt from blog georgepruitt.com

Hi Jeff, I am a bit confused on the Patterns: 1 and 3 have the same exact condition but in the 1 there is a buy and in the 3 there is a sell. Same goes for 2 and 4. Am I missing some information?

George not Jeff, apologies!

Hi Federico – Thanks for the great question. I think Bill Brower wanted to see what was more productive, buying or shorting on the same pattern. Pattern1 and Pattern3 are the same in a sense – a Gap Up. But when you add the trade directive (long or short) to the Gap Up you get two distinct patterns. The objective is to find out if you go with the gap or fade it? Patterns 2 and 4 are Gap Down structures. This could be programmed in a different manner for sure, but this was the method Bill used. Coupling each pattern structure with its own trade directive helps simplify the spanning of the search space. Here you can simply step through the space one iteration at a time. Shoot me an email at georgeppruitt@gmail.com if you need further explanation.

Pattern 1 can be thought of as follow the trend and pattern 3 as mean reverting…