OPEN-SOURCE SCRIPT

I11L - Meanreverter 4h

---Overview---
The system buys fear and sells greed.
Its relies on a Relative Strength Index (RSI) and moving averages (MA) to find oversold and overbought states.
It seems to work best in market conditions where the Bond market has a negative Beta to Stocks.
Backtests in a longer Timeframe will clearly show this.

---Parameter---
Frequency: Smothens the RSI curve, helps to "remember" recent highs better.
RsiFrequency: A Frequency of 40 implies a RSI over the last 40 Bars.
BuyZoneDistance: Spacing between the different zones. A wider spacing reduces the amount of signals and icnreases the holding duration. Should be finetuned with tradingcosts in mind.
AvgDownATRSum: The multiple of the Average ATR over 20 Bars * amount of opentrades for your average down. I choose the ATR over a fixed percent loss to find more signals in low volatility environments and less in high volatility environments.


---Some of my thoughts---
Be very careful about the good backtesting performance in many US-Stocks because the System had a favourable environment since 1970.
Be careful about the survivorship bias as well.
52% of stocks from the S&P500 were removed since 2000.
I discount my Annual Results by 5% because of this fact.

You will find yourself quite often with very few signals because of the high market correlation.
My testing suggests that there is no expected total performance difference between a signal from a bad and a signal from a good market condition but a higher volatility.

I am sharing this strategy because i am currently not able to implement it as i want to and i think that meanreversion is starting to be taken more serious by traders.
The challange in implementing this strategy is that you need to be invested 100% of the time to retrieve the expected annual performance and to reduce the fat tail risk by market crashes.


Moving AveragesRelative Strength Index (RSI)

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?

Disclaimer