OPEN-SOURCE SCRIPT
Anchored Cumulative Average

Anchored Cumulative Price Average
Overview
The Anchored Cumulative Price Average plots the arithmetic mean of price values calculated from a user-defined start date and time.
Instead of using a fixed lookback length, the average continuously incorporates every completed candle since the anchor point, producing a stable reference level that evolves as new data becomes available.
The indicator supports custom source selection, optional higher-timeframe calculation, and an optional High / Low average mode, making it suitable for contextual market analysis across multiple time horizons.
How It Works
• A start date and time define the anchor point.
• From that moment forward, the script accumulates price values and divides them by the total number of candles included.
• The result is a cumulative (since-anchor) average, not a rolling moving average.
• When a higher timeframe is selected, calculations are performed only when a new HTF candle completes, ensuring consistent aggregation.
This approach creates an average that reflects the market’s mean price relative to a specific event, session, or structural point.
Inputs
• Calculation Timeframe
Choose the timeframe used for the calculation. Leaving this empty uses the chart timeframe.
• Start Date / Time
Defines the anchor point from which the average begins.
Source
Select the price input used for the average:
• Close, Open, High, Low
• HL2, HLC3, OHLC4
• High & Low (plots separate averages for highs and lows)
How to Use
• Anchor the indicator to a session open, swing point, news event, or structural shift.
• Observe how price interacts with the cumulative average as more data is added.
• Use the High & Low mode to visualize mean price boundaries instead of a single central line.
• Apply a higher timeframe to view broader contextual averages while remaining on a lower-timeframe chart.
Common Use Cases
• Contextual reference for mean price since a specific date or event
• Market structure and balance analysis
• Session-based or event-anchored price evaluation
• Multi-timeframe alignment and bias assessment
• Visual support tool alongside discretionary analysis
Notes
• This indicator does not predict price or generate trade signals.
• It is designed as a contextual analysis tool and should be used in conjunction with other forms of market analysis.
• The plotted values will change as new candles form after the anchor point.
Overview
The Anchored Cumulative Price Average plots the arithmetic mean of price values calculated from a user-defined start date and time.
Instead of using a fixed lookback length, the average continuously incorporates every completed candle since the anchor point, producing a stable reference level that evolves as new data becomes available.
The indicator supports custom source selection, optional higher-timeframe calculation, and an optional High / Low average mode, making it suitable for contextual market analysis across multiple time horizons.
How It Works
• A start date and time define the anchor point.
• From that moment forward, the script accumulates price values and divides them by the total number of candles included.
• The result is a cumulative (since-anchor) average, not a rolling moving average.
• When a higher timeframe is selected, calculations are performed only when a new HTF candle completes, ensuring consistent aggregation.
This approach creates an average that reflects the market’s mean price relative to a specific event, session, or structural point.
Inputs
• Calculation Timeframe
Choose the timeframe used for the calculation. Leaving this empty uses the chart timeframe.
• Start Date / Time
Defines the anchor point from which the average begins.
Source
Select the price input used for the average:
• Close, Open, High, Low
• HL2, HLC3, OHLC4
• High & Low (plots separate averages for highs and lows)
How to Use
• Anchor the indicator to a session open, swing point, news event, or structural shift.
• Observe how price interacts with the cumulative average as more data is added.
• Use the High & Low mode to visualize mean price boundaries instead of a single central line.
• Apply a higher timeframe to view broader contextual averages while remaining on a lower-timeframe chart.
Common Use Cases
• Contextual reference for mean price since a specific date or event
• Market structure and balance analysis
• Session-based or event-anchored price evaluation
• Multi-timeframe alignment and bias assessment
• Visual support tool alongside discretionary analysis
Notes
• This indicator does not predict price or generate trade signals.
• It is designed as a contextual analysis tool and should be used in conjunction with other forms of market analysis.
• The plotted values will change as new candles form after the anchor point.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.