The End Of The Year Rally In The S&P 500 (Amibroker And Tradestation Code)

The strategy in plain English:

The last four days of December and the first three days of January have proved to produce returns significantly higher than the rest of the year.

  • Buy at the close on the fifth last trading day of the year.
  • Sell at the close on the third trading day in January.

Click here to see the original article.

Amibroker code:

Buy= Month()==12 AND Ref(Month(),4)!=Ref(Month(),5);
buyPrice=Close;
Sell= BarsSince(Buy)==7 ;
sellPrice=Close ;

Tradestation code:

{
The End Of The Year Rally In The S&P 500 (Strategy 64)
Buy at the close on the fifth last trading day of the year.
Sell at the close on the third trading day in January.
}

Inputs:
	HoldingPeriod(7);

if Month(Date) = 12 and TdaysTillMonthEnd = 4 then 
	Buy this bar on close;

if BarsSinceEntry >= HoldingPeriod Then
	Sell this bar on close;

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.