The Holiday Effect: Martin Luther King Day (Amibroker And Tradestation Code)

The strategy in plain English:

  1. We go long at the close on the first calendar day of the month that is bigger than 11.
  2. 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:

199819
199918
200017
200115
200221
200320
200419
200517
200616
200715
200821
200919
201018
201117
201216
201321
201420
201519
201618
201716
201815
201921
202020
202118
202217
202316

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.