top of page

Linear Regression Hook on SPX

Updated: Aug 10

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.


An example of an entry and exit


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 %


Backtest Results

Entry Conditions

  1. Close is less than open.

  2. The 3-period Linear Regression Slope is higher than yesterday.

  3. Yesterday's 3-period Linear Regression Slope is lower than the day before.

  4. The day of the week is not a Friday.


Exit Conditions

  1. The trade is exited when:

    1. Close is above the upper custom-made ATR band (take profit).

    2. 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.

Σχόλια


Ο σχολιασμός έχει απενεργοποιηθεί.
bottom of page