OPEN-SOURCE SCRIPT
MAxRSI Signals [KedArc Quant]

Description:
MAxRSI Indicator Marks LONG/SHORT signals from a Moving Average crossover and (optionally) confirms them with RSI. Includes repaint-safe confirmation, optional higher-timeframe (HTF) smoothing, bar coloring, and alert conditions.
Why combine MA + RSI
* The MA crossover is the primary trend signal (fast trend vs slow trend).
* RSI is a gate, not a second, separate signal. A crossover only becomes a trade signal if momentum agrees (e.g., RSI ≥ level for LONG, ≤ level for SHORT). This reduces weak crosses in ranging markets.
* The parts are integrated in one rule: *Crossover AND RSI condition (if enabled)* → plot signal/alert. No duplicated outputs or unrelated indicators.
How it works (logic)
* MA types: SMA / EMA / WMA / HMA (HMA is built via WMA of `len/2` and `len`, then WMA with `sqrt(len)`).
* Signals:
* LONG when *Fast MA crosses above Slow MA* and (if enabled) *RSI ≥ Long Min*.
* SHORT when *Fast MA crosses below Slow MA* and (if enabled) *RSI ≤ Short Max*.
* Repaint-safe (optional): confirms crosses on closed bars to avoid intrabar repaint.
* HTF (optional): computes MA/RSI on a higher timeframe to smooth noise on lower charts.
* Alerts: crossover alerts + state-flip (bull↔bear) alerts.
How to use (step-by-step)
1. Add to chart. Set MA Type, Fast and Slow (keep Fast < Slow).
2. Turn Use RSI Filter ON for confirmation (default: RSI 14 with 50/50 levels).
3. (Optional) Turn Repaint-Safe ON for close-confirmed signals.
4. (Optional) Turn HTF ON (e.g., 60 = 1h) for smoother signals on low TFs.
5. Enable alerts: pick “MAxRSI Long/Short” or “Bullish/Bearish State”.
Timeframe guidance
* Intraday (1–15m): EMA 9–20 fast vs EMA 50 slow, RSI filter at 50/50.
* Swing (1h–D): EMA 20 fast vs EMA 200 slow, RSI 50/50 (55/45 for stricter).
What makes it original
* Repaint-safe cross confirmation (previous-bar check) for reliable signals/alerts.
* HTF gating (doesn’t compute both branches) for speed and clarity.
* Warning-free MA helper (precomputes SMA/EMA/WMA/HMA each bar), HMA built from built-ins only.
* State-flip alerts and optional RSI overlay on price pane.
Built-ins used
`ta.sma`, `ta.ema`, `ta.wma`, (HMA built from these), `ta.rsi`, `ta.crossover`, `ta.crossunder`, `request.security`, `plot`, `plotshape`, `barcolor`, `alertcondition`, `input.*`, `math.*`.
Note: Indicator only (no orders). Test settings per symbol. Not financial advice.
⚠️ Disclaimer
This script is provided for educational purposes only.
Past performance does not guarantee future results.
Trading involves risk, and users should exercise caution and use proper risk management when applying this strategy.
MAxRSI Indicator Marks LONG/SHORT signals from a Moving Average crossover and (optionally) confirms them with RSI. Includes repaint-safe confirmation, optional higher-timeframe (HTF) smoothing, bar coloring, and alert conditions.
Why combine MA + RSI
* The MA crossover is the primary trend signal (fast trend vs slow trend).
* RSI is a gate, not a second, separate signal. A crossover only becomes a trade signal if momentum agrees (e.g., RSI ≥ level for LONG, ≤ level for SHORT). This reduces weak crosses in ranging markets.
* The parts are integrated in one rule: *Crossover AND RSI condition (if enabled)* → plot signal/alert. No duplicated outputs or unrelated indicators.
How it works (logic)
* MA types: SMA / EMA / WMA / HMA (HMA is built via WMA of `len/2` and `len`, then WMA with `sqrt(len)`).
* Signals:
* LONG when *Fast MA crosses above Slow MA* and (if enabled) *RSI ≥ Long Min*.
* SHORT when *Fast MA crosses below Slow MA* and (if enabled) *RSI ≤ Short Max*.
* Repaint-safe (optional): confirms crosses on closed bars to avoid intrabar repaint.
* HTF (optional): computes MA/RSI on a higher timeframe to smooth noise on lower charts.
* Alerts: crossover alerts + state-flip (bull↔bear) alerts.
How to use (step-by-step)
1. Add to chart. Set MA Type, Fast and Slow (keep Fast < Slow).
2. Turn Use RSI Filter ON for confirmation (default: RSI 14 with 50/50 levels).
3. (Optional) Turn Repaint-Safe ON for close-confirmed signals.
4. (Optional) Turn HTF ON (e.g., 60 = 1h) for smoother signals on low TFs.
5. Enable alerts: pick “MAxRSI Long/Short” or “Bullish/Bearish State”.
Timeframe guidance
* Intraday (1–15m): EMA 9–20 fast vs EMA 50 slow, RSI filter at 50/50.
* Swing (1h–D): EMA 20 fast vs EMA 200 slow, RSI 50/50 (55/45 for stricter).
What makes it original
* Repaint-safe cross confirmation (previous-bar check) for reliable signals/alerts.
* HTF gating (doesn’t compute both branches) for speed and clarity.
* Warning-free MA helper (precomputes SMA/EMA/WMA/HMA each bar), HMA built from built-ins only.
* State-flip alerts and optional RSI overlay on price pane.
Built-ins used
`ta.sma`, `ta.ema`, `ta.wma`, (HMA built from these), `ta.rsi`, `ta.crossover`, `ta.crossunder`, `request.security`, `plot`, `plotshape`, `barcolor`, `alertcondition`, `input.*`, `math.*`.
Note: Indicator only (no orders). Test settings per symbol. Not financial advice.
⚠️ Disclaimer
This script is provided for educational purposes only.
Past performance does not guarantee future results.
Trading involves risk, and users should exercise caution and use proper risk management when applying this strategy.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuna uygun olarak, bu komut dosyasının oluşturucusu bunu açık kaynaklı hale getirmiştir, böylece yatırımcılar betiğin işlevselliğini inceleyip doğrulayabilir. Yazara saygı! Ücretsiz olarak kullanabilirsiniz, ancak kodu yeniden yayınlamanın Site Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.