OPEN-SOURCE SCRIPT

Heikin-Ashi Rolling Time Decay Volume Oscillator

Telah dikemas kini
The indicator calculates a time-decayed moving sum of volume data for both bullish (green) and bearish (red) candles. It then generates a volume share oscillator as a smoothed and weighted (time-decayed) moving sum of bullish volume (positive share) or bearish volume (negative share) relative to the total volume.

The volume share is displayed as an area chart with gradient fills representing overbought and oversold regions. Additionally, an Arnaud Legoux Moving Average (ALMA) of the volume oscillator is plotted on the chart.

Trend Momentum and Price Control:
This indicator serves as a powerful tool for traders to gauge trend momentum and identify which side, bulls or bears, is controlling price movements. When the volume oscillator trends strongly in the green territory, it suggests that bulls are in control of price movements, indicating a potential uptrend. Conversely, when the oscillator tilts into the red, it indicates bearish dominance and a potential downtrend. With the incorporation of ALMA for smoothing, this indicator becomes an essential tool for traders and analysts navigating the dynamics of traded assets.

Source Candles:
This indicator is designed to work with Heiken Ashi or Japanese candlesticks to discern candle bias, whether it's red or green. Heiken Ashi tends to produce red candles during downtrends and green candles during uptrends, providing a clearer trend indication. In contrast, traditional candlesticks alternate colors regardless of the dominant price direction. Users can select between "Heikin-Ashi Candles" and regular "Japanese Candles" as the source for price direction."

A time decay cumulative sum, also known as a weighted moving sum or exponentially weighted moving sum, offers several advantages when it comes to determining market dynamics compared to other methods:

  • Responsive to Recent Data: Time decay cumulative sum gives more weight to recent data points and gradually reduces the impact of older data. This responsiveness is crucial in rapidly changing market conditions where recent price and volume information is more relevant for analysis.
  • Adaptive to Market Volatility: It adapts to changes in market volatility. When markets are highly volatile, it places more emphasis on recent data to reflect the current market environment accurately. Conversely, during calmer periods, it considers older data less important.
  • Effective for Identifying Turning Points: Time decay cumulative sums are particularly effective at identifying turning points in market dynamics. They can indicate shifts from bullish to bearish sentiment and vice versa, providing early signals of potential trend reversals.
  • Reduces Lag: Traditional cumulative sums or simple moving averages can lag behind actual market changes, making them less effective for real-time decision-making. Time decay cumulative sums reduce this lag by giving more weight to recent events.
  • Dynamic Weighting: The weighting scheme can be adjusted to fit specific market dynamics or trading strategies. Traders can customize the decay rate or smoothing factor to align with their analysis goals and timeframes.
  • Improved Signal Clarity: The time decay cumulative sum can provide clearer and more precise signals for overbought and oversold conditions, as well as trend strength, due to its ability to emphasize recent relevant data.


In summary, a time decay cumulative sum is a valuable tool in determining market dynamics because it adapts to changing market conditions, reduces noise, and provides timely and accurate insights into trends, turning points, and the relative strength of bullish and bearish forces. Its responsiveness and adaptability make it an essential component of many technical analysis and trading strategies.
Nota Keluaran
removed Arnaud Legoux Moving Average from indicator
Nota Keluaran
Code refactor
Nota Keluaran
Code refactor
Nota Keluaran
Incorporated an indicator description as comments within the code to provide better context and understanding
Nota Keluaran
Change Log
  • Function Addition: Added the decayedVolumes function to compute decayed green and red volumes based on historical close and open prices, enhancing the volume analysis by including decay factors in the computation.
  • Code Modularization: Refactored the volume calculation logic into a separate function (decayedVolumes), simplifying the main code block and improving readability and maintainability.
  • Function Integration: Integrated the decayedVolumes function directly into the main indicator calculation, replacing the previously inline computation for red and green volume sums. This change modularizes the volume calculation, centralizing adjustments to decay logic in one function.
Nota Keluaran
Added the heikinAshiValues function to compute Heikin-Ashi candle values, aiding in trend identification and smoothing out price data. This function returns a tuple with Heikin-Ashi close, open, high, and low values.
Nota Keluaran
Change Log:

  1. Decay Method Setting Added: A new setting for selecting the decay method has been introduced. Users can now choose from "No Decay," "Linear Decay Weighting," or "Quadratic Decay Weighting." This change allows for more flexible volume calculations based on user preferences.
  2. Updated Parameter in decayedVolumes Function: The function now accepts an additional parameter, decayMethod, which allows the selection of the decay method at runtime. This parameter controls whether no decay, linear, or quadratic weighting is applied.
OscillatorstimedecayTrend AnalysisvolumeanalysisVolume

Skrip sumber terbuka

Dalam semangat sebenar TradingView, penulis telah menerbitkan kod Pine ini sebagai sumber terbuka supaya pedagang dapat memahami dan mengesahkannya. Sorakan kepada penulis! Anda boleh menggunakan perpustakaan ini secara percuma, tetapi penggunaan semula kod dalam penerbitan ini adalah dikawal oleh Peraturan dalaman. Anda boleh menyukainya untuk menggunakannya pada carta.

Ingin menggunakan skrip ini pada carta?


Juga pada:

Penafian