OPEN-SOURCE SCRIPT
已更新

Momentum Variance Oscillator

642
What MVO measures:

-PV (Price-Volume) Oscillator – how far price is from a volatility-scaled basis, then weighted by relative volume.
- > 0 = bullish pressure; < 0 = bearish pressure.
-|PV| larger ⇒ stronger momentum.
-Signal line (EMA of PV) – a smoother track of PV; crossings flag momentum shifts.
-Zero line gradient – instantly shows direction (greenish bull / reddish bear) and strength (paler → stronger).
-Extreme bands (±obLevel) – “hot zone” thresholds; being beyond them = exceptional push.
-Variance histogram – MACD-like view (PV minus slower PV-EMA) to see thrust building vs. fading.
-(Optional) Bar coloring & background tint – paints price bars and/or the panel on key events so you can read the regime at a glance.
-Auto-Tune – searches a grid of (obLevel, weakLvl) pairs and (optionally) auto-applies the best, ranked by CAGR vs. drawdown.


Core signals & how to trade them:

1) Define the regime:

-Bullish regime: PV above 0 and/or PV above Signal; zero line is in bull gradient.
-Bearish regime: PV below 0 and/or PV below Signal; zero line is in bear gradient.
-Action: Prefer trades with the regime (avoid fading strong color/strength unless you have a clear reversal setup).

2) Entries:

Momentum entry:
-Long: PV crosses above Signal while PV > 0.
-Short: PV crosses below Signal while PV < 0.

Breakout/acceleration:
-Long add-on: PV crosses above +obLevel (extreme top) and holds.
-Short add-on: PV crosses below −obLevel (extreme bottom) and holds.
-Histogram confirm: Growing bars in your direction = thrust improving; shrinking/flip = thrust stalling.

3) Exits / risk:

-Soft exit / tighten stops: PV loses the extreme and re-enters inside, or histogram fades/turns against you.
-Hard exit / reverse: Opposite PV↔Signal crossover and PV crosses the zero line.
-Weak zone filter: If |PV| < weakLvl, treat signals as lower quality (smaller size or skip).

4) Practical setup - Suggested defaults (good starting point):

-Signal length: 26
-Volume power: 0.50
-obLevel (extreme): 2.00
-weakLvl: 0.75
-Show histogram & dots: On
-Auto-Tune (recommended)
-Turn Auto-Select Best ON. MVO will scan obLevel 1.50→3.00 (step 0.05) and weakLvl 0.50→1.00 (step 0.05), then use the top-ranked pair (CAGR/(1+MDD)).
-If you want to see the top combos, enable the Optimizer Table (Top-3).

5) Visual options

-Bar Colors: Regime+Strength – bars follow the zero-line gradient (great for quick read).
-Extremes – paint only when beyond ±obLevel.
-Cross Signals – paint only on the bar that crosses an extreme.
-Background on breach: A one-bar tint when PV crosses an extreme.

6) Example playbook:

Long setup:
-Zero line shows bull gradient and PV > 0.
-PV crosses above Signal (entry).
-If PV drives above +obLevel, consider add-on; trail under the last minor swing or use ATR.
-Exit/trim on PV crossing below Signal or histogram turning negative; flatten on a drop through 0.

Short setup mirrors the above on the bear side.

7) Tips to avoid common traps:

-Don’t fade strong extremes without clear confirmation (e.g., PV re-entering inside + histogram flip).
-Respect the weak zone: if |PV| < weakLvl, signals are fragile—size down or wait.
-Align with structure: higher-timeframe trend and SR improve expectancy.
-Instrument personality matters: use Auto-Tune or re-calibrate obLevel/weakLvl across assets/timeframes.

8) Alerts you can set:

-Bull Signal X – PV crossed above Signal
-Bear Signal X – PV crossed below Signal
-Bull Baseline X – PV crossed above 0
-Bear Baseline X – PV crossed below 0
版本注释
-Volatility-adaptive bands: Added an ATR ratio scaler for the deviation multiplier (toggle + fast/slow ATR lengths with min/max clamp) so bands auto-adjust to volatility.
-Cleaner settings: Reorganized inputs into clear sections (Core, Bands & Volatility, Extremes & View, Colors, Bar Colors, Optimizer, Table Colors).
-Default tweaks: Background-on-breach transparency set to 60; extreme-line base opacity set to 40%.
-Color refresh: Updated default strong bull/bear colors (brighter green/red) and mid tones.
-Extreme line behavior: Lines are semi-opaque by default; they become fully opaque and adopt bear strong above +extreme and bull strong below −extreme.
-PV styling at extremes: PV line & dots auto-switch to bear strong above +extreme and bull strong below −extreme.
-bar coloring: Kept as a toggle with three modes (Regime+Strength, Cross Signals, Extremes), full opacity control, and extra dimming when momentum is weak.
-Optimizer unchanged: Auto-tune still selects the Top-1 **obLevel/weakLvl** pair; table shows Top-3 when enabled (same grid and scoring).
-Stability hygiene: FRAMA-adapted base window and safety clamps retained for consistent calculations.
版本注释
Tuned defaults: e.g., lenBase 64→50, sigLen 21→26 (now 21), multBand 2.20→2.0 (now 2.20), ATR 10/30, volPower 0.60, obLevel 2.10, weakLvl 0.80.

New signal-line modes: EMA, ER-EMA, FRAMA-EMA, LR projection, and Hybrid (selectable).

Added full Exhaustion engine (RSI-14 + Aroon “drives”) with base/extreme logic and background shading using bull/bear strong colors.

Added Exhaustion rails: current TF + Daily, Weekly, Monthly rails, stacked with configurable spacing & microgaps and adjustable line width; HTF rails shown only when chart TF is below that HTF.

Added strict Squeeze detector (compression & ATR ratio; absolute/percentile modes), min bars before release, release lookback, and a ribbon that turns gold on release.

Introduced filters/gates for entries (optional): exhaustion requirement, slope-alignment (normalized), and post-squeeze-release gating.

Expanded alerts with per-signal toggles and detailed messages: raw/confirmed PV×Signal, zero crosses, extreme rail breaches, exhaustion base/extreme, squeeze enter/exit/release, slope crosses.

Bar colors now reflect exhaustion severity (base vs extreme) on top of regime/strength.

Fixed crossover consistency by precomputing cross booleans used in expressions.

Optimizer table removed (kept internal auto-tuning of obLevel/weakLvl).

UI reorganized into new groups (Squeeze, Signal Line, Exhaustion Filter, Alerts, Rails/Spacing).

Removed old breach background shading; replaced by exhaustion-based backgrounds.

Minor: PV dots default off; general code cleanup and robustness.
版本注释
Volume context (new):

-RVOL z-score (volZ) — participation vs. adaptive average; use >0 for confirmation, >+1.5 for strong follow-through.
-OBV slope (normalized, obvSlopeN) — directional volume flow; >0 favors longs, <0 favors shorts.
-Both are computed efficiently and designed to be used as optional gates/overlays without adding plot clutter.


Signal core improvements:

-Warm-up/edge handling tidied to reduce early-bar artifacts.


Exhaustion rails & visuals:

-Monthly rails only show on Daily/Weekly/Monthly timeframes (not intraday).
-Default spacing tweaks: micro-gap = 0.075, rail width = 5 for clearer stack separation.
-Squeeze ribbon retained; release highlighted in gold.


Alerts & coloring:
-Alert toggles consolidated and restored; single-line bar-color expression (no line breaks).
-No extra dots/plots—keeps the pane clean.


Performance/UX:

-Keeps request count unchanged; volume features are local and lightweight.
-Clear parameter knobs: volPower (PV weighting), plus new volZ/obvSlopeN signals for discretionary gating.
版本注释
What’s new is the learning (adaptive RSI), the stickier momentum colors, and the exhaustion-aware fading—so visuals better reflect trend persistence vs. exhaustion risk.

Exhaustion is now adaptive (RSI-based):

-The RSI thresholds that define Top/Bottom and Extreme exhaustion learn from recent pivot highs/lows instead of being fixed numbers.
-We sample RSI at confirmed pivots (with your 10/10 L/R setting) and set dynamic levels from chosen percentiles (e.g., PH 80/90, PL 20/10).
-Thresholds are clamped to sane ranges so they don’t get unrealistic during odd regimes.
-The Aroon “drive” counter still requires persistence (>=5) so single spikes don’t trigger exhaustion.

Exhaustion visuals follow the adaptive levels:

-The background overlays (“Exhaustion High/Low Base/Extreme”) now fire off those learned RSI levels.
-Rail lines (current TF + Daily/Weekly/Monthly) also reference the adaptive thresholds; extreme rails use the gradient, base rails stay gray.
-Same spacing, micro-gap, widths, and colors as before—only the logic moved from fixed to learned levels.

Zero-line color = momentum-persistence, faded by exhaustion:

-Bright green/red on the zero line no longer depends only on |PV| vs Ob.
-It now builds “momentum score” when PV, Signal, and Histogram all stay on the same side of zero for multiple bars (stickier color during trends).
-Exhaustion dampening gradually desaturates colors as top/bottom (base/extreme) signals stack up.
-A small slope assist nudges color stronger when PV slope supports the regime; fades if slope disagrees.

Bar colors respect the same momentum + exhaustion logic:

-Bars use the same regime score (momentum persistence + slope assist – exhaustion dampening), so bright green/red lasts longer in persistent trends and fades faster into purple/yellow near exhaustion.
-Bars dim extra when abs(PV) < weakLvl (noisy/weak momentum).
-You can still switch modes (Regime+Strength / Cross Signals / Extremes); palettes and transparency controls are unchanged.

Signal-line display tweak:

-When FRAMA-EMA is selected, the Signal line is hidden (it shadows PV too closely in this mode). Other signal modes plot as before.

Histogram behavior:

-Computation unchanged, but it now contributes to the persistence score (counts toward “all on same side of zero” agreement).

Squeeze defaults made stricter:

-Same logic (Absolute/Percentile + min bars + release window), but default min bars/release lookback are higher (10 vs 3 in the original) to reduce false starts. You can dial them back if you prefer earlier tells.

Live “confirmed” gates remain, now powered by the adaptive exhaustion:

-Confirmed cross/zero alerts still require slope & (optionally) post-squeeze release; exhaustion checks now use the adaptive thresholds.

Optimizer unchanged:

-Auto-tunes Ob/Weak from the Top-1 combo behind the scenes. No changes to its rules or outputs.

Volume context unchanged (cleaned under the hood):

-OBV/VPT/CMF z-scores are the same; internally uses math.sum where applicable. The VolContext score is still included in alerts.

Same look, smarter logic:

-All colors, names, and plot styles are the same as the original.

快照

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。