St. Patrick’s Day – Green Day For Stocks? (Amibroker And Tradestation Code)
The original article can be found here.
Trading rules in plain English:
- If today is March and the calendar day is 16, we buy at the close.
- We sell at the close of the following trading day (the 17th).
If St. Patrick’s Day is on a non-trading day, we buy at the close of the nearest trading day and exit on the 17th or the next trading day.
Amibroker code:
setOption("holdminbars",1);
no1= IIf( Day()==16 AND Month()==3, 1,0);
no2=IIf( Day()==15 AND Ref(DayOfWeek(),1)==1 AND Month()==3 ,1,0);
no3=IIf( Day()==14 AND Ref(DayOfWeek(),1)==1 AND Month()==3 ,1,0);
Buy = no1==1 OR no2==1 OR no3==1;
BuyPrice=Close;
Sell = Month()==3 AND Day()>=17 ;
SellPrice = Close;
Tradestation code:
{
St. Patrick’s Day – Green Day For Stocks?
https://www.quantifiedstrategies.com/lessons/st-patricks-day-green-day-for-stocks/
}
if (Month(Date) = 3 AND Dayofmonth(Date) = 16) Or
(Month(Date) = 3 AND Dayofmonth(Date) = 15 AND Dayofweek(Date) = 5) Or
(Month(Date) = 3 AND Dayofmonth(Date) = 14 AND Dayofweek(Date) = 5)
Then
buy this bar at close;
if Barssinceentry(0) >= 1 then
Sell this bar at close;
