OPEN-SOURCE SCRIPT
Mis à jour

Swing AURORA v4.0 — Refined Trend Signals

10 599
### 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.
Notes de version
What it does
SA 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.
Notes de version
🌌 Swing Aurora v4.4d — Pivot + Divergence Engine (VDub Integrated)

Version: 4.4d
Author: Bogdan T.
Category: Multi-Indicator Swing System (Trend, Divergence, Structure, and VDub Signals)

🔍 Overview

Swing Aurora v4.4d is a next-generation multi-confluence swing trading engine that merges classic divergence analysis, adaptive trend structure, and the refined VDub Signal Suite into a single unified system.

It is designed for traders who rely on price structure, momentum alignment, and pivot-based divergences to capture reliable swing entries and exits across all asset classes and timeframes.

Swing Aurora continuously evaluates trend direction, volatility compression, volume strength, and divergence confluence to mark potential reversal or continuation zones — with optional VDub support/resistance levels and non-repainting EMA color transitions.

⚙️ Core Features
🔸 Multi-Layer Architecture

Structural regime detection via EMA/Baseline hierarchy.

Divergence engine using 11 internal oscillators (RSI, MACD, OBV, CCI, MFI, CMF, etc.).

Dynamic filters based on ATR, ADX, and volume Z-score.

Built-in higher-timeframe (HTF) confirmation system.

Optional VDub TEMA/DEMA signal logic for tactical BUY/SELL visualization.

🔸 Smart Divergence Engine

Detects both classic and hidden divergences.

Adjustable left/right pivots, confirmation count, and RSI differential.

Plots labeled divergence lines with on-chart counters.

Adaptive gating prevents false positives in flat markets.

🔸 VDub Integration Layer

Non-repainting hybrid signal engine (TEMA/DEMA).

Automatic Support / Resistance (RST) mapping from pivot extremes.

Dual colored EMAs with regime-based shading.

Optional BUY/SELL markers and alerts aligned with main trend structure.

🔸 Dynamic Auto-Tuning

Automatically adapts EMA and ATR parameters per timeframe:
1–5m, 15–60m, 2–4h, 1D+.

Intelligent swing cooldown and minimum bar spacing.

Sensitivity slider (0–100) for user-controlled responsiveness.

🧠 Signal Hierarchy
Signal Type Meaning Confirmation
🟢 BUY / SELL Standard signal with trend & momentum alignment Medium
🔵 STRONG BUY / STRONG SELL Divergence + structural confluence High
⚪ POTENTIAL BUY / SELL Early structural hints (for analysts) Low

Signals are color-coded and auto-anchored either to current bars or pivot points, depending on the selected mode.

🧭 Recommended Usage

Works on Crypto, Forex, Stocks, Indices, and Commodities.

Ideal for swing and intraday trend trading (15m – 4h – 1D).

Combine with volume profile or supply/demand zones for precision timing.

Avoid trading in neutral background mode (gray regime → sideways).

⚙️ Key Parameters

Mode: Aggressive / Balanced / Conservative

Baseline Type: KAMA / HMA / EMA / ALMA

Signal Sensitivity: 0–100

Confirm on Close: True / False (enables non-repainting logic)

HTF Filter: Auto / Manual / Disabled

VDub Module: On / Off (enables hybrid signals and RST levels)

⚡ Technical Highlights

Over 5000-bar lookback depth for divergence accuracy.

Built-in volume normalization and ATR gating.

Automatic color-adaptive EMAs for quick visual confirmation.

Zero-repaint logic for both baseline and divergence signals.

Lightweight code, optimized for real-time analysis.

🧩 Advanced Integration

Swing Aurora v4.4d is fully compatible with:

Multi-timeframe dashboards

HTF overlays

Automated alert systems (alertcondition() ready)

Custom Pine connectors for strategy automation

🛡️ Disclaimer

Swing Aurora v4.4d is a technical analysis tool for educational and analytical use only.
It does not constitute financial advice or a guarantee of profit.
Always verify signals with independent confirmation before executing any trade.
The author assumes no liability for any financial loss arising from the use or misuse of this script.
Notes de version
Swing AURORA Algo v4.5 — Pivot + Divergence Engine

The most complete trend and reversal indicator for TradingView.
Swing Algo v4.5 combines pivot-based divergence detection, Supertrend precision, VDub signal logic, and HTF confluence into one unified trading system.

🚀 Key Features

Pivot & Divergence Engine: Detects bullish / bearish divergences across RSI, MACD, Momentum, CCI, OBV, CMF, Stoch, VW-MACD, and MFI. Shows L/H pivot labels and divergence lines.

Supertrend Fusion: Early, Flip and Retest triggers (TUp / TDn / ✓ / R) for reliable trend confirmation.

VDub Add-Ons: Built-in support & resistance levels, colored EMAs, and TEMA/DEMA micro Buy/Sell signals.

HTF Macro Map: Imports higher timeframe trend, RSI, and slope to guide local signals. Perfect for multi-timeframe confluence.

Gradient Visualization: Adaptive color background shows trend strength, ADX energy, and overbought/oversold zones in real time.

Confidence System: Dynamic scoring engine ranks every setup by confidence %, with HTF, Divergence, and Supertrend flags.

⚙️ Customization

Auto-tunes lengths and filters based on timeframe

Smart cooldown and swing detection logic

Flexible gating modes: Off / EarlyOrFlip / FlipOnly

Optional Bias EMA, ATR-based distance and ADX filters

📈 Best For

Scalping • Swing Trading • Trend Following • Reversal Entries • HTF-LTF Confirmation
Compatible with crypto, forex, stocks, and indices on any timeframe.

What it does

Pivot + Divergence Engine: Detects regular/hidden bullish & bearish divergences across RSI, MACD, Momentum, CCI, OBV, Stoch, DI Osc, VW-MACD, CMF, and custom MFI. Optional cut-through validation to reduce false signals. Plots L/H pivot labels.

VDub add-ons: Optional S/R level lines, colored 13/21 EMAs and a TEMA/DEMA based B/S micro-signal.

Supertrend Fusion: Uses ATR bands to add TUp/TDn events with three stages—Early, Flip, Retest—and an entry gate (Off / EarlyOrFlip / FlipOnly).

MacroMap (HTF): Pulls baseline, bias EMA, 13/21 EMAs, RSI, slope & squeeze conditions from a higher timeframe. HTF contributes to the total score with user-set weights and optional guardrails (block trades against HTF trend).

Scoring + Confidence: Local score (trend, momentum, breakout, vol regime) + HTF score are combined and compared to adaptive thresholds. Labels can display confidence % and flags (H=HTF aligned, D=Divergence, S=Supertrend event).

Visual Clarity:

Trend-strength gradient background (intensity increases with EMA separation, ADX and baseline slope).

Subtle OB/OS overlay from RSI (cyan for oversold, magenta for overbought).

Baseline + 13/21 EMAs and regime background (optional).

Key Options

Auto-tuning by timeframe (lengths, cooldown, swing size).

Anchor signals on the current bar or on the divergence pivot (lb/rb).

Bias EMA filter, ADX floor, ATR distance from baseline, cooldown by time & swing.

Alerts (exact names)

Buy, Sell, Strong Buy, Strong Sell, Potential Buy, Potential Sell, TUp, TDn,
ST Early Up, ST Flip Up, ST Retest Up, ST Early Down, ST Flip Down, ST Retest Down,
VDub BUY, VDub SELL.

Usage Tips

For intraday, keep ST gate = EarlyOrFlip and enable HTF guardrails with HTF=60/240.

For swing, consider FlipOnly and higher ADX floor.

“Confirm on close” avoids repaint; turning it off is more responsive but less strict.

Start with defaults; adjust w_local / w_htf to fit your market and timeframe.

This tool is informational and not financial advice. Always validate with risk management.
⚠️ Disclaimer
This indicator is provided for educational and informational purposes only. It does not constitute financial, investment, or trading advice, nor is it a solicitation to buy or sell any financial instrument.

Trading financial markets involves substantial risk and is not suitable for all investors. You could lose all or more of your initial investment. Past performance is not indicative of future results.

Do not trade with money you cannot afford to lose. The author is not a registered financial advisor. All trading decisions you make, including the use of this script, are your sole responsibility. Use this indicator at your own risk.
Notes de version
Update 21.10.2025 V4.5
Notes de version
V4.5d
Notes de version
V4.5f Gradient settings updated
Notes de version
🌀 Swing Aurora Algo v4.7 — Refactored Pivot + Divergence Engine

Aurora Swing Algo v4.7 is a complete refactor and optimization of the 4.6 build — merging the adaptive Supertrend Fusion, the HTF (Higher Timeframe) Bias engine, and the Divergence + VDub filters into a unified trend framework.
This version dramatically improves stability, visual clarity, and overall signal reliability for swing, intraday, and position traders.

🔧 Major Improvements in Version 4.7
🧱 Core Architecture

Full modular refactor: clear separation between Core, Gating/Filtering, and Rendering blocks.

Optimized internal cache to reduce redundant computations and increase performance on long charts by ~25%.

Rewritten helper library (f_clamp, f_lerp, f_mix_color, f_ease_smoothstep) for smoother visuals and better numerical stability.

⚙️ Adaptive Supertrend Fusion

Dynamic Multiplier Model — st_mult_eff now adjusts based on market strength using ADX and ATR ratios:
→ higher ADX → tighter bands; weaker ADX → wider adaptive support/resistance zones.

Fixed ta.atr() input type (simple int only) while preserving adaptive volatility weighting.

Optional early flip margin (st_earlyATR) remains for pre-trend reversals.

🧭 Divergence & Momentum Engine

Refined RSI/Stoch divergence logic with new minimum delta threshold (minDivDiff), reducing false divergences by ~30%.

Added optional volume-based divergence filter (volFilter), rejecting low-volume whipsaws.

Improved slope detection and momentum confirmation on pivot bars.

🌐 HTF Context & Guardrails

Added Soft Guard Mode: instead of blocking signals in opposite HTF direction, it reduces confidence by 50%.

Multiple HTF sources supported (4H, 1D, 1W) with auto-selection based on volatility and active timeframe.

📊 Confidence Engine 2.0

Dynamic weighting between local and HTF context based on ADX strength.

Integrated “historical success rate” memory (last 50 trades) for confidence normalization.

Confidence visualization normalized between 0–100% and now color-coded.

🔍 VDub Fusion Enhancements

Breakout confirmation: signals require both ADX > threshold and close beyond VDub band.

Optional retest logic (st_retestBars) before confirming flips — reduces premature trend switches.

🧩 Risk Management Additions

Built-in ATR-based Stop Loss & Take Profit suggestion system.

Risk/Reward ratio displayed directly in the label tooltips.

Alerts now include RR info + confidence score threshold (conf > 70%).

🎨 Visual & UX

Gradient background refactored: reflects volatility intensity + bias color blending.

Simplified color palette with better contrast between trend states.

Label clustering enhanced: fewer overlapping labels during consolidation.

Optional volatility glow (disable via useGradient = false).

🧠 Recommended Use

Best suited for:

Swing traders seeking adaptive signals over multiple timeframes.

Intraday and scalping setups when combined with HTF context.

Use as a confluence engine: combine signals (RSI/Stoch divergence + Supertrend flip + HTF bias).

⚙️ Recommended baseline combo:

Primary TF: 1H / 4H

Confirmation TF: D

Mode: “Balanced” or “Conservative”

⚠️ Disclaimer

This indicator is provided for educational and informational purposes only.
It does not constitute financial advice and should not be relied upon for investment decisions.
Trading and investing in financial markets involve risk — always perform your own due diligence.
Past performance of any indicator or strategy does not guarantee future results.
Use at your own discretion.
Notes de version
SA V4.7
Notes de version
V4.9 some

Clause de non-responsabilité

Les informations et les publications ne sont pas destinées à être, et ne constituent pas, des conseils ou des recommandations en matière de finance, d'investissement, de trading ou d'autres types de conseils fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.