What It Detects
Stocks with:
- MACD line crossing above signal line (bullish crossover)
- Price in uptrend (above 200-day MA)
- Momentum shifting positive
- Early entry before big move
The Formula
cross_above(macd(), macd_signal()) and c > sma(200)
How It Works
cross_above(macd(), macd_signal())- MACD line just crossed above its signal linec > sma(200)- Price is above 200-day moving average (uptrend)
This catches the exact moment momentum turns positive in a trending stock.
When to Use
Best for:
- Swing trading (hold 2-6 weeks)
- Catching trend resumption after pullback
- Medium to long-term trend following
- Lower-frequency trading
Avoid when:
- Choppy, sideways markets (false signals)
- Very short-term trading (too slow)
- Stocks in downtrend (catches dead cat bounces)
MACD Basics
Components:
- MACD Line: 12-day EMA - 26-day EMA
- Signal Line: 9-day EMA of MACD
- Histogram: MACD - Signal
Crossover:
- Bullish: MACD crosses above Signal → buy signal
- Bearish: MACD crosses below Signal → sell signal
Parameters You Can Tweak
Strong Trend Only
cross_above(macd(), macd_signal()) and c > sma(200) and sma(50) > sma(200)
- Adds 50-day > 200-day filter
- Only trades strongest uptrends
With Volume Confirmation
cross_above(macd(), macd_signal()) and c > sma(200) and v > sma(v, 20) * 1.5
- Requires 1.5x volume on crossover day
- More reliable signals
Large Caps Only
cross_above(macd(), macd_signal()) and c > sma(200) and market_cap > 10B
- Focus on liquid, institutional stocks
- Smoother trends, fewer fakeouts
Add Price Confirmation
cross_above(macd(), macd_signal()) and c > sma(200) and c > sma(20)
- Price must be above 20-day MA
- Confirms short-term momentum
Example Columns to Add
Price: c
MACD: macd()
Signal: macd_signal()
Histogram: macd_hist()
200MA: sma(200)
RSI: rsi(14)
Chg%: roc(1)
Entry Strategies
Conservative (Wait for Confirmation)
- MACD crossover appears on scan
- Wait for price to break above recent high
- Enter on pullback to support
- Stop below MACD crossover day low
Aggressive (Immediate)
- MACD crossover appears on scan
- Check histogram turning positive
- Enter at close or next morning
- Tight stop (3-5%)
Pullback Entry
- MACD crossover happens
- Wait for price to pull back to 20-day MA
- MACD stays positive (no re-cross)
- Enter when price bounces off MA
Exit Strategies
Take Profits:
- MACD crosses back below signal (bearish crossover)
- Price breaks below 20-day MA
- RSI reaches 70+ (overbought)
- Target hit (10-20% depending on timeframe)
Stop Loss:
- Below MACD crossover day low
- Below 50-day MA (trend failure)
- 7-10% below entry (swing trade stop)
Signal Quality
High Quality Signals
- MACD crossing from below zero line (new uptrend)
- Histogram has been negative for weeks (oversold)
- Price holding above key moving averages
- Market trending up (SPY bullish)
Low Quality Signals
- Multiple crossovers recently (choppy)
- MACD crossing near zero (weak momentum)
- Price below 50-day MA (downtrend)
- Market in correction
What to Watch For
Strong signals:
- First crossover after long decline
- Histogram turning from negative to positive
- Price making higher lows
- 200-day MA sloping up
Warning signs:
- Crossover immediately after bearish cross (whipsaw)
- Price breaking support levels
- Volume declining on crossover
- 200-day MA flattening or declining
Common Mistakes
- Trading every crossover - Wait for high-quality setups
- No trend filter - MACD is useless in sideways markets
- Ignoring price action - Confirm with chart patterns
- No stop loss - MACD can be wrong, protect capital
- Overtrading - MACD is for swing trades, not day trading
Combining with Other Indicators
MACD + RSI
cross_above(macd(), macd_signal()) and c > sma(200) and rsi(14) > 40 and rsi(14) < 60
RSI between 40-60 = healthy momentum without extremes
MACD + Price Pattern
cross_above(macd(), macd_signal()) and c > sma(200) and c > sma(20) and (c - l) / (h - l) > 0.5
Adds bullish candlestick filter (close in upper half of range)
MACD + Trend Strength
cross_above(macd(), macd_signal()) and c > sma(200) and (c - sma(200)) / sma(200) * 100 < 20
Price within 20% of 200-day MA (not overextended)
Timeframe Considerations
Daily Charts (Standard)
- Hold 2-6 weeks
- Use 12/26/9 settings (default)
- Best for swing trading
Weekly Charts (Longer-term)
- Hold 2-6 months
- Use same settings on weekly data
- Fewer but higher quality signals
Intraday (Not Recommended)
- Too many false signals
- Better indicators exist for day trading
Related Strategies
- Momentum Breakout - Price-based momentum
- Oversold Bounce - Counter-trend entries
- Volume Spike - Add volume confirmation
Pro Tips
- Best setups: MACD crossing near zero after pullback
- Confirm with chart: Look for consolidation before crossover
- Market filter: Only trade MACD crossovers when SPY is above its 200-day MA
- Risk management: Size smaller on crossovers near resistance
- Multiple timeframes: Check weekly MACD for trend confirmation
- Histogram divergence: Watch for price making new lows while histogram makes higher lows (bullish)
- Patience pays: Wait for the cleanest setups, not every crossover
Advanced: Divergence Trading
Bullish Divergence
Price makes lower low, MACD makes higher low → reversal likely
Bearish Divergence
Price makes higher high, MACD makes lower high → top forming
Note: Divergence signals are more advanced and require chart analysis beyond the scan.