ETF 3-Day Reversion Strategy

Introduction: This strategy is a modification of the “3-day Mean Reversion Strategy” from the book "High Probability ETF Trading" by Larry Connors and Cesar Alvarez. In the book, the authors discuss a high-probability ETF mean reversion strategy for a 1-day time-frame with these simple rules:

  • The price must be above the 200 day SMA and below the 5 day SMA .
  • The low of today must be lower than the low of yesterday (must be true for 3 consecutive days)
  • The high of today must be lower than the high of yesterday (must be true for 3 consecutive days)
  • If the 3 rules above are true, then buy on the close of the current day.
  • Exit when the closing price crosses above the 5 day SMA .
In practice and in backtesting, I’ve found that the strategy consistently works better when using an EMA for the trend-line instead of an SMA . So, this script uses an EMA for the trend-line. I’ve also made the length of the exit EMA adjustable.

How it works:
The Strategy will buy when the buy conditions above are true. The strategy will sell when the closing price crosses over the Exit Moving Average

Green line = Exit Moving Average (Default 5 Day EMA )
Blue line = 5 Day EMA (Used as Entry Criteria)

Disclaimer: Open-source scripts I publish in the community are largely meant to spark ideas that can be used as building blocks for part of a more robust trade management strategy. If you would like to implement a version of any script, I would recommend making significant additions/modifications to the strategy & risk management functions. If you don’t know how to program in Pine, then hire a Pine-coder. We can help!
Informacje o Wersji: This strategy is up nearly 10% YTD going long on QQQ and SPY. The original version was hard coded to only trade when the market is above the 200 day EMA. While backtesting index ETFs, I've found multiple instances where someone might not want to have trades filtered out below that trend. So, this new version adds an input that allows the user to select whether or not to enter trades when the market is below the 200 day EMA. The change improved backtest and YTD performance on SPY and QQQ. Cheers!

Want to build custom alerts and custom strategies? Interested in automated trading?

Hire me to code or automate your trading strategy, or schedule a free consultation at:
Skrypt open-source

Zgodnie z prawdziwym duchem TradingView, autor tego skryptu opublikował go jako open-source, aby traderzy mogli go zrozumieć i zweryfikować. Brawo dla autora! Możesz używać go za darmo, ale ponowne wykorzystanie tego kodu w publikacji jest regulowane przez Dobre Praktyki. Możesz go oznaczyć jako ulubione, aby użyć go na wykresie.

Wyłączenie odpowiedzialności

Informacje i publikacje przygotowane przez TradingView lub jego użytkowników, prezentowane na tej stronie, nie stanowią rekomendacji ani porad handlowych, inwestycyjnych i finansowych i nie powinny być w ten sposób traktowane ani wykorzystywane. Więcej informacji na ten temat znajdziesz w naszym Regulaminie.

Chcesz użyć tego skryptu na wykresie?