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提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。