Nikkei 225 Futures Strategy (Amibroker And Tradestation Code)

The original article can be found here.

The strategy in plain English:

  • We buy the close on the fifth last trading day of the month if the 15-day ADX is above 20.
  • We sell at the close on the second trading day of the month.

Amibroker code:

Buy =  Ref(Month(),4) != Ref(Month(),5) AND ADX(15)>20 ;
buyPrice = Close;
Sell = Ref(Month(),-1) != Ref(Month(),-2) ;
sellPrice = Close ;

Tradestation code:

{
Strategy - Nikkei 225 Futures
https://www.quantifiedstrategies.com/lessons/nikkei-225-futures-strategy-amibroker-code/
It is necessary to import functions: TdaysTillMonthEnd
}

if TdaysTillMonthEnd=4 Then
	Buy at this bar close;
	
if (Month(Date[1])<>Month(Date[2])) then
	Sell at this bar close;