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.
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。