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提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。