OPEN-SOURCE SCRIPT
MACD & RSI Long/Short Indicator

This indicator generates momentum and trend-reversal alerts by combining standard MACD crossovers with RSI extreme zone breakouts. It relies on an internal state machine and an adjustable signal cooldown timer to filter out market noise and prevent rapid, repetitive entries on lower timeframes.
Core Logic & Indicators
RSI (Relative Strength Index): Triggers LE when crossing above the user-defined oversold line and Short signals when crossing below the overbought line.
MACD: Triggers LE and SE alerts based on the crossover of the MACD line and the Signal line.
EMAs: Plots customizable Moving Averages (9, 21, 50, 100, 200) strictly for visual trend context. EMAs do not dictate trade entries or exits.
Key Features
Modular Signal Routing: Independently toggle RSI or MACD Alerts. When both are enabled, the script executes based on whichever indicator fires first.
Signal Cooldown: A customizable bar delay limits how quickly a new signal can trigger after a previous execution, minimizing false Alerts in choppy conditions.
State Machine Guardrails: Enforces a strict 1-LE / 1-SE alternation rule to prevent multiple overlapping orders in the same direction.
Risk Management: Includes native percentage-based Stop Loss (SL) and Take Profit (TP) parameters.
Date Range Filter: Allows users to restrict execution to specific calendar periods.
How to Use
Select your preferred signal source (RSI, MACD, or both) in the settings panel. Adjust the "Signal Cooldown" parameter based on your specific chart timeframe to filter out immediate whipsaws (higher timeframes may require shorter cooldowns). Use the Enable LE/SE checkboxes to test directional bias independently, and calibrate the percentage inputs to establish your SL/TP risk framework.
Core Logic & Indicators
RSI (Relative Strength Index): Triggers LE when crossing above the user-defined oversold line and Short signals when crossing below the overbought line.
MACD: Triggers LE and SE alerts based on the crossover of the MACD line and the Signal line.
EMAs: Plots customizable Moving Averages (9, 21, 50, 100, 200) strictly for visual trend context. EMAs do not dictate trade entries or exits.
Key Features
Modular Signal Routing: Independently toggle RSI or MACD Alerts. When both are enabled, the script executes based on whichever indicator fires first.
Signal Cooldown: A customizable bar delay limits how quickly a new signal can trigger after a previous execution, minimizing false Alerts in choppy conditions.
State Machine Guardrails: Enforces a strict 1-LE / 1-SE alternation rule to prevent multiple overlapping orders in the same direction.
Risk Management: Includes native percentage-based Stop Loss (SL) and Take Profit (TP) parameters.
Date Range Filter: Allows users to restrict execution to specific calendar periods.
How to Use
Select your preferred signal source (RSI, MACD, or both) in the settings panel. Adjust the "Signal Cooldown" parameter based on your specific chart timeframe to filter out immediate whipsaws (higher timeframes may require shorter cooldowns). Use the Enable LE/SE checkboxes to test directional bias independently, and calibrate the percentage inputs to establish your SL/TP risk framework.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。