OPEN-SOURCE SCRIPT
Telah dikemas kini Swing AURORA v4.0 — Refined Trend Signals

### Swing Algo v4.0 — Refined Trend Signals
#### Overview
Swing Algo v4.0 is an advanced technical indicator designed for TradingView, built to detect trend changes and provide actionable buy/sell signals in various market conditions. It combines multiple technical elements like moving averages, ADX for trend strength, Stochastic RSI for timing, and RSI divergence for confirmation, all while adapting to different timeframes through auto-tuning. This indicator overlays on your chart, highlighting trend regimes with background colors, displaying buy/sell labels (including "strong" variants), and offering early "potential" signals for proactive trading decisions. It's suitable for swing trading, trend following, or as a filter for other strategies across forex, stocks, crypto, and other assets.
#### Purpose
The primary goal of Swing Algo v4.0 is to help traders identify high-probability trend reversals and continuations early, reducing noise and false signals. It aims to provide clear, non-repainting signals that align with market structure, volatility, and momentum. By incorporating filters like higher timeframe (HTF) alignment, bias EMAs, and divergence, it refines entries for better accuracy. The indicator emphasizes balanced performance across aggressive, balanced, and conservative modes, making it versatile for both novice and experienced traders seeking to optimize their decision-making process.
#### What It Indicates
- **Trend Regimes (Background Coloring)**: The chart background changes color to reflect the current market regime:
- **Green (Intense for strong uptrends, faded when cooling)**: Indicates bullish trends where price is above the baseline and EMAs are aligned upward.
- **Red/Maroon (Intense maroon for strong downtrends, faded red when cooling)**: Signals bearish trends with price below the baseline and downward EMA alignment.
- **Faded Yellow**: Marks "no-trade" zones or potential trend changes, where conditions are choppy, weak, or neutral (e.g., low ADX, near baseline, or low volatility).
- **Buy/Sell Signals**: Labels appear on the chart for confirmed entries:
- "BUY" or "STRONG BUY" for bullish signals (strong variants require higher scores and optional divergence).
- "SELL" or "STRONG SELL" for bearish signals.
- **Potential Signals**: Early warnings like "Potential BUY" or "Potential SELL" appear before full confirmation, allowing traders to anticipate moves (confirmed after a few bars based on the trigger window).
- **Divergence Marks**: Small "DIV↑" (bullish) or "DIV↓" (bearish) labels highlight RSI divergences on pivots, adding confluence for strong signals.
- **Lines**: Optional plots for baseline (teal), EMA13/21 (lime/red based on crossover), providing visual trend context.
Signals are anchored either to the current bar or confirmed pivots, ensuring alignment with price action. The indicator avoids repainting by confirming on close if enabled.
#### Key Parameters and Customization
Swing Algo v4.0 offers minimal yet efficient parameters for fine-tuning, with defaults optimized for common use cases. Most can be auto-tuned based on timeframe for simplicity:
- **Confirm on Close (no repaint)**: Boolean (default: true) – Ensures signals don't repaint by waiting for bar confirmation.
- **Auto-tune by Timeframe**: Boolean (default: true) – Automatically adjusts lengths and sensitivity for 5-15m, 30-60m, 2-4h, or higher frames.
- **Mode**: String (options: Aggressive, Balanced [default], Conservative) – Controls signal thresholds; Aggressive for more signals, Conservative for fewer but higher-quality ones.
- **Signal Anchor**: String (options: Pivot (divLB) [default], Current bar) – Places labels on confirmed pivots or the current bar.
- **Trigger Window (bars)**: Integer (default: 3) – Window for signal timing; auto-tuned if enabled.
- **Baseline Type**: String (options: HMA [default], EMA, ALMA) – Core trend line; lengths auto-tune (e.g., 55 for short frames).
- **Use Bias EMA Filter**: Boolean (default: false) – Adds a long-term EMA for trend bias.
- **Use HTF Filter**: Boolean (default: false) – Aligns with higher timeframe (auto or manual like 60m, 240m, D); override for stricter scoring.
- **Sensitivity (10–90)**: Integer (default: 55) – Adjusts ADX threshold for trend detection; higher = more sensitive.
- **Use RSI-Stoch Trigger**: Boolean (default: true) – Enables Stochastic RSI for entry timing; customizable lengths, smooths, and levels.
- **Use RSI Divergence for STRONG**: Boolean (default: true) – Requires divergence for strong signals; pivot lookback (default: 5).
- **Visual Options**: Booleans for background regime, labels, divergence marks, and lines (all default: true).
These parameters are grouped for ease, with tooltips in TradingView for quick reference. Start with defaults and tweak based on backtesting.
#### How It Works
At its core, Swing Algo v4.0 calculates a baseline (e.g., HMA) to define the trend direction. It then scores potential buys/sells using factors like:
- **Trend Strength**: ADX above a dynamic threshold, combined with EMA crossovers (13/21) and slope analysis.
- **Volatility/Volume**: Bollinger/Keltner squeeze exits, volume z-score, and ATR filters to avoid choppy markets.
- **Timing**: Stochastic RSI crossovers or micro-timing via DEMA/TEMA for precise entries.
- **Filters**: Bias EMA, HTF alignment, gap from baseline, and no-trade zones (weak ADX, near baseline, low vol).
- **Divergence**: RSI pivots confirm strong signals.
- **Scoring**: Buy/sell scores (min 3-5 based on mode) trigger labels only when all gates pass, with early "potential" detection for foresight.
The algorithm processes these in real-time, auto-adapting to timeframe for efficiency. Signals flip only on direction changes to prevent over-trading. For best results, use on liquid assets and combine with risk management.
#### Disclaimer
This indicator is for educational and informational purposes only and does not constitute financial advice, investment recommendations, or trading signals. Trading involves significant risk of loss and is not suitable for all investors. Past performance is not indicative of future results. Always backtest the indicator on your preferred assets and timeframes, and consult a qualified financial advisor before making any trading decisions. The author assumes no liability for any losses incurred from using this script. Use at your own risk.
#### Overview
Swing Algo v4.0 is an advanced technical indicator designed for TradingView, built to detect trend changes and provide actionable buy/sell signals in various market conditions. It combines multiple technical elements like moving averages, ADX for trend strength, Stochastic RSI for timing, and RSI divergence for confirmation, all while adapting to different timeframes through auto-tuning. This indicator overlays on your chart, highlighting trend regimes with background colors, displaying buy/sell labels (including "strong" variants), and offering early "potential" signals for proactive trading decisions. It's suitable for swing trading, trend following, or as a filter for other strategies across forex, stocks, crypto, and other assets.
#### Purpose
The primary goal of Swing Algo v4.0 is to help traders identify high-probability trend reversals and continuations early, reducing noise and false signals. It aims to provide clear, non-repainting signals that align with market structure, volatility, and momentum. By incorporating filters like higher timeframe (HTF) alignment, bias EMAs, and divergence, it refines entries for better accuracy. The indicator emphasizes balanced performance across aggressive, balanced, and conservative modes, making it versatile for both novice and experienced traders seeking to optimize their decision-making process.
#### What It Indicates
- **Trend Regimes (Background Coloring)**: The chart background changes color to reflect the current market regime:
- **Green (Intense for strong uptrends, faded when cooling)**: Indicates bullish trends where price is above the baseline and EMAs are aligned upward.
- **Red/Maroon (Intense maroon for strong downtrends, faded red when cooling)**: Signals bearish trends with price below the baseline and downward EMA alignment.
- **Faded Yellow**: Marks "no-trade" zones or potential trend changes, where conditions are choppy, weak, or neutral (e.g., low ADX, near baseline, or low volatility).
- **Buy/Sell Signals**: Labels appear on the chart for confirmed entries:
- "BUY" or "STRONG BUY" for bullish signals (strong variants require higher scores and optional divergence).
- "SELL" or "STRONG SELL" for bearish signals.
- **Potential Signals**: Early warnings like "Potential BUY" or "Potential SELL" appear before full confirmation, allowing traders to anticipate moves (confirmed after a few bars based on the trigger window).
- **Divergence Marks**: Small "DIV↑" (bullish) or "DIV↓" (bearish) labels highlight RSI divergences on pivots, adding confluence for strong signals.
- **Lines**: Optional plots for baseline (teal), EMA13/21 (lime/red based on crossover), providing visual trend context.
Signals are anchored either to the current bar or confirmed pivots, ensuring alignment with price action. The indicator avoids repainting by confirming on close if enabled.
#### Key Parameters and Customization
Swing Algo v4.0 offers minimal yet efficient parameters for fine-tuning, with defaults optimized for common use cases. Most can be auto-tuned based on timeframe for simplicity:
- **Confirm on Close (no repaint)**: Boolean (default: true) – Ensures signals don't repaint by waiting for bar confirmation.
- **Auto-tune by Timeframe**: Boolean (default: true) – Automatically adjusts lengths and sensitivity for 5-15m, 30-60m, 2-4h, or higher frames.
- **Mode**: String (options: Aggressive, Balanced [default], Conservative) – Controls signal thresholds; Aggressive for more signals, Conservative for fewer but higher-quality ones.
- **Signal Anchor**: String (options: Pivot (divLB) [default], Current bar) – Places labels on confirmed pivots or the current bar.
- **Trigger Window (bars)**: Integer (default: 3) – Window for signal timing; auto-tuned if enabled.
- **Baseline Type**: String (options: HMA [default], EMA, ALMA) – Core trend line; lengths auto-tune (e.g., 55 for short frames).
- **Use Bias EMA Filter**: Boolean (default: false) – Adds a long-term EMA for trend bias.
- **Use HTF Filter**: Boolean (default: false) – Aligns with higher timeframe (auto or manual like 60m, 240m, D); override for stricter scoring.
- **Sensitivity (10–90)**: Integer (default: 55) – Adjusts ADX threshold for trend detection; higher = more sensitive.
- **Use RSI-Stoch Trigger**: Boolean (default: true) – Enables Stochastic RSI for entry timing; customizable lengths, smooths, and levels.
- **Use RSI Divergence for STRONG**: Boolean (default: true) – Requires divergence for strong signals; pivot lookback (default: 5).
- **Visual Options**: Booleans for background regime, labels, divergence marks, and lines (all default: true).
These parameters are grouped for ease, with tooltips in TradingView for quick reference. Start with defaults and tweak based on backtesting.
#### How It Works
At its core, Swing Algo v4.0 calculates a baseline (e.g., HMA) to define the trend direction. It then scores potential buys/sells using factors like:
- **Trend Strength**: ADX above a dynamic threshold, combined with EMA crossovers (13/21) and slope analysis.
- **Volatility/Volume**: Bollinger/Keltner squeeze exits, volume z-score, and ATR filters to avoid choppy markets.
- **Timing**: Stochastic RSI crossovers or micro-timing via DEMA/TEMA for precise entries.
- **Filters**: Bias EMA, HTF alignment, gap from baseline, and no-trade zones (weak ADX, near baseline, low vol).
- **Divergence**: RSI pivots confirm strong signals.
- **Scoring**: Buy/sell scores (min 3-5 based on mode) trigger labels only when all gates pass, with early "potential" detection for foresight.
The algorithm processes these in real-time, auto-adapting to timeframe for efficiency. Signals flip only on direction changes to prevent over-trading. For best results, use on liquid assets and combine with risk management.
#### Disclaimer
This indicator is for educational and informational purposes only and does not constitute financial advice, investment recommendations, or trading signals. Trading involves significant risk of loss and is not suitable for all investors. Past performance is not indicative of future results. Always backtest the indicator on your preferred assets and timeframes, and consult a qualified financial advisor before making any trading decisions. The author assumes no liability for any losses incurred from using this script. Use at your own risk.
Nota Keluaran
What it doesSA v4.4d is a swing-trading toolkit that combines a baseline trend engine, multi-indicator divergence detection (regular & hidden), RSI-Stoch timing, MACD confirmation, ADX/volatility filters, and an optional HTF (higher-timeframe) bias.
It aims to surface high-quality BUY/SELL flips only when trend, momentum, and structure align.
Highlights
Auto-Tune by Timeframe – adaptive lengths/sensitivity for scalping → swing charts.
Baseline Regime – EMA/KAMA/HMA/ALMA with slope and distance checks (ATR-based).
Divergence Engine (v5) – counts confirmations across RSI, MACD, Delta MACD, Momentum, CCI, OBV, Stoch, DI Osc, VW-MACD, CMF, and MFI. Works with regular or hidden divergences.
RSI-Stoch Trigger – optional entry timing, strict or relaxed.
HTF Bias – confirm entries only when price agrees with chosen higher timeframe.
Cool-down & Min Swing Bars – avoids rapid flip-flops and noise.
Clean Visuals – regime background, baseline/EMAs, optional divergence lines/labels.
Alerts – Buy / Sell / Strong Buy / Strong Sell / Potential signals + Trend Up/Down crosses.
How to read signals
BUY / SELL labels = Baseline direction + momentum + distance + RSI-Stoch/MACD + filters pass.
STRONG BUY / STRONG SELL = All of the above plus divergence confirmation (regular or hidden based on your setting).
Potential alerts = momentum trigger without full confirmation (use for early watch, not entries).
Regime background – teal = bullish alignment, red = bearish, none = mixed/chop.
Tip: For entries, prefer STRONG signals in the direction of the regime and HTF bias. For exits, watch the opposite signal, momentum rollovers, or your own R/R plan.
Inputs & Parameterization
Core
Confirm on close (no repaint): evaluates on bar close. Turn off only if you know what you’re doing.
Auto-tune by timeframe: adaptive lengths/sensitivity.
Mode: Aggressive / Balanced / Conservative — shifts minimum score to trigger.
Signal anchor: Pivot (divLB) anchors labels to the divergence pivot; Current bar anchors to the live bar.
Trigger window (bars): small lookback used in a few momentum checks.
Sensitivity & Filters
Signal Sensitivity (0–100): increases minimum score required.
Cooldown bars: minimum bars between flips.
Min bars per swing: extra spacing to avoid whipsaw.
Min distance from baseline (ATR×): requires price to be meaningfully away from baseline.
Min ADX floor: filters low-trend environments.
Baseline & Bias
Baseline: KAMA/HMA/EMA/ALMA.
Fast EMA / Bias EMA lengths: bias EMA can be enforced via “Use Bias EMA filter”.
HTF Filter
Use HTF filter: enable/disable.
HTF TF: Auto / Chart / 60 / 240 / D / W.
HTF override (0–2): small boost to “strong” requirement when HTF agrees.
RSI–Stoch
Use RSI-Stoch trigger, lengths (Stoch/RSI/K/D), Overbought/Oversold, Strict (band cross + K>D/K<D).
Divergences
Left/Right Bars (div): pivot width.
Show/Use Hidden Divergences: toggles hidden vs regular.
Check cut-through: ensures indicator line didn’t “cut through” pivot slope.
Minimum # of indicator confirmations: how many indicators must agree.
Draw divergence lines/labels.
Extra RSI diff filter: optional extra margin on RSI differences.
Visuals
Background by regime, Show labels, Show baseline & EMAs.
Workflow / Suggested Use
Choose a timeframe (e.g., 5m scalp, 1h intra-swing, 4h/daily swing).
Leave Auto-Tune ON to start. Adjust Mode and Signal Sensitivity if too many/few signals.
Enable HTF Filter with a higher TF (e.g., trading 15m → HTF 1h/4h).
Focus on STRONG signals that align with the regime + HTF bias.
Use Potential alerts as watch-list pings; wait for full confirmation for entries.
Notes on repainting & safety
With Confirm on close = ON, signals are calculated on bar close, minimizing repaint behavior. If you disable this, you may see intrabar changes (normal for momentum/divergence tools).
Some filters use lookbacks and pivots; a newly formed pivot is only confirmed after rb right bars.
The script includes guards for deep historical offsets and a large max_bars_back to avoid runtime issues on long histories.
Alerts included
Buy, Sell, Strong Buy, Strong Sell, Potential Buy, Potential Sell, Trend Up, Trend Down
Set your alert to “Once per bar close” if you want confirmed signals only.
Best practices & risk management
Always add risk controls: stop loss, trailing, partials, position sizing.
Combine with SR zones, HTF structure, or volume profile for context.
Avoid trading during major news or when volatility filters (squeeze/ADX) say “no trend”.
Disclaimer !!!!!!!!!!!
This script is for education and research. It is not financial advice and offers no guarantees of profitability. Markets carry risk. You are solely responsible for your trading decisions, compliance with local regulations, and any outcomes.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Penafian
Maklumat dan penerbitan adalah tidak dimaksudkan untuk menjadi, dan tidak membentuk, nasihat untuk kewangan, pelaburan, perdagangan dan jenis-jenis lain atau cadangan yang dibekalkan atau disahkan oleh TradingView. Baca dengan lebih lanjut di Terma Penggunaan.