Trading Before and After Holidays

Morgan Stanley Research Idea from 2018

In May of 2018 Morgan Stanley presented a report from their research department.  The report was written by Tony Small and Matthew Hornbach.  The information presented validated the idea of seasonality in the markets.  The writers/researchers gathered all the data going back to 1984 on the ten-year futures and all the federal holidays going back over the same span of time.  They then analyzed either going long or short M days prior to the holiday and exiting N days before the holidays.  They also did the same thing after the holiday – entering M days after and exiting N days after.  The boundary was set to five days before and after.  This report was sent to me by one of my clients.  The conclusion of the article was that there seemed to be a seasonality component to the days prior and after a major holiday.  And that it seemed this component did indeed provide a technical advantage (on the surface.)  Here is their conclusion.

“Given the risk of data mining, investors should accept this analysis with some degree of caution,” Small and Hornbach said. “There is no guarantee that historical seasonality and past price performance will continue in the future.”

How would one test this idea on their own?

Tools needed:

  1. Python with NumPy installed.
  2. An AI chatbot such as ChatGPT.
  3. Access to TY futures data going back to 1984 (actual non-Panama adjusted data would be preferable.)
  4. A testing platform that allows future leak such as George’s own TradingSimula-18.  Excel would work too but would require a bunch of work.

Some programming knowledge.

  1. Create output for all of the federal holidays going back to January 1984.  This list must also include Good Fridays.  This list should have two fields – the date and the name of the holiday.
  2. TS-18 came in handy because I read the file that was created from step 1 and whenever I came across or spanned a holiday date, I created a loop that calculated the ROC for the prior five days and also for the five days that followed.   I created a nomenclature to quickly recognize the ROC span.
    • B54 – ROC between 5 days before and 4 days before – 1 day
    • B53 – ROC between 5 days before and 3 days before – 2 days
    • B52 – ROC between 5 days before and 2 days before – 3 days
    • B51 – ROC between 5 days before and 1 days before – 4 days
    • B43 – ROC between 4 days before and 3 days before – 1 day
    • B42 – ROC between 4 days before and 2 days before – 2 days
    • B41 – ROC between 4 days before and 1 days before – 3 days
    • B32 – ROC between 3 days before and 2 days before – 1 day
    • B31 – ROC between 3 days before and 1 days before – 2 days
    • B21 – ROC between 2 days before and 1 days before – 1 day
    • A12 – ROC between 1 days after and 2 days after – 1 day
    • A13 – ROC between 1 days after and 3 days after – 2 days
    • A14 – ROC between 1 days after and 4 days after – 3 days
    • A15 – ROC between 1 days after and 5 days after – 4 days
    • A23 – ROC between 2 days after and 3 days after – 1 day
    • A24 – ROC between 2 days after and 4 days after – 2 days
    • A25 – ROC between 2 days after and 5 days after – 3 days
    • A34 – ROC between 3 days after and 4 days after – 1 day
    • A35 – ROC between 3 days after and 5 days after – 2 days
    • A45 – ROC between 4 days after and 5 days after – 1 day
  3. This process created a file that looked like this:
    • Output of ROC with nested for loops
  4. With this data I summed up each ROC calculation (B54 thru A45).  From this you could pick an entry and exit day combination.  The best results were wrapped around Memorial Day.  Here was where I ran into a small but highly aggravating scenario.  Most of the holidays had similar numbers, but there were a few that had some really strange values.  I knew I couldn’t use regular adjusted futures data, because many times these values can go below zero and when doing division with these price adjustments, the values are simply not accurate.  So, I used continuous non adjusted data, but ran into a problem with the rollover gap.  Some of the holidays occurred really close to rollover dates.  The calculations that bridged a rollover was not accurate.  I then remembered Pinnacle data also includes Ratio Adjusted Data or RAD.  I applied the looping algorithm to this data, and it SEEMED to fix the problem.
  5. I was able to pick a B(n,m) or A(m,n) for each market.  If the magnitude of ROC was sufficiently negative, you could use the dates to short the market.

ChatGPT and Python and Numpy to the rescue

I asked ChatGPT to provide python code to generate a list of all federal holidays from 1984.

from pandas.tseries.holiday import USFederalHolidayCalendar
from datetime import datetime,timedelta
import numpy as np
# Create a calendar for U.S. federal holidays
cal = USFederalHolidayCalendar()

# Get the holidays for the year 2014
holidays_2014 = cal.holidays(start='1984-01-01', end='2024-12-31').to_pydatetime()

federalHolidays = []
date_list = holidays_2014.astype(datetime).tolist()
for n in range(len(date_list)):
dateString = f'{date_list[n]:%Y%m%d}'
federalHolidays.append(int(dateString))
Create a list of federal holidays

This worked great, but I had to convert the NumPy datetime construct to a string.  I like to keep things simple.  You will see this in the code.  I started to get to work on the second part of the task when I discovered there were no dates for GOOD FRIDAYS – argh!  ChatGPT to rescue once again.

def good_friday_dates(start_year, end_year):
good_friday_dates = []
for year in range(start_year, end_year + 1):
# Calculate the date of Easter Sunday for the given year
easter_sunday = calculate_easter_date(year)

# Good Friday is two days before Easter Sunday
good_friday = easter_sunday - timedelta(days=2)

# Add the Good Friday date to the list
good_friday_dates.append(good_friday)

return good_friday_dates

def calculate_easter_date(year):
# Algorithm to calculate the date of Easter Sunday
a = year % 19
b = year // 100
c = year % 100
d = b // 4
e = b % 4
f = (b + 8) // 25
g = (b - f + 1) // 3
h = (19 * a + b - d - g + 15) % 30
i = c // 4
k = c % 4
l = (32 + 2 * e + 2 * i - h - k) % 7
m = (a + 11 * h + 22 * l) // 451
month = (h + l - 7 * m + 114) // 31
day = ((h + l - 7 * m + 114) % 31) + 1
easter_date = datetime(year, month, day)
return easter_date

# Generate Good Friday dates from 1984 to 2024
good_friday_dates_1984_to_2024 = good_friday_dates(1984, 2024)
Hope this code is right for Good Fridays

Good Friday, as Easter, is all over the map.  Tomorrow is Good Friday.  The code looks pretty gross, so I just accepted it.  It may not be 100% accurate, but if ChatGPT says so….  Once I had a list of all holidays, I was able to start cooking (MLK was added in 1986 and Juneteenth in 2021.)  Since Juneteenth is relatively new it did not offer a statistically significant number of observations.

Future Leak comes in Handy.

Every quant needs some software that will look through data and do some calculations.  I did this project with EasyLanguage, but it was a little difficult.  I had to do a two-pass process (well I did the same with Python too.)  I first created an indicator that imported the holiday dates and then outputted the close (or open of next bar) for close[5], close[4], close[3], close[2], close[1] and then waited 1, 2, 3, 4 and 5 bars after the date and printed out those respective closing prices.  I did not do this step in EasyLanguage.  I actually create EasyLanguage as my output.  Here is what it looked like:

holidayName[1]="MemorialDay";
fiveBeforeArr[1]=1010518;
fourBeforeArr[1]=1010521;
threeBeforeArr[1]=1010522;
twoBeforeArr[1]=1010523;
oneBeforeArr[1]=1010524;
oneAfterArr[1]=1010529;
twoAfterArr[1]=1010530;
threeAfterArr[1]=1010531;
fourAfterArr[1]=1010601;
fiveAfterArr[1]=1010604;
holidayName[2]="July4th";
fiveBeforeArr[2]=1010626;
fourBeforeArr[2]=1010627;
threeBeforeArr[2]=1010628;
twoBeforeArr[2]=1010629;
oneBeforeArr[2]=1010702;
oneAfterArr[2]=1010705;
twoAfterArr[2]=1010706;
threeAfterArr[2]=1010709;
fourAfterArr[2]=1010710;
fiveAfterArr[2]=1010711;
holidayName[3]="LaborDay";
fiveBeforeArr[3]=1010824;
fourBeforeArr[3]=1010827;
threeBeforeArr[3]=1010828;
twoBeforeArr[3]=1010829;
oneBeforeArr[3]=1010830;
oneAfterArr[3]=1010904;
twoAfterArr[3]=1010905;
threeAfterArr[3]=1010906;
fourAfterArr[3]=1010907;
fiveAfterArr[3]=1010910;
All key dates are stored in arrays.

Future leak allows you to peak into the future and this comes in super handy when doing research like this.  Here is some python code in TS-18 that does all these calculations in one sweep.


# The date of the holiday and the holiday name are stored in lists
# Each Holiday has its own date and 20 ROC calculations
# These calculations are stored in lists as well
tempDate = int(extraData[extraCnt][0]) #first field in the csv file
whichHoliday = extraData[extraCnt][1] #second field in the csv file
if date[D] == tempDate or (date[D] > tempDate and date[D1] < tempDate):
foundJ = 99
for j in range(12):
if whichHoliday == listOfHolidayClass[j].holidayName:
foundJ = j
listOfHolidayClass[foundJ].holidayDates.append(tempDate);
for j in range(-5,-1): #Before Holiday
for k in range(j+1,0):
denom = close[D+j]
listOfHolidayClass[foundJ].rocList.append((close[D+k] - close[D+j])/denom)
for j in range(0,4): #After Holiday - here is the future leak
for k in range(j+1,5):
denom = close[D+j]
listOfHolidayClass[foundJ].rocList.append((close[D+k] - close[D+j])/denom)
extraCnt = extraCnt + 1
Python code using future leak to calculate the 20 ROC from before and after holiday

I then printed this out to a csv file and imported into Excel (see above) and found out the best combination of days for each holiday.  Now that I had the B(n,m) or the A(m,n) values, I need a process to tell TS-18 which day to buy/short and exit.  Here is some code that, again uses future leak, to print out the five dates before the holiday and the five dates after the holiday.

tempDate = int(extraData[extraCnt][0])
whichHoliday = extraData[extraCnt][1]
if date[D] == tempDate or (date[D] > tempDate and date[D1] < tempDate):
for j in range(12):
if whichHoliday == listOfHolidayClass[j].holidayName:
foundJ = j
print(date[D],end=',')
print(whichHoliday,end=',')
for j in range(-5,6):
print(date[D+j],end=',')
print("",end = '\n')
extraCnt = extraCnt + 1

# Here is what the file looked like
19840103,NewYear,19831223,19831227,19831228,19831229,19831230,19840103,19840104,19840105,19840106,19840109,19840110,
19840221,PresidentsDay,19840213,19840214,19840215,19840216,19840217,19840221,19840222,19840223,19840224,19840227,19840228,
19840423,GoodFriday,19840413,19840416,19840417,19840418,19840419,19840423,19840424,19840425,19840426,19840427,19840430,
19840529,MemorialDay,19840521,19840522,19840523,19840524,19840525,19840529,19840530,19840531,19840601,19840604,19840605,
19840705,July4th,19840627,19840628,19840629,19840702,19840703,19840705,19840706,19840709,19840710,19840711,19840712,
19840904,LaborDay,19840827,19840828,19840829,19840830,19840831,19840904,19840905,19840906,19840907,19840910,19840911,
19841008,ColumbusDay,19841001,19841002,19841003,19841004,19841005,19841008,19841009,19841010,19841011,19841012,19841015,
19841112,VeteransDay,19841105,19841106,19841107,19841108,19841109,19841112,19841113,19841114,19841115,19841116,19841119,
19841123,Thanksgiving,19841115,19841116,19841119,19841120,19841121,19841123,19841126,19841127,19841128,19841129,19841130,
Create the dates that occur in the date B4 and after holiday

Now read the data in and pick how many days before to b/s and before to exit or after to b/s and to exit

holidayBuyDates = []
holidayXitDates = []
gfCnt = 0

#structure of holidayDatesData list - all strings
# 0.) Holiday Date
# 1.) Holiday Name
# 2.) 5-Before
# 3.) 4-Before
# 4.) 3-Before
# 5.) 2-Before
# 6.) 1-Before
# 7.) 0-Before/After
# 8.) 1-After
# 9.) 2-After
# 10.) 3-After
# 11.) 4-After
# 12.) 5-After
#Below I pick 1 day after to buy and 4 days after to exit [8,11]
for j in range(numHolidayDates):
if holidayDatesData[j][1] == "MemorialDay":
holidayBuyDates.append(int(holidayDatesData[j][8]))
holidayXitDates.append(int(holidayDatesData[j][11]))



# Okay Let's put in some logic to create a long position
if not(long) and canTrade and date[D] == holidayBuyDates[gfCnt]:
price = close[D]
tradeName = "Hol-A1Buy"
posSize = 1
tradeTicket.append([buy,tradeName,posSize,price,mkt])
# Long Exits
if long and canTrade and date[D] == holidayXitDates[gfCnt]:
price = longExit
tradeName = "Hol-A4Xit"
tradeTicket.append([exitLong,tradeName,curShares,price,mkt])
gfCnt = gfCnt + 1
TradingSimual_-18 Code to execute buys and exits
No execution fees – executing on close of the day
Memorial Day Example -----------------------------------------
Sys Name : TS-18HolidayTest
Mkt Symb : TY Mkt Name : 10YNote
19840530 Hol-A1Buy 1 -35.90625 0.00 0.00
19840604 Hol-A4Xit 1 -34.12500 1731.25 1731.25
19850529 Hol-A1Buy 1 -18.43750 0.00 0.00
19850603 Hol-A4Xit 1 -16.96875 1418.75 3150.00
19860528 Hol-A1Buy 1 -0.40625 0.00 0.00
19860602 Hol-A4Xit 1 -2.87500 -2518.75 631.25
19870527 Hol-A1Buy 1 -1.09375 0.00 0.00
19870601 Hol-A4Xit 1 -0.28125 762.50 1393.75
19880601 Hol-A1Buy 1 -1.87500 0.00 0.00
19880606 Hol-A4Xit 1 -0.56250 1262.50 2656.25
19890531 Hol-A1Buy 1 2.68750 0.00 0.00
19890605 Hol-A4Xit 1 4.46875 1731.25 4387.50
19900530 Hol-A1Buy 1 2.50000 0.00 0.00
19900604 Hol-A4Xit 1 3.68750 1137.50 5525.00
19910529 Hol-A1Buy 1 6.59375 0.00 0.00
19910603 Hol-A4Xit 1 6.65625 12.50 5537.50
19920527 Hol-A1Buy 1 13.71875 0.00 0.00
19920601 Hol-A4Xit 1 14.50000 731.25 6268.75
19930602 Hol-A1Buy 1 28.21875 0.00 0.00
19930607 Hol-A4Xit 1 27.96875 -300.00 5968.75
19940601 Hol-A1Buy 1 24.62500 0.00 0.00
19940606 Hol-A4Xit 1 25.93750 1262.50 7231.25
19950531 Hol-A1Buy 1 33.34375 0.00 0.00
19950605 Hol-A4Xit 1 34.59375 1200.00 8431.25
19960529 Hol-A1Buy 1 32.09375 0.00 0.00
19960603 Hol-A4Xit 1 30.93750 -1206.25 7225.00
19970528 Hol-A1Buy 1 32.93750 0.00 0.00
19970602 Hol-A4Xit 1 33.75000 762.50 7987.50
19980527 Hol-A1Buy 1 40.00000 0.00 0.00
19980601 Hol-A4Xit 1 40.31250 262.50 8250.00
19990602 Hol-A1Buy 1 37.62500 0.00 0.00
19990607 Hol-A4Xit 1 37.81250 137.50 8387.50
20000531 Hol-A1Buy 1 36.10938 0.00 0.00
20000605 Hol-A4Xit 1 37.43750 1278.12 9665.62
20010530 Hol-A1Buy 1 42.92188 0.00 0.00
20010604 Hol-A4Xit 1 44.06250 1090.62 10756.25
20020529 Hol-A1Buy 1 50.14062 0.00 0.00
20020603 Hol-A4Xit 1 50.68750 496.88 11253.12
20030528 Hol-A1Buy 1 68.06250 0.00 0.00
20030602 Hol-A4Xit 1 68.34375 231.25 11484.38
20040602 Hol-A1Buy 1 64.43750 0.00 0.00
20040607 Hol-A4Xit 1 63.78125 -706.25 10778.12
20050601 Hol-A1Buy 1 72.32812 0.00 0.00
20050606 Hol-A4Xit 1 72.29688 -81.25 10696.88
20060531 Hol-A1Buy 1 65.46875 0.00 0.00
20060605 Hol-A4Xit 1 66.07812 559.38 11256.25
20070530 Hol-A1Buy 1 66.57812 0.00 0.00
20070604 Hol-A4Xit 1 66.06250 -565.62 10690.62
20080528 Hol-A1Buy 1 77.21875 0.00 0.00
20080602 Hol-A4Xit 1 76.10938 -1159.38 9531.25
20090527 Hol-A1Buy 1 87.12500 0.00 0.00
20090601 Hol-A4Xit 1 87.14062 -34.38 9496.88
20100602 Hol-A1Buy 1 95.48438 0.00 0.00
20100607 Hol-A4Xit 1 96.18750 653.12 10150.00
20110601 Hol-A1Buy 1 102.23438 0.00 0.00
20110606 Hol-A4Xit 1 103.12500 840.62 10990.62
20120530 Hol-A1Buy 1 115.32812 0.00 0.00
20120604 Hol-A4Xit 1 117.37500 1996.88 12987.50
20130529 Hol-A1Buy 1 115.51562 0.00 0.00
20130603 Hol-A4Xit 1 115.59375 28.12 13015.62
20140528 Hol-A1Buy 1 116.31250 0.00 0.00
20140602 Hol-A4Xit 1 116.56250 200.00 13215.62
20150527 Hol-A1Buy 1 121.20312 0.00 0.00
20150601 Hol-A4Xit 1 121.42188 168.75 13384.38
20160601 Hol-A1Buy 1 125.07812 0.00 0.00
20160606 Hol-A4Xit 1 126.50000 1371.88 14756.25
20170531 Hol-A1Buy 1 124.17188 0.00 0.00
20170605 Hol-A4Xit 1 124.65625 434.38 15190.62
20180530 Hol-A1Buy 1 120.35938 0.00 0.00
20180604 Hol-A4Xit 1 119.21875 -1190.62 14000.00
20190529 Hol-A1Buy 1 124.76562 0.00 0.00
20190603 Hol-A4Xit 1 125.76562 950.00 14950.00
20200527 Hol-A1Buy 1 137.43750 0.00 0.00
20200601 Hol-A4Xit 1 137.84375 356.25 15306.25
20210602 Hol-A1Buy 1 133.03125 0.00 0.00
20210607 Hol-A4Xit 1 133.42188 340.62 15646.88
20220601 Hol-A1Buy 1 122.48438 0.00 0.00
20220606 Hol-A4Xit 1 121.70312 -831.25 14815.62
20230531 Hol-A1Buy 1 115.40625 0.00 0.00
20230605 Hol-A4Xit 1 115.10938 -346.88 14468.75

Here are the results for the Morgan Stanley analysis in 2018

Best combos for entry and exit for each holiday.

My analysis covered the same period plus all of 2018, 2019, 2020, 2021, 2022, and 2023.  My combos were very similar in most cases, but the last few years moved the needle a little bit.  However, the results still showed a technical edge.


Discover more from George Pruitt

Subscribe to get the latest posts sent to your email.

2 thoughts on “Trading Before and After Holidays”

Leave a Reply