A Mean-Reversion Strategy for S&P500
The Idea
The Linear Regression Slope is often used for trend detection, but can also work well to identify reversal points. This strategy uses a "hook" in the short-term Linear Regression Slope for entries, while a custom-made volatility band is made for taking profit or stopping loss. It's optimized for SPX until 2021, but can also be used for other indices.
Setup for Backtest
Market: USA500 (SPX)
Contract: 1 € per point
Broker: IG
Testing environment: ProRealtime 12
Timeframe: Daily
Time zone: CET
No fees and commissions are included.
Result
Total gain: 3 527.2 €
Average gain: 11.8 €
Total trades: 298
Winners: 221
Losers: 76
Breakeven: 1
Max drawdown: –487.9 €
Risk/reward ratio: 0.7
Total time in the market: 24.7 %
Average time in the market: 7 days, 9 hours
CAGR (10 000 € in starting capital): 0.87 %
Entry Conditions
Close is less than open.
The 3-period Linear Regression Slope is higher than yesterday.
Yesterday's 3-period Linear Regression Slope is lower than the day before.
The day of the week is not a Friday.
Exit Conditions
The trade is exited when:
Close is above the upper custom-made ATR band (take profit).
Close is below the lower custom-made ATR band (stop loss).
Code
ProRealTime
FAQ
Q: Am I free to use this strategy however I want?
A: Sure! But we're happy if you refer to our website and keep the creator's name in the code.
Q: I'm using another platform, can you write the code in another language?
A: No, sorry. We might add code in more languages later to the website, but until then, we recommend you try ChatGPT or something similar to help you rewrite it.
Q: Why does my backtest look different when I run the code?
A: The strategy might give different backtest results for several reasons, like added spread or fees, the wrong time-zone settings, or that you're using another type of contract.
Q: Will I make money if I run this strategy live?
A: We don't know. We're not financial advisors, we're just traders sharing our ideas.