Backtesting script based on 200 MA and RSI?

Heloyguerra

New member
Could someone please help me with this script i would like to see if could be coded into a study and scan

1. SPY is above its 200-day moving average 2. SPY has had a short-term pullback to the downside. We quantify this by buying the ETF on the close when the 4-period RSI (see appendix for the calculation of RSI) is below 25. 3. If the 4-period RSI closes below 20 anytime we are in the trade, we add another unit to the trade. This effectively doubles our position if SPY continues to decline. 4. Sell SPY on the close after it has reverted to the mean. In this case we will measure that by selling when the same 4-period RSI indicator is above 55.
 
Last edited by a moderator:

Similar threads

Top