OPEN-SOURCE SCRIPT
Annual Lump Sum: Yearly & Compounded

Annual Lump Sum Investment Analyzer (Yearly vs. Compounded)
Overview
This Pine Script indicator simulates a disciplined "Lump Sum" investing strategy. It calculates the performance of buying a fixed dollar amount (e.g., $10,000) on the very first trading day of every year and holding it indefinitely.
Unlike standard backtesters that only show a total percentage, this tool breaks down performance by "Vintage" (the year of purchase), allowing you to see which specific years contributed most to your wealth.
Key Features
Automated Execution: Automatically detects the first trading bar of every new year to simulate a buy.
Dual-Yield Analysis: The table provides two distinct ways to view returns:
Yearly %: How the market performed specifically during that calendar year (Jan 1 to Dec 31).
Compounded %: The total return of that specific year's investment from the moment it was bought until today.
Live Updates: For the current year, the "End Price" and "Yields" update in real-time with market movements.
Portfolio Summary: Displays your Total Invested Capital vs. Total Current Value at the top of the table.
Table Column Breakdown
The dashboard in the bottom-right corner displays the following:
Year: The vintage year of the investment.
Buy Price: The price of the asset on the first trading day of that year.
End Price: The price on the last trading day of that year (or the current price if the year is still active).
Yearly %: The isolated performance of that specific calendar year. (Green = The market ended the year higher than it started).
Compounded %: The "Diamond Hands" return. This shows how much that specific $10,000 tranche is up (or down) right now relative to the current price.
How to Use
Add the script to your chart.
Crucial: Set your chart timeframe to Daily (D). This ensures the script correctly identifies the first trading day of the year.
Open the Settings (Inputs) to adjust:
Annual Investment Amount: Default is $10,000.
Table Size: Adjust text size (Tiny, Small, Normal, Large).
Max Rows: Limit how many historical years are shown to keep the chart clean.
Use Case
This tool is perfect for investors who want to visualize the power of long-term holding. It allows you to see that even if a specific year had a bad "Yearly Yield" (e.g., buying in 2008), the "Compounded Yield" might still be massive today due to time in the market.
Overview
This Pine Script indicator simulates a disciplined "Lump Sum" investing strategy. It calculates the performance of buying a fixed dollar amount (e.g., $10,000) on the very first trading day of every year and holding it indefinitely.
Unlike standard backtesters that only show a total percentage, this tool breaks down performance by "Vintage" (the year of purchase), allowing you to see which specific years contributed most to your wealth.
Key Features
Automated Execution: Automatically detects the first trading bar of every new year to simulate a buy.
Dual-Yield Analysis: The table provides two distinct ways to view returns:
Yearly %: How the market performed specifically during that calendar year (Jan 1 to Dec 31).
Compounded %: The total return of that specific year's investment from the moment it was bought until today.
Live Updates: For the current year, the "End Price" and "Yields" update in real-time with market movements.
Portfolio Summary: Displays your Total Invested Capital vs. Total Current Value at the top of the table.
Table Column Breakdown
The dashboard in the bottom-right corner displays the following:
Year: The vintage year of the investment.
Buy Price: The price of the asset on the first trading day of that year.
End Price: The price on the last trading day of that year (or the current price if the year is still active).
Yearly %: The isolated performance of that specific calendar year. (Green = The market ended the year higher than it started).
Compounded %: The "Diamond Hands" return. This shows how much that specific $10,000 tranche is up (or down) right now relative to the current price.
How to Use
Add the script to your chart.
Crucial: Set your chart timeframe to Daily (D). This ensures the script correctly identifies the first trading day of the year.
Open the Settings (Inputs) to adjust:
Annual Investment Amount: Default is $10,000.
Table Size: Adjust text size (Tiny, Small, Normal, Large).
Max Rows: Limit how many historical years are shown to keep the chart clean.
Use Case
This tool is perfect for investors who want to visualize the power of long-term holding. It allows you to see that even if a specific year had a bad "Yearly Yield" (e.g., buying in 2008), the "Compounded Yield" might still be massive today due to time in the market.
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.