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.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.