Moving Averages With RSI (Amibroker And Tradestation Code)

The strategy in plain English:

This strategy couples moving averages with RSI. It might work on different ETFs, but we tested on the ETF with the ticker code SPY.

  1. The close must cross below the 80-day moving average of the close OR cross below the 80-day average of the lows.
  2. The two-day RSI must be below 30.
  3. If 1 and 2 are true, then buy at the close.
  4. Exit at the close when the close is higher than yesterday’s high.

Click here to see the original article.

Amibroker code:

Buy= ( Cross(MA(C,80),Close) OR Cross(MA(C,80),Low) ) AND RSI(2)<30;
buyPrice=Close;
Sell= Close>Ref(H,-1);
sellPrice=Close ;

Tradestation code:

{
Moving Averages With RSI (Strategy 74)
The close or low must cross below the 80-day moving average of the close.
The two-day RSI must be below 30.
If 1 and 2 are true, then buy at the close.
Exit at the close when the close is higher than yesterday's high.
}

Inputs:
	MaLookback(80),
	RsiLookback(2),
	RsiTreshold(30);
	
if (Average(Close, MaLookback) cross over Close or Average(Close, MaLookback) cross over Low) and RSI(Close, RsiLookback) < RsiTreshold Then
	buy this bar at close;

if Close > High[1] then 
	Sell this bar at close;

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.