OPEN-SOURCE SCRIPT
Anchor-Point Average

Anchor-Point Average (APA) - Pine Script Indicator
Overview
The Anchor-Point Average (APA) is a unique technical indicator that calculates the average price from a user-defined starting point to the present. Unlike traditional Simple Moving Averages (SMA) that use a rolling window of fixed periods, APA uses a fixed anchor point in time, creating a cumulative average that grows with each new bar.
Key Features
Interactive Time Selection
Click-to-Select: Simply click on any bar in the chart to set your anchor point
Visual Markers: Clear labels show the start point with date/time and current average price
Flexible Analysis: Anchor to any significant event, price level, or time period
Multiple Price Types
Choose from 7 different price calculations:
Close: Standard closing price
Open: Opening price for gap analysis
High/Low: Track resistance and support levels
HL2: Midpoint price (High + Low) / 2
HLC3: Typical price (High + Low + Close) / 3
OHLC4: Average price (Open + High + Low + Close) / 4
Customizable Display
Color Settings: Customize both anchor point and current label colors
Clean Interface: Minimalist design with essential information only
Professional Labels: Display average price, sample count, and timestamps
Smart Alerts
Cross Above Alert: Notifies when price crosses above the anchor-point average
Cross Below Alert: Notifies when price drops below the anchor-point average
Visual Markers: Green triangles (bullish cross) and red triangles (bearish cross)
Why Anchor-Point Average?
Different from Traditional SMA
Traditional moving averages use a rolling window (e.g., last 20 bars), which means older data constantly drops out. APA maintains all data from your chosen anchor point, providing a true cumulative average that represents the mean price since that specific moment.
Use Cases
Long-Term Investment Analysis
Calculate average entry cost from your first purchase date
Track performance against your initial investment timing
Identify if current price is above or below your historical average
Event-Based Analysis
Anchor to product launches, earnings reports, or policy announcements
Measure price behavior after significant market events
Compare current price to post-event average levels
Support/Resistance Identification
The anchor-point average often acts as dynamic support or resistance
As more data accumulates, the line becomes increasingly stable
Price reactions to this level can signal trend continuation or reversal
Volatility Assessment
Increasing distance from anchor average indicates growing volatility
Convergence suggests consolidation or equilibrium
Track how current price deviates from long-term mean
Technical Advantages
Stability Over Time
As the sample size grows, the anchor-point average becomes progressively smoother and less sensitive to short-term volatility, providing a robust reference level.
Historical Context
Unlike moving averages that "forget" old data, APA preserves the entire price history from your chosen point, offering complete context for your analysis.
Psychological Significance
Often traders anchor mentally to specific dates or events. This indicator makes that psychological level visible and quantifiable.
How to Use
Add to Chart: Apply the indicator to any TradingView chart
Select Anchor Point: Click on the bar where you want to begin calculation
Choose Price Type: Select which price component to average (default: Close)
Customize Colors: Adjust label colors to match your chart theme
Set Alerts: Create alerts for price crossovers to stay informed
Perfect For
Long-term investors tracking cost basis
Swing traders analyzing from key pivot points
Event-driven traders measuring post-announcement trends
Anyone seeking a stable, cumulative price reference
Technical Notes
Built on Pine Script v5
Overlay indicator (plots directly on price chart)
Real-time calculation with bar-by-bar updates
Supports all timeframes and instruments
Zero repainting - calculations are final once bar closes
Overview
The Anchor-Point Average (APA) is a unique technical indicator that calculates the average price from a user-defined starting point to the present. Unlike traditional Simple Moving Averages (SMA) that use a rolling window of fixed periods, APA uses a fixed anchor point in time, creating a cumulative average that grows with each new bar.
Key Features
Interactive Time Selection
Click-to-Select: Simply click on any bar in the chart to set your anchor point
Visual Markers: Clear labels show the start point with date/time and current average price
Flexible Analysis: Anchor to any significant event, price level, or time period
Multiple Price Types
Choose from 7 different price calculations:
Close: Standard closing price
Open: Opening price for gap analysis
High/Low: Track resistance and support levels
HL2: Midpoint price (High + Low) / 2
HLC3: Typical price (High + Low + Close) / 3
OHLC4: Average price (Open + High + Low + Close) / 4
Customizable Display
Color Settings: Customize both anchor point and current label colors
Clean Interface: Minimalist design with essential information only
Professional Labels: Display average price, sample count, and timestamps
Smart Alerts
Cross Above Alert: Notifies when price crosses above the anchor-point average
Cross Below Alert: Notifies when price drops below the anchor-point average
Visual Markers: Green triangles (bullish cross) and red triangles (bearish cross)
Why Anchor-Point Average?
Different from Traditional SMA
Traditional moving averages use a rolling window (e.g., last 20 bars), which means older data constantly drops out. APA maintains all data from your chosen anchor point, providing a true cumulative average that represents the mean price since that specific moment.
Use Cases
Long-Term Investment Analysis
Calculate average entry cost from your first purchase date
Track performance against your initial investment timing
Identify if current price is above or below your historical average
Event-Based Analysis
Anchor to product launches, earnings reports, or policy announcements
Measure price behavior after significant market events
Compare current price to post-event average levels
Support/Resistance Identification
The anchor-point average often acts as dynamic support or resistance
As more data accumulates, the line becomes increasingly stable
Price reactions to this level can signal trend continuation or reversal
Volatility Assessment
Increasing distance from anchor average indicates growing volatility
Convergence suggests consolidation or equilibrium
Track how current price deviates from long-term mean
Technical Advantages
Stability Over Time
As the sample size grows, the anchor-point average becomes progressively smoother and less sensitive to short-term volatility, providing a robust reference level.
Historical Context
Unlike moving averages that "forget" old data, APA preserves the entire price history from your chosen point, offering complete context for your analysis.
Psychological Significance
Often traders anchor mentally to specific dates or events. This indicator makes that psychological level visible and quantifiable.
How to Use
Add to Chart: Apply the indicator to any TradingView chart
Select Anchor Point: Click on the bar where you want to begin calculation
Choose Price Type: Select which price component to average (default: Close)
Customize Colors: Adjust label colors to match your chart theme
Set Alerts: Create alerts for price crossovers to stay informed
Perfect For
Long-term investors tracking cost basis
Swing traders analyzing from key pivot points
Event-driven traders measuring post-announcement trends
Anyone seeking a stable, cumulative price reference
Technical Notes
Built on Pine Script v5
Overlay indicator (plots directly on price chart)
Real-time calculation with bar-by-bar updates
Supports all timeframes and instruments
Zero repainting - calculations are final once bar closes
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、このスクリプトの作者はコードをオープンソースとして公開してくれました。トレーダーが内容を確認・検証できるようにという配慮です。作者に拍手を送りましょう!無料で利用できますが、コードの再公開はハウスルールに従う必要があります。
免責事項
この情報および投稿は、TradingViewが提供または推奨する金融、投資、トレード、その他のアドバイスや推奨を意図するものではなく、それらを構成するものでもありません。詳細は利用規約をご覧ください。