Artemis Wave Oscillator🟦 Artemis Wave Oscillator is a Pine v6 reimagination of the classical WaveTrend family, built on a Welford running-stdev channel and EMA-smoothed normalization. Unlike fixed-band WaveTrend variants that ship with hard-coded levels, the engine continuously rescales itself against its own dispersion — producing a momentum curve that stays perfectly bounded between visually consistent reversion bands on every asset and every timeframe, with no manual recalibration.
The indicator integrates six analytical layers — WaveTrend core, dynamic reversion bands, histogram momentum gauge, extremity reversion dots, regular + hidden divergence detection with a Smart AI Filter, and a theme-adaptive PRO dashboard — each operating independently and rendered on a single, clean oscillator panel.
🟦 HOW THE CORE ENGINE WORKS
**WaveTrend Channel**
Each bar, the engine builds an EMA-smoothed midline from the selected price aggregate over the Channel Length window. In parallel, a Welford single-pass running standard deviation measures the channel width — a numerically stable O(N) algorithm that updates the running mean and squared deviation simultaneously, preserving precision on long histories where naive sum-of-squares accumulators drift.
The raw wave is then computed as:
wave_raw = (src − chanMid) / chanDev × 100
This produces a z-score-like signal scaled to the ±100 range. Dividing by the running standard deviation normalizes the output regardless of asset volatility — BTC, EURUSD, SPY, and a small-cap stock all swing through the same band structure without parameter changes.
**EMA Smoothing**
The raw wave is then passed through an EMA of length Average Length to produce the visible `wave` line. This is the dominant responsiveness control — larger values produce a calmer curve with fewer reversion-zone touches.
**Signal Line**
An SMA of the wave (Signal Length) builds the trigger line. Crossovers between the wave and signal line mark momentum regime changes — the same convention used by classical MACD and Stochastic.
**Histogram**
The wave − signal delta is rendered as a filled area. Two opacity tiers distinguish rising momentum (brighter) from fading momentum (dimmer), so the eye picks up acceleration vs. deceleration at a glance.
**Source Selector**
Nine price aggregates are available:
| Source | Formula | Use case |
|---|---|---|
| Open | open | Open-of-bar bias |
| High | high | Top-of-range tracking |
| Low | low | Bottom-of-range tracking |
| Close | close | Standard, fastest reaction |
| OC2 | (open + close) / 2 | Body midpoint |
| HL2 | (high + low) / 2 | Body-independent midpoint |
| HLC3 | (high + low + close) / 3 | Typical mean — default |
| OHLC4 | (open + high + low + close) / 4 | Smoothest |
| HLCC4 | (high + low + 2×close) / 4 | Close-weighted |
🟦 REVERSION BANDS
The user picks a single Reversion Threshold (T) — the distance from zero (in normalized wave units) beyond which the wave is considered overbought (positive side) or oversold (negative side). Three proportional tiers render automatically:
| Tier | Level | Visual |
|---|---|---|
| Inner | ±T | Outer ring of the gradient fill |
| Middle | ±T × 1.25 | Boundary between outer ring and inner extreme |
| Outer | ±T × 1.5 | Hard outer boundary of the gradient fill |
Because the bands are derived from T, they always wrap the threshold no matter how the user tunes it. A trader scaling T from 80 (volatile assets) to 150 (trending assets) keeps the visual context intact without retuning the band levels.
The Reversion Threshold itself drives three downstream features:
- Extremity Dot triggers
- The "Extremities" bar-coloring mode
- The Dashboard Zone tag (OB / MID / OS)
🟦 EXTREMITY DOTS
OB / OS reversion markers — small dual-layer dots that fire when the wave crosses the signal line beyond the Reversion Threshold:
- **OS dot** (bull theme color) → wave crossed UP past −T
- **OB dot** (bear theme color) → wave crossed DOWN past +T
These are the highest-conviction mean-reversion triggers in the script. The dots use a two-track rendering — a pixel-perfect glow + core visual via `plot.style_circles`, paired with an invisible `label.style_circle` carrying a rich tooltip. Hovering on a dot surfaces:
- Direction (Crossed UP / DOWN through Signal)
- Active zone (Below −T / Above +T)
- Current wave value
- Current signal value
- Trading interpretation (mean-reversion long / short opportunity)
🟦 DIVERGENCE DETECTION
Pivots are calculated using `ta.pivothigh` and `ta.pivotlow` with an arm of `Channel Length / 2`. All divergence results appear `Channel Length / 2` bars late — this is standard Pine Script pivot behavior, not a bug.
**Four divergence types:**
| Type | Price | Wave | Signal |
|---|---|---|---|
| Regular Bull (D▲) | Lower Low | Higher Low | Potential reversal up |
| Regular Bear (D▼) | Higher High | Lower High | Potential reversal down |
| Hidden Bull (H▲) | Higher Low | Lower Low | Uptrend continuation |
| Hidden Bear (H▼) | Lower High | Higher High | Downtrend continuation |
Regular divergence uses solid lines (width 2). Hidden divergence uses dashed lines (width 1) — the thinner, dashed style makes the continuation signal visually quieter than the reversal signal, matching their respective conviction tiers. Labels use bracketed symbols (D▲ / D▼ / H▲ / H▼) and each carries a tooltip-rich hover with price + wave context.
**Smart Divergence Filter (AI)**
An optional pre-filter that rejects low-quality divergences before they render. Three independent gates:
1. **Min Wave Swing** — minimum oscillator swing between the two pivots (default: 5 units). Drops noise-level differences where the wave barely moved between pivots.
2. **Min Price Swing (%)** — minimum price swing between pivots as a percentage of the recent `Channel Length × 4` high-low range (default: 0.3%). Drops divergences where price barely moved relative to recent volatility.
3. **Zone Confirmation** — the wave at the current pivot must sit in the matching reversion half:
- Bullish divergence → wave at LL pivot ≤ −T × 0.5 (oversold half)
- Bearish divergence → wave at HH pivot ≥ +T × 0.5 (overbought half)
This encodes the classical "best divergences form at extremes" rule using the wave value itself as the gate — no MFI or volume input required.
When the master toggle is OFF (default), all detected divergences render. When ON, only divergences that clear all three gates survive. The filter applies identically to both chart rendering and alert conditions — no mismatch between visual and alert signals.
🟦 HISTOGRAM
The wave − signal histogram is rendered as a filled area between the histogram value and the zero line. Two opacity tiers per side:
| State | Color | Opacity |
|---|---|---|
| Bull, rising | thBull | Rising Opacity (default 60) |
| Bull, fading | thBull | Fading Opacity (default 40) |
| Bear, rising | thBear | Rising Opacity (default 60) |
| Bear, fading | thBear | Fading Opacity (default 40) |
Rising bars are the most actionable visual cue — they mark momentum that is accelerating in the active direction. Fading bars indicate momentum stalling.
🟦 BAR COLORING
Five mutually exclusive modes apply a wave-driven color to every price bar on the chart:
| Mode | Behavior |
|---|---|
| None | Leave bars untouched (default) |
| Midline Cross | Bull above zero, bear below zero |
| Extremities | Bull beyond +T, bear beyond −T, neutral elsewhere |
| Reversions | Bull on OS dot trigger, bear on OB dot trigger |
| Slope | Bull when wave > signal, bear when wave < signal |
Colors are pulled from the active theme — no per-mode color picker needed.
🟦 DASHBOARD
A compact 2-column, 7-row data panel renders on the last bar when enabled. Every value derives from variables already computed upstream, so the dashboard adds zero overhead until the final bar.
| Row | Left | Right |
|---|---|---|
| Header | Artemis Wave | ▲ BULL / ▼ BEAR / ■ NEUTRAL |
| Wave | Wave | Current value + trend arrow (▲ ▼ ■) |
| Signal | Signal | Current SMA trigger value |
| Strength | Strength | 10-block monospace bar gauge |
| Zone | Zone | OB / MID / OS tag |
| Div | Div | Most recent divergence within last 50 bars (▲ REG / ▼ REG / ▲ HID / ▼ HID / —) |
| Slope | Slope | ▲ UP / ▼ DOWN / ■ FLAT |
The strength gauge normalizes `|wave − signal|` against 50 (typical mid-amplitude swing) and buckets the result into 10 monospace blocks (`█` filled, `░` empty), giving an at-a-glance read of crossover conviction.
**Theme-Adaptive Chrome**
The dashboard auto-inverts its layout based on the active theme:
- **Dark themes** (Tropic, Amber, Pastel, Cyber, Helios, Electric, Candy, Bloomberg, Solar, Royal): header and footer use a faint `thBull` tint, middle rows stay solid dark, text uses full-saturation `thBull`. Border uses `thBull` at 20% transparency for strong theme presence.
- **Light themes** (Midnight, Graphite): backgrounds flip to white, text stays `thBull` (which is itself dark on these themes), border uses `thBull` at 40% transparency.
This guarantees text legibility against every palette without per-theme manual tuning.
**Position & Size**
Six anchor slots (Top/Middle/Bottom × Left/Right) and four text sizes (Tiny / Small / Normal / Large).
🟦 COLOR THEMES
Twelve cohesive palettes, each resolving to four axis colors:
| Theme | Character | Bull | Bear |
|---|---|---|---|
| Tropic | Cyan steel + deep orange | #00bcd4 | #ff6d00 |
| Amber | Warm amber + indigo blue | #ff9800 | #e53935 |
| Pastel | Sky blue + soft lavender | #4fc3f7 | #9575cd |
| Cyber | Neon lime + hot crimson | #00e676 | #ff1744 |
| Helios | Bright gold + scarlet | #ffd600 | #ef5350 |
| Electric | Electric aqua + magenta | #00e5ff | #e040fb |
| Candy | Neon green + hot pink | #69F0AE | #FF4081 |
| Bloomberg | Terminal orange + cyan | #ff8c00 | #00b0ff |
| Solar | Solarized olive + crimson | #859900 | #dc322f |
| Royal | Imperial gold + deep purple | #ffd700 | #6a0dad |
| Midnight | Deep navy + dark crimson | #0d47a1 | #b71c1c |
| Graphite | Near-black + silver grey | #1a1a1a | #757575 |
All four color roles (bull / bear / neutral / signal) change simultaneously when the theme changes. The whole script reads through these four variables — nothing below the resolver references a raw hex literal, so a single dropdown selection drives every plot, fill, dot, divergence line, dashboard cell and border.
🟦 ALERT SYSTEM
Ten alert conditions, all using `alert.freq_once_per_bar_close`:
| Alert | Condition |
|---|---|
| OS Reversion | Wave crossed UP through signal while wave < −T |
| OB Reversion | Wave crossed DOWN through signal while wave > +T |
| Regular Divergence | D▲ or D▼ detected (respects Smart Filter) |
| Hidden Divergence | H▲ or H▼ detected (respects Smart Filter) |
| Bullish Trend | Wave crossed above the midline (zero) |
| Bearish Trend | Wave crossed below the midline (zero) |
| Bullish Swing | Wave × signal upward cross, regardless of zone |
| Bearish Swing | Wave × signal downward cross, regardless of zone |
Each alert fires through `alert()` so the message body carries live context — direction, current wave value, and the threshold that triggered. Divergence alerts respect the Smart Divergence Filter — if the filter is ON and a divergence is rejected visually, the alert will also not fire.
🟦 SETTINGS REFERENCE
**WaveTrend Core**
- Source — 9 price aggregates. Default: HLC3
- Channel Length — EMA midline + Welford stdev lookback. Default: 10
- Average Length — EMA smoothing of the normalized wave. Default: 21
- Signal Length — SMA smoothing of the wave to build the trigger. Default: 4
**Reversion Bands**
- Reversion Threshold — 50–200, step 5. Default: 100
- Show Band Fills — Toggle. Default: ON
- Band Opacity — 0–100. Default: 30
**Histogram**
- Show Histogram — Toggle. Default: ON
- Rising Opacity — Default: 60
- Fading Opacity — Default: 40
**Extremity Dots**
- Show Extremity Dots — Toggle. Default: ON
**Divergence**
- Regular Divergence — Toggle. Default: ON
- Regular Opacity — Default: 80
- Hidden Divergence — Toggle. Default: ON
- Hidden Opacity — Default: 80
- Label Size — Tiny / Small / Normal / Large. Default: Tiny
- Smart Divergence Filter (AI) — Master toggle. Default: OFF
- Min Wave Swing — Default: 5.0
- Min Price Swing (%) — Default: 0.3%
- Require Zone Confirmation — Default: ON
**Bar Coloring**
- Bar Color Mode — None / Midline Cross / Extremities / Reversions / Slope. Default: None
**Dashboard**
- Show Dashboard — Toggle. Default: ON
- Panel Position — 6 anchor slots. Default: Middle Right
- Panel Text Size — Tiny / Small / Normal / Large. Default: Small
**Alerts**
- OS Reversion — Default: ON
- OB Reversion — Default: ON
- Regular Divergence — Default: ON
- Hidden Divergence — Default: OFF
- Bullish Trend — Default: ON
- Bearish Trend — Default: ON
- Bullish Swing — Default: OFF
- Bearish Swing — Default: OFF
🟦 COMPATIBILITY
Works on all asset classes and all timeframes in TradingView Pine Script v6.
- Crypto: Spot, futures, perpetual contracts
- Forex: All pairs
- Equities: Stocks, ETFs, indices
- Commodities: Metals, energy, agriculture
- Timeframes: 1m through Monthly
The Welford running standard deviation normalizes the wave against its own dispersion, making the engine fully volatility-agnostic. The same default settings work on a 5-second BTC chart and a weekly index chart without retuning.
🟦 TECHNICAL NOTES
- Pine Script v6
- `max_lines_count = 500`, `max_labels_count = 500` (divergence drawings + extremity dot hover labels)
- No repainting — all values calculated on bar close. Pivot-based divergence results appear `Channel Length / 2` bars late by design
- WaveTrend engine intentionally mirrors EliCobra's original Enhanced WaveTrend formulation — the value added by Artemis Wave is in the Pine v6 idioms, the dynamic band scaling, the divergence engine, the Smart Filter, the theme system, and the dashboard, not in altering the well-tested core curve
- UDT fields declared without defaults to comply with Pine v6's compile-time-literal requirement; objects constructed via `Bar.new(...)` and `WaveReading.new(...)`
- `var int x = int(na)` pattern used for safe persistent integer state (pivot bar indices)
- Reversion-band anchors rendered as hidden `plot()`s rather than `hline()`s — `hline()` only accepts compile-time constants, but the band levels are series values driven by the user-tunable Reversion Threshold
- Extremity Dots use a dual-track rendering: `plot.style_circles` for the pixel-perfect visual, plus a parallel invisible `label.style_circle` carrying the hover tooltip (since `plot()` does not support the `tooltip` argument)
🟦 DISCLAIMER
This indicator is provided for educational and informational purposes only. It does not constitute financial advice. Past performance does not guarantee future results. Always conduct your own analysis and apply proper risk management.
Pine Script®指标






















