OPEN-SOURCE SCRIPT
RSI Mean Reversion

This is classic Mean Reversion Strategy. I use this on commodities.
This strategy trades mean reversion signals based on the Relative Strength Index (RSI). It is designed for volatile, mean-reverting instruments where price tends to snap back after reaching extreme levels.
How it works:
The strategy enters a long position when RSI crosses back above the oversold level, signalling that the selling pressure is fading and price is beginning to recover. It enters a short position when RSI crosses back below the overbought level, signalling that buying pressure is weakening and price is starting to pull back. Positions are reversed — a long is closed when a short signal fires and vice versa.
Key feature: Signals trigger when RSI re-enters the normal channel from an extreme zone, not when it first enters the extreme zone. This provides confirmation that the reversal has begun rather than catching a falling knife.
Recommended usage: This strategy works best on volatile instruments that exhibit mean-reverting behaviour, such as Natural Gas futures on the 4-hour timeframe. A short RSI period (3-5) with oversold levels around 30-40 and overbought levels around 70-80 is a good starting point. Optimise the parameters for your specific instrument using backtesting.
Settings: RSI period, oversold level, overbought level, trade direction (Long Only / Short Only / Both), and bar confirmation toggle are all configurable from the settings panel. Alerts are built in for both buy and sell signals.
This strategy trades mean reversion signals based on the Relative Strength Index (RSI). It is designed for volatile, mean-reverting instruments where price tends to snap back after reaching extreme levels.
How it works:
The strategy enters a long position when RSI crosses back above the oversold level, signalling that the selling pressure is fading and price is beginning to recover. It enters a short position when RSI crosses back below the overbought level, signalling that buying pressure is weakening and price is starting to pull back. Positions are reversed — a long is closed when a short signal fires and vice versa.
Key feature: Signals trigger when RSI re-enters the normal channel from an extreme zone, not when it first enters the extreme zone. This provides confirmation that the reversal has begun rather than catching a falling knife.
Recommended usage: This strategy works best on volatile instruments that exhibit mean-reverting behaviour, such as Natural Gas futures on the 4-hour timeframe. A short RSI period (3-5) with oversold levels around 30-40 and overbought levels around 70-80 is a good starting point. Optimise the parameters for your specific instrument using backtesting.
Settings: RSI period, oversold level, overbought level, trade direction (Long Only / Short Only / Both), and bar confirmation toggle are all configurable from the settings panel. Alerts are built in for both buy and sell signals.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.