Friday the 13th and the Stock Market (Amibroker And Tradestation Code)

The original article can be found here.

The strategy in plain English:

  • We buy at the close of Thursday before Friday the 13th.
  • We sell at the close of Friday the 13th.

Amibroker code:

Buy=Day()==12 AND DayOfWeek()==4;
BuyPrice = Close;
Sell= 0 ;
SellPrice = Close;

ApplyStop(stopTypeNBar,stopModeBars,1,1);

Tradestation code:

{
Strategy - Friday the 13th and the Stock Market
https://www.quantifiedstrategies.com/lessons/friday-the-13th-and-the-stock-market-amibroker-code/
}

Inputs:
	HoldBars(1);

if Dayofmonth(Date) = 12 AND Dayofweek(Date) = 4 Then
	buy this bar on close;

if Barssinceentry(0) >= HoldBars Then
	sell this bar on close;