Overnight In The S&P 500 – Three Down Days (Amibroker And Tradestation code)

The strategy in plain English:

 

  1. SPY must be down 3 days in a row (from close to close).
  2. Entry on close on the 3rd down day.
  3. Exit at the next day’s open.

 

 

Amibroker code:

 

setOption(“holdminbars”,1);

Buy= C<Ref(C,-1) AND Ref(C,-1)<Ref(C,-2) AND Ref(C,-2)<Ref(C,-3) ;

buyPrice=Close;

Sell= C>0; // forced close of position

sellPrice= Open ;

 

Tradestation code:

 

If c<c[1] and c[1]<c[2] and c[2]<c[3]

then buy this bar at c;

Sell next bar at open;

 

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.