OPEN-SOURCE SCRIPT
RSI + MACD Multi-Timeframe Strategy

This strategy combines the Relative Strength Index (RSI) from the daily timeframe with the Moving Average Convergence Divergence (MACD) from the 4-hour timeframe to generate precise long entry and exit signals.
The system uses a multi-timeframe approach to align longer-term trend conditions with shorter-term momentum shifts — allowing traders to catch dips with confirmation and exit before reversals.
🧠 Strategy Logic
✅ Long Entry Condition:
- RSI on the daily (1D) timeframe is oversold (below your defined threshold)
- MACD on the 4H timeframe crosses above the signal line
→ A long trade is opened when these two align
✅ Long Exit Condition:
- RSI on the daily timeframe is overbought
- MACD on the 4H timeframe crosses below the signal line
→ The long trade is closed when these two conditions are met
💡 This strategy currently supports long entries only. Short logic can be added if needed.
📊 Indicator Components
🔹 RSI (Relative Strength Index):
- A momentum oscillator that measures the speed and magnitude of price changes.
- Helps identify overbought (potential sell) and oversold (potential buy) conditions.
- Applied on the 1D timeframe (by default) to reflect broader market trend or exhaustion levels.
🔹 MACD (Moving Average Convergence Divergence):
- A trend-following momentum indicator based on moving averages.
- The MACD Line (fast EMA - slow EMA) crossing above the Signal Line indicates bullish momentum.
- Used here on the 4-hour timeframe (by default) for shorter-term momentum confirmation.
🔹 Multi-Timeframe (MTF) Logic:
- Uses request.security() to pull higher timeframe data (1D for RSI, 4H for MACD).
- Ensures no repainting, as it only uses closed candles from the higher timeframe.
- Aligns longer-term signals with shorter-term entries, reducing false signals.
📈 Plotting Options
The script includes a plot selector input allowing you to toggle between:
- RSI Plot (with overbought/oversold lines)
- MACD Plot (MACD line and signal line)
- This helps visualize signal conditions clearly on your chart.
🛠 Customization
- RSI & MACD settings are fully configurable
- RSI and MACD timeframes can be adjusted independently
⚠️ Disclaimer
This strategy is provided for educational and informational purposes only.
It is not financial advice or a recommendation to buy or sell any asset.
Past performance does not guarantee future results. Always test strategies in a simulated environment before live use, and consult with a licensed financial advisor for investment decisions.
The system uses a multi-timeframe approach to align longer-term trend conditions with shorter-term momentum shifts — allowing traders to catch dips with confirmation and exit before reversals.
🧠 Strategy Logic
✅ Long Entry Condition:
- RSI on the daily (1D) timeframe is oversold (below your defined threshold)
- MACD on the 4H timeframe crosses above the signal line
→ A long trade is opened when these two align
✅ Long Exit Condition:
- RSI on the daily timeframe is overbought
- MACD on the 4H timeframe crosses below the signal line
→ The long trade is closed when these two conditions are met
💡 This strategy currently supports long entries only. Short logic can be added if needed.
📊 Indicator Components
🔹 RSI (Relative Strength Index):
- A momentum oscillator that measures the speed and magnitude of price changes.
- Helps identify overbought (potential sell) and oversold (potential buy) conditions.
- Applied on the 1D timeframe (by default) to reflect broader market trend or exhaustion levels.
🔹 MACD (Moving Average Convergence Divergence):
- A trend-following momentum indicator based on moving averages.
- The MACD Line (fast EMA - slow EMA) crossing above the Signal Line indicates bullish momentum.
- Used here on the 4-hour timeframe (by default) for shorter-term momentum confirmation.
🔹 Multi-Timeframe (MTF) Logic:
- Uses request.security() to pull higher timeframe data (1D for RSI, 4H for MACD).
- Ensures no repainting, as it only uses closed candles from the higher timeframe.
- Aligns longer-term signals with shorter-term entries, reducing false signals.
📈 Plotting Options
The script includes a plot selector input allowing you to toggle between:
- RSI Plot (with overbought/oversold lines)
- MACD Plot (MACD line and signal line)
- This helps visualize signal conditions clearly on your chart.
🛠 Customization
- RSI & MACD settings are fully configurable
- RSI and MACD timeframes can be adjusted independently
⚠️ Disclaimer
This strategy is provided for educational and informational purposes only.
It is not financial advice or a recommendation to buy or sell any asset.
Past performance does not guarantee future results. Always test strategies in a simulated environment before live use, and consult with a licensed financial advisor for investment decisions.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。