RSI + MACD Long-Only Strategy by agrothe

By agrothe

Performance Metrics

Description

RSI + MACD Long-Only StrategyOverview: Momentum-based, long-only strategy combining RSI and MACD. Entries favor upside momentum; exits trigger on momentum fades or risk targets. Signals are state-gated so you get one exit per entry (no multiple exits without a prior entry).Entry conditions:RSI crosses above the midline (default 50) while MACD is bullish (MACD > Signal, optionally MACD > 0), ORMACD crosses above its Signal while RSI is at/above the midline.Optional filters:EMA trend filter: only enter if price > EMA(n).Oversold context: only enter within N bars after RSI dipped below the oversold threshold.Exit conditions:RSI crosses below the midline, ORMACD crosses below its Signal with MACD histogram ≤ 0.Optional risk exit: Take Profit / Stop Loss based on percentage from average entry price.Risk management:Inputs: Use TP/SL (on/off), TP% (default 3.0), SL% (default 1.5).Implements protective strategy.exit (limit/stop) while in position.Signal-based exit uses strategy.close to flatten.Position management:Long-only, no pyramiding (single position at a time).Internal state ensures entries occur only when flat and exits only when in a position.Inputs you can tune:RSI: length, overbought, oversold, midline.MACD: fast length, slow length, signal length; toggle “Require MACD > 0”.Signals: oversold lookback window; EMA trend on/off and EMA length.Risk: TP% and SL%.Visuals: show entry/exit markers, bar coloring; optional debug background on raw triggers.Visuals and alerts:Plots EMA (optional), draws entry/exit markers, optional bar coloring, and a faint background on raw long triggers to aid tuning.Alert conditions provided for entries and exits.Notes:Designed for bar-close evaluation; performance varies by symbol/timeframe—tune inputs accordingly.Long-only; intended for trend-following momentum with basic risk control.Not financial advice.

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView