OPEN-SOURCE SCRIPT

Autocorrelation with RSI

26
This indicator uses autocorrelation and RSI to find good entry points for trades. In theory, autocorrelations (correlation of a variable with lagged values) should be a great timing indicator. It goes positive when a trend is confirmed and negative when the trend breaks down so you can use it to follow the trend of play the mean-reversion. But it is not as straightforward as that. If you use autocorrelation to confirm a trend, it would only be helpful if the trend starts slowly (small moves) and then develops into big moves or persistent moves in one direction. If the trend starts with big moves, the autocorrelation will turn positive when most of the move has happened. If you use it for mean-reversion, you need to watch out for noise. You first need to look for evidence that the trend is done using other tools like RSI, momentum indicators, sentiment, fundamental/macro changes, etc, then you can look for entry points using the autocorrelation. Another problem is that you have to decide on a lookback period. RSI uses 14 by default but since few ever change it, then everyone is basically using the same RSI indicators. Since autocorrelation is not a popular indicator, the choice of lookback period matters. You can try to optimize it (fitting past data) but you would likely be overfitting and past performance would be no indicator of future performance.

Note: Autocorrelation is a measure of correlation and therefore has values between -1 and 1, but in this script I change it so that the values are between 0 and 1 to make it fit on the same scale as RSI (for ease of use).

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.