Larry Connors’ Multiple Days Up And Multiple Days Down Strategy (Amibroker And Tradestation Code)

The strategy in plain English:

 

  1. The close is above the 200-day moving average.
  2. The close must be below the 5-day moving average.
  3. The ETF must have dropped at least 4 days out of the last 5 trading days.
  4. If 1-3 above is true, then enter at the close.
  5. Sell on the close when the ETF closes above its 5-day moving average.

 

Click here for the original article.

 

Amibroker code:

 

Fall=C<Ref(C,-1);
TotalFalls=Sum(Fall,5);

Buy= TotalFalls>=4 AND Close>MA(Close,200) AND Close<MA(Close,5);
buyPrice=Close;
Sell= Cross(Close,MA(Close,5));
sellPrice=Close ;

Tradestation code:

 

Variable: Dayslower(0);

If c<c[1] then Dayslower=Dayslower + 1 else Dayslower=0;

If close > average(close,200) and close < average(close,5) and Dayslower >= 4
then Buy this bar on close;

If close > average(close,5) then sell this bar at close;

 

Disclaimer: 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.