OPEN-SOURCE SCRIPT
C-Power Oscillator

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.
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.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.