The Holiday Effect: Martin Luther King Day (Amibroker And Tradestation Code)
The strategy in plain English:
- We go long at the close on the first calendar day of the month that is bigger than 11.
- We exit at the calendar day 21 or more.
Click here for the original article.
Amibroker code:
Buy= day()>11 AND Day()<21 AND Month()==1;
buyPrice=Close;
Sell= Day()>=21 ;
sellPrice=Close ;
Tradestation code:
{
The Holiday Effect: Martin Luther King Day (strategy 9)
https://www.quantifiedstrategies.com/trading-the-holiday-effect-anomaly-in-stock-markets/
We go long at the close on the first calendar day of the month that is bigger than 11.
We exit at the calendar day 21 or more.
}
if (Dayofmonth(Date)>11) and (Dayofmonth(Date)<21) and (Month(Date)=1) Then
Buy this bar on close;
if (Dayofmonth(Date)>=21) Then
Sell this bar on close;
Dates of the non-trading Monday of MLK day:
| 1998 | 19 |
| 1999 | 18 |
| 2000 | 17 |
| 2001 | 15 |
| 2002 | 21 |
| 2003 | 20 |
| 2004 | 19 |
| 2005 | 17 |
| 2006 | 16 |
| 2007 | 15 |
| 2008 | 21 |
| 2009 | 19 |
| 2010 | 18 |
| 2011 | 17 |
| 2012 | 16 |
| 2013 | 21 |
| 2014 | 20 |
| 2015 | 19 |
| 2016 | 18 |
| 2017 | 16 |
| 2018 | 15 |
| 2019 | 21 |
| 2020 | 20 |
| 2021 | 18 |
| 2022 | 17 |
| 2023 | 16 |
The code below goes long the Friday before MLK week, and exits the Friday later:
SetTradeDelays( -1, 0, 0, 0 );
Buy= Day() >=16 AND Day()<=22 AND DayOfWeek()==2 AND Month()==1;
buyPrice=Close;
Sell= BarsSince(Buy)>2 AND DayOfWeek()==5;
sellPrice=Close ;
Buy=ExRem(Buy,Sell);
Disclosure: We are not financial advisors. Please do your own due diligence and investment research or consult a financial professional. All articles are our opinions – they are not suggestions to buy or sell any securities.
