OPEN-SOURCE SCRIPT
Yearly Performance Table with CAGR

Overview
This Pine Script indicator provides a clear table displaying the annual performance of an asset, along with two different average metrics: the arithmetic mean and the geometric mean (CAGR).
Core Features
Annual Performance Calculation:
Automatically detects the first trading day of each calendar year.
Calculates the percentage return for each full calendar year.
Based on closing prices from the first to the last trading day of the respective year.
Flexible Display:
Adjustable Period: Displays data for 1-50 years (default: 10 years).
Daily Timeframe Only: Functions exclusively on daily charts.
Automatic Update: Always shows the latest available years.
Two Average Metrics:
AVG (Arithmetic Mean)
A simple average of all annual returns. (Formula: (R₁ + R₂ + ... + Rₙ) ÷ n)
Important: Can be misleading in the presence of volatile returns.
GEO (Geometric Mean / CAGR)
Compound Annual Growth Rate. (Formula: [(1+R₁) × (1+R₂) × ... × (1+Rₙ)]^(1/n) - 1)
Represents the true average annual growth rate.
Fully accounts for the compounding effect.
Limitations
Daily Charts Only: Does not work on intraday or weekly/monthly timeframes.
Calendar Year Basis: Calculations are based on calendar years, not rolling 12-month periods.
Historical Data: Dependent on the availability of historical data from the broker/data provider.
Interpretation of Results
CAGR as Benchmark: The geometric mean is more suitable for performance comparisons.
Annual Patterns: Individual year figures can reveal seasonal or cyclical trends.
This Pine Script indicator provides a clear table displaying the annual performance of an asset, along with two different average metrics: the arithmetic mean and the geometric mean (CAGR).
Core Features
Annual Performance Calculation:
Automatically detects the first trading day of each calendar year.
Calculates the percentage return for each full calendar year.
Based on closing prices from the first to the last trading day of the respective year.
Flexible Display:
Adjustable Period: Displays data for 1-50 years (default: 10 years).
Daily Timeframe Only: Functions exclusively on daily charts.
Automatic Update: Always shows the latest available years.
Two Average Metrics:
AVG (Arithmetic Mean)
A simple average of all annual returns. (Formula: (R₁ + R₂ + ... + Rₙ) ÷ n)
Important: Can be misleading in the presence of volatile returns.
GEO (Geometric Mean / CAGR)
Compound Annual Growth Rate. (Formula: [(1+R₁) × (1+R₂) × ... × (1+Rₙ)]^(1/n) - 1)
Represents the true average annual growth rate.
Fully accounts for the compounding effect.
Limitations
Daily Charts Only: Does not work on intraday or weekly/monthly timeframes.
Calendar Year Basis: Calculations are based on calendar years, not rolling 12-month periods.
Historical Data: Dependent on the availability of historical data from the broker/data provider.
Interpretation of Results
CAGR as Benchmark: The geometric mean is more suitable for performance comparisons.
Annual Patterns: Individual year figures can reveal seasonal or cyclical trends.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。