OPEN-SOURCE SCRIPT

Trend Momentum v6

49
Features

- Trend EMAs: plots Fast EMA and Slow EMA to visualize direction and strength.
- RSI Filter (optional): gates signals by RSI thresholds to reduce whipsaws.
- Multi-Timeframe (MTF): computes EMAs/RSI on a selected timeframe via request.security.
- Signals: triangle markers for Long/Short when fast EMA crosses slow EMA with optional RSI gating.
- Bar Coloring: green for up-trend, red for down-trend, neutral otherwise.
- Alerts: built-in alertcondition for Long Signal and Short Signal.
Inputs

- Signal timeframe: timeframe for EMAs/RSI; empty uses chart timeframe.
- Fast/Slow EMA length: trend speed vs smoothness (21/50 default).
- RSI length and thresholds: default RSI(14), thresholds at 50 for symmetry.
- Confirm signals on bar close: requires bar close confirmation to avoid intrabar flips.
- Show signal markers: enable/disable triangles.
- Color bars by trend: enable/disable bar coloring.
Signals

- Long: Fast EMA crosses above Slow EMA, optionally with RSI >= bull threshold.
- Short: Fast EMA crosses below Slow EMA, optionally with RSI <= bear threshold.
- Trend coloring: independent of cross signals; reflects current EMA relation plus optional RSI gating.
Tutorial

- Add to chart:
- Open TradingView → Pine Editor → paste the script → Save → Add to chart.
- Configure:
- Leave Signal timeframe empty for chart timeframe or choose higher TF (e.g., 1h while viewing 5m).
- Start with Fast EMA=21, Slow EMA=50; adjust for your market’s volatility.
- Keep RSI filter on with thresholds at 50 for balanced gating.
- Enable “Confirm signals on bar close” for stable, non-repainting entries.
- Interpret:
- Long triangle appears after a bullish EMA cross that meets RSI criteria (if enabled).
- Bars turn green when trendUp; red when trendDown; neutral when neither condition holds.
- Alerts:
- Add the indicator → Create Alert → Source: this indicator → Condition: Long Signal or Short Signal.
- Configure frequency (Once per bar close recommended when confirm is enabled).
- MTF guidance:
- For intraday, set Signal timeframe to a higher TF (15m–1h) to align entries with dominant trend.
- Using lookahead=barmerge.lookahead_off prevents future-data repainting; signals appear only when confirmed.
Customization

- Faster entries: lower Fast EMA (e.g., 13) or raise RSI bull threshold above 50 for stronger momentum.
- Smoother trend: raise Slow EMA (e.g., 100) to reduce choppiness.
- Stricter shorts: set RSI bear threshold below 50 (e.g., 45 or 40).
- Intrabar signals: disable “Confirm signals on bar close” to see crosses mid-bar (more responsive, more noise).
- Fixed indicator timeframe: if you want chart to render with gaps per fixed TF, set timeframe on indicator itself (e.g., timeframe="60") and optionally enable timeframe_gaps.
Best Practices

- Use with structure: apply on liquid instruments; combine with session/volatility filters if needed.
- Risk management: consider ATR-based stops and position sizing; signals are entries, not guarantees.
- Avoid overfitting: keep lengths and thresholds simple; validate across symbols and regimes.

Limitations

- Cross-based entries can lag at reversals and whipsaw in ranges; RSI gating helps but doesn’t eliminate noise.
- MTF aggregation can delay signals compared to the chart’s timeframe; this is expected behavior.

Exención de responsabilidad

La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.