מעודכן

C-Power Oscillator

1 680
This script is an advanced momentum and volume-flow oscillator named the "C-Power Oscillator".
It is specifically designed to work collaboratively with the primary C-Power indicator by operating as a lower-panel confirmation tool. While the main indicator tracks price structures on the chart, this oscillator uses mathematical statistics and volume to measure the exact strength of buyers (demand) against sellers (supply) on a scale from 0 to 100%.

How the script functions:
1. Volume Spike FilterThe oscillator factors in trading volume but protects itself against anomalous volume anomalies (such as sudden news spikes) that could distort the reading. If the volume of the current candle exceeds the average volume of the analysis period by more than 3.5 times, it is artificially capped at that maximum allowed threshold.

2. Advanced Volatility Modeling (Garman-Klass)Instead of using a standard ATR (Average True Range), this script uses the sophisticated Garman-Klass volatility estimator. This model:
- Evaluates Open, High, Low, and Close prices simultaneously.
- Integrates a gap-adjustment feature to account for overnight or sharp price gaps.
- Provides a highly precise calculation of true market variance within the specified period.

3. Statistical Probability (Z-Score & Gaussian CDF)This is the core engine of the oscillator. The script measures the distance between the current close and the midpoint of the price action (calculated from the open and the previous close).
- It computes a Z-score by dividing this price imbalance by the Garman-Klass volatility.
- Using a built-in mathematical approximation of the Gaussian CDF (Cumulative Distribution Function), it translates the Z-score into a directional probability percentage. This determines whether a price move is statistically significant or just random market noise.

4. Volume/Power Split (Buy Percent Calculation)
- The calculated directional probability is multiplied by the filtered volume, creating distinct series for buyers (buyPowerSeries) and sellers (sellPowerSeries).
- The script sums these forces over the chosen analysis period (default: 10 bars) to calculate what percentage of total market power belongs to the buyers.
- A value of 50% represents perfect equilibrium. Values closer to 100% indicate absolute buyer dominance, while values near 0% indicate absolute seller dominance.

5. ALMA SmoothingTo prevent the indicator line from becoming too jagged and generating false whipsaws, the final percentage is smoothed using an ALMA (Arnaud Legoux Moving Average). ALMA uses a Gaussian distribution filter to eliminate noise and provide a clean line while maintaining minimal lag compared to traditional moving averages.

6. Noise Reduction (Deadzone) & VisualsThe script implements a Deadzone (neutral zone) around the 50% balance line (defaulting to a width of 5%, or 47.5% to 52.5%). If the market power fluctuates within this narrow band, the oscillator flattens the line to exactly 50.0, signaling a clear "no-trend / consolidation" state.

Visual Indicators On Your Panel:
- Line above 50%: The market is controlled by buyers (colored green), accompanied by a green background fill.
- Line below 50%: The market is controlled by sellers (colored red), accompanied by a red background fill.
- Overbought (default: 60) & Oversold (default: 40) Levels: When the line breaches these thresholds, it changes to a bright neon color (bright green or bright red), warning that the current market move is overextended.

Summary - acting as the perfect companion to the C-Power indicator, this oscillator removes the guesswork from volume analysis. By combining price location, statistical probability, and volume filtering, it provides a clean, lag-reduced confirmation of which side actually controls the order flow.

What exactly is the C-Power Oscillator? It’s essentially a "Money Flow Index on steroids"—one that relies not on the visual geometry of candlesticks, but on statistics and probability distribution.
הערות שחרור
Przebudowa kodu z dodaniem kilku dodatkowych modyfikacji zwiekszających dokładność szacowania Buy/Sell Power z wykorzystaniem tylko OHLCV świecy + dodatkowe zabezpieczenia dla dowolnego rynku i papierów wartościowych.
Zalecana minimalny interwał to 5 minut dla akcji, forex, surowce, krypto - na niższych interwałach (poniżej 3 minut) wskaźnik zachowuje ma za mało danych.
הערות שחרור
A divergence module (regular (Bear/Bull) and hidden (H-Bear/H-Bull)) has been added, and default parameters have been optimized for it.
הערות שחרור
A minor refinement has been made to the engine's operational weighting—see the explanation below.
The default 50% setting is the recommended balance.

How the Weight Slider Works in the Script
The slider acts as a smooth weight (a proportion blender) that lets you control where the indicator draws information about market direction and strength. You can think of it as a regulator of proportions between two different analytical perspectives:

0% (Pure Inter-bar Momentum): The indicator considers solely how the current price relatively compares to the reference point of the previous candle. It completely ignores the internal structure of the current bar.

100% (Pure Intra-bar Structure): The indicator relies entirely on how the current candle formed (its interior and body), rejecting the broader inter-bar dynamics.

Intermediate values (e.g., 50%): They create a hybrid—combining both perspectives in appropriate proportions (e.g., equally), resulting in a balanced signal that merges trend movement fluidity with the precise microstructure of individual sessions.

Why does this matter?
Thanks to this slider, you can easily adjust the oscillator's sensitivity to your trading style and the specific characteristics of the instrument:

If you notice the indicator generating too much noise on wicks, you can decrease the weight of the candle's interior.

If you trade assets with large gaps or want to quickly catch price rejections, you can increase this parameter.

The label size has been increased ;)

הערות שחרור
Several changes have been made to ensure that the Oscillator works correctly with the C-Power PRO indicator.

⚙️ What the Script Does
The script generates a hybrid momentum and volume-based oscillator bounded between 0% and 100%. By merging mathematical statistics, volatility models, and volume flow, it isolates the true net strength of buyers versus sellers. It aims to eliminate market noise during consolidations and automatically plots regular and hidden divergences directly onto the user interface.
📦 Module Breakdown
• Adaptive Volume Filtering: Stabilizes input data. It detects extreme, unnatural volume spikes (using standard deviations) and caps them to prevent single institutional blocks from distorting the overall analysis.
• GKYZ Volatility Core: Measures market uncertainty. It calculates a hybrid variance by combining overnight price gaps with intraday price distributions (utilizing Garman-Klass and Rogers-Satchell equations).
• Efficiency & Fisher Scaling: Evaluates trend cleanliness. Using Kaufman’s Efficiency Ratio and a hyperbolic tangent function, it dynamically adjusts the weight of the price data based on whether the market is moving efficiently or randomly.
• Mahalanobis 2D Covariance Adjustment: Exposes institutional behavior. It measures the relationship between volume and candle spreads to spot anomalies like "high volume with zero price progress" (effort vs. result), adjusting the oscillator to expose hidden accumulation or distribution.
• Power Aggregation & ALMA Smoothing: Determines the final output. It blends the adjusted volume with a normal distribution probability curve to separate Buying and Selling power. This profile is smoothed using an Arnaud Legoux Moving Average (ALMA) for a clean, responsive line.
• Neutral Deadzone Logic: Filters choppy markets. It creates a customizable buffer zone around the 50% equilibrium line. When market forces are completely flat, the line snaps directly to 50.0 to prevent choppy, false signals.
• Divergence Engine: Automates pattern recognition. It continuously scans structural pivot points to compare price action against the oscillator line, mapping four distinct types of regular and hidden divergences across both panels.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.