OPEN-SOURCE SCRIPT
已更新 DCA Investment Tracker Pro [tradeviZion]

DCA Investment Tracker Pro: Educational DCA Analysis Tool
An educational indicator that helps analyze Dollar-Cost Averaging strategies by comparing actual performance with historical data calculations.
---
💡 Why I Created This Indicator
As someone who practices Dollar-Cost Averaging, I was frustrated with constantly switching between spreadsheets, calculators, and charts just to understand how my investments were really performing. I wanted to see everything in one place - my actual performance, what I should expect based on historical data, and most importantly, visualize where my strategy could take me over the long term.
What really motivated me was watching friends and family underestimate the incredible power of consistent investing. When Napoleon Bonaparte first learned about compound interest, he reportedly exclaimed "I wonder it has not swallowed the world" - and he was right! Yet most people can't visualize how their $500 monthly contributions today could become substantial wealth decades later.
Traditional DCA tracking tools exist, but they share similar limitations:
I wanted to create something different - a tool that automatically analyzes real market history, detects volatility periods, and shows you both current performance AND educational projections based on historical patterns right on your TradingView charts. As Warren Buffett said: "Someone's sitting in the shade today because someone planted a tree a long time ago." This tool helps you visualize your financial tree growing over time.
This isn't just another calculator - it's a visualization tool that makes the magic of compound growth impossible to ignore.
---
🎯 What This Indicator Does
This educational indicator provides DCA analysis tools. Users can input investment scenarios to study:

---
🚀 Key Features
Volatility-Adjusted Historical Return Calculation
Customizable Performance Dashboard
Future Projection System
Investment Insights
---
📊 Step-by-Step Setup Guide
1. Investment Settings 💰
2. Display Settings 📊
3. Future Projection 🔮
Live Example -
META Analysis:

Settings shown: $60K initial + $500/month + Auto calculation + 10-year history + 2020 start + $150K current value
---
🔬 Pine Script Code Examples
Core DCA Calculations:
Pine Script®
Volatility Detection Logic:
Pine Script®
Performance Metrics:
Pine Script®
---
📊 Real-World Examples
See the indicator in action across different investment types:
Stable Index Investments:
SPY (SPDR S&P 500) - Shows steady compound growth with standard CAGR calculations

VUAA (Vanguard S&P 500 UCITS) - Shows both data limitation and solution approaches

VUAA (Vanguard S&P 500 UCITS) - European ETF with successful 5-year auto calculation

BRK.B (Berkshire Hathaway) - Quality value investment with Warren Buffett's proven track record
High-Volatility Growth Stocks:
NVDA (NVIDIA Corporation) - Demonstrates volatility-adjusted calculations for extreme price swings

TSLA (Tesla) - Shows how 10-year analysis can stabilize volatile tech stocks

META (Meta Platforms) - Shows stable tech stock analysis using standard CAGR calculations

Notice how the indicator automatically detects high-volatility periods and switches to median-based calculations for more conservative projections, while stable investments use standard CAGR methods.
---
📈 Performance Metrics Explained
---
⚠️ Important Notes & Limitations
---
📚 Educational Use & Disclaimer
This analysis tool can be applied to various stock and ETF charts for educational study of DCA mathematical concepts and historical performance patterns.
Study Examples: Can be used with symbols like
SPY,
QQQ,
VTI,
AAPL,
MSFT,
GOOGL,
AMZN,
TSLA,
NVDA for learning purposes.
---
© 2025 TradeVizion. All rights reserved.
An educational indicator that helps analyze Dollar-Cost Averaging strategies by comparing actual performance with historical data calculations.
---
💡 Why I Created This Indicator
As someone who practices Dollar-Cost Averaging, I was frustrated with constantly switching between spreadsheets, calculators, and charts just to understand how my investments were really performing. I wanted to see everything in one place - my actual performance, what I should expect based on historical data, and most importantly, visualize where my strategy could take me over the long term.
What really motivated me was watching friends and family underestimate the incredible power of consistent investing. When Napoleon Bonaparte first learned about compound interest, he reportedly exclaimed "I wonder it has not swallowed the world" - and he was right! Yet most people can't visualize how their $500 monthly contributions today could become substantial wealth decades later.
Traditional DCA tracking tools exist, but they share similar limitations:
- Require manual data entry and complex spreadsheets
- Use fixed assumptions that don't reflect real market behavior
- Can't show future projections overlaid on actual price charts
- Lose the visual context of what's happening in the market
- Make compound growth feel abstract rather than tangible
I wanted to create something different - a tool that automatically analyzes real market history, detects volatility periods, and shows you both current performance AND educational projections based on historical patterns right on your TradingView charts. As Warren Buffett said: "Someone's sitting in the shade today because someone planted a tree a long time ago." This tool helps you visualize your financial tree growing over time.
This isn't just another calculator - it's a visualization tool that makes the magic of compound growth impossible to ignore.
---
🎯 What This Indicator Does
This educational indicator provides DCA analysis tools. Users can input investment scenarios to study:
- Theoretical Performance: Educational calculations based on historical return data
- Comparative Analysis: Study differences between actual and theoretical scenarios
- Historical Projections: Theoretical projections for educational analysis (not predictions)
- Performance Metrics: CAGR, ROI, and other analytical metrics for study
- Historical Analysis: Calculates historical return data for reference purposes
---
🚀 Key Features
Volatility-Adjusted Historical Return Calculation
- Analyzes 3-20 years of actual price data for any symbol
- Automatically detects high-volatility stocks (meme stocks, growth stocks)
- Uses median returns for volatile stocks, standard CAGR for stable stocks
- Provides conservative estimates when extreme outlier years are detected
- Smart fallback to manual percentages when data insufficient
Customizable Performance Dashboard
- Educational DCA performance analysis with compound growth calculations
- Customizable table sizing (Tiny to Huge text options)
- 9 positioning options (Top/Middle/Bottom + Left/Center/Right)
- Theme-adaptive colors (automatically adjusts to dark/light mode)
- Multiple display layout options
Future Projection System
- Visual future growth projections
- Timeframe-aware calculations (Daily/Weekly/Monthly charts)
- 1-30 year projection options
- Shows projected portfolio value and total investment amounts
Investment Insights
- Performance vs benchmark comparison
- ROI from initial investment tracking
- Monthly average return analysis
- Investment milestone alerts (25%, 50%, 100% gains)
- Contribution tracking and next milestone indicators
---
📊 Step-by-Step Setup Guide
1. Investment Settings 💰
- Initial Investment: Enter your starting lump sum (e.g., $60,000)
- Monthly Contribution: Set your regular DCA amount (e.g., $500/month)
- Return Calculation: Choose "Auto (Stock History)" for real data or "Manual" for fixed %
- Historical Period: Select 3-20 years for auto calculations (default: 10 years)
- Start Year: When you began investing (e.g., 2020)
- Current Portfolio Value: Your actual portfolio worth today (e.g., $150,000)
2. Display Settings 📊
- Table Sizes: Choose from Tiny, Small, Normal, Large, or Huge
- Table Positions: 9 options - Top/Middle/Bottom + Left/Center/Right
- Visibility Toggles: Show/hide Main Table and Stats Table independently
3. Future Projection 🔮
- Enable Projections: Toggle on to see future growth visualization
- Projection Years: Set 1-30 years ahead for analysis
Live Example -
Settings shown: $60K initial + $500/month + Auto calculation + 10-year history + 2020 start + $150K current value
---
🔬 Pine Script Code Examples
Core DCA Calculations:
// Calculate total invested over time
months_elapsed = (year - start_year) * 12 + month - 1
total_invested = initial_investment + (monthly_contribution * months_elapsed)
// Compound growth formula for initial investment
theoretical_initial_growth = initial_investment * math.pow(1 + annual_return, years_elapsed)
// Future Value of Annuity for monthly contributions
monthly_rate = annual_return / 12
fv_contributions = monthly_contribution * ((math.pow(1 + monthly_rate, months_elapsed) - 1) / monthly_rate)
// Total expected value
theoretical_total = theoretical_initial_growth + fv_contributions
Volatility Detection Logic:
// Detect extreme years for volatility adjustment
extreme_years = 0
for i = 1 to historical_years
yearly_return = ((price_current / price_i_years_ago) - 1) * 100
if yearly_return > 100 or yearly_return < -50
extreme_years += 1
// Use median approach for high volatility stocks
high_volatility = (extreme_years / historical_years) > 0.2
calculated_return = high_volatility ? median_of_returns : standard_cagr
Performance Metrics:
// Calculate key performance indicators
absolute_gain = actual_value - total_invested
total_return_pct = (absolute_gain / total_invested) * 100
roi_initial = ((actual_value - initial_investment) / initial_investment) * 100
cagr = (math.pow(actual_value / initial_investment, 1 / years_elapsed) - 1) * 100
---
📊 Real-World Examples
See the indicator in action across different investment types:
Stable Index Investments:
Classic DCA success story: $60K initial + $500/month starting 2020. The indicator shows SPY's historical 10%+ returns, demonstrating how consistent broad market investing builds wealth over time. Notice the smooth theoretical growth line vs actual performance tracking.
Data limitation example: VUAA shows "Manual (Auto Failed)" and "No Data" when default 10-year historical setting exceeds available data. The indicator gracefully falls back to manual percentage input while maintaining all DCA calculations and projections.
Solution demonstration: By adjusting historical period to 5 years (matching available data), VUAA auto calculation works perfectly. Shows how users can optimize settings for newer assets. European market exposure with EUR denomination, demonstrating DCA effectiveness across different markets and currencies.
Value investing approach: Berkshire Hathaway's legendary performance through DCA lens. The indicator demonstrates how quality companies compound wealth over decades. Lower volatility than tech stocks = standard CAGR calculations used.
High-Volatility Growth Stocks:
High-volatility example: NVIDIA's explosive AI boom creates extreme years that trigger volatility detection. The indicator automatically switches to "Median (High Vol): 50%" calculations for conservative projections, protecting against unrealistic future estimates based on outlier performance periods.
Stable long-term growth: Despite Tesla's reputation for volatility, the 10-year historical analysis (34.8% CAGR) shows consistent enough performance that volatility detection doesn't trigger. Demonstrates how longer timeframes can smooth out extreme periods for more reliable projections.
Tech stock with stable growth: Despite being a tech stock and experiencing the 2022 crash, META's 10-year history shows consistent enough performance (23.98% CAGR) that volatility detection doesn't trigger. The indicator uses standard CAGR calculations, demonstrating how not all tech stocks require conservative median adjustments.
Notice how the indicator automatically detects high-volatility periods and switches to median-based calculations for more conservative projections, while stable investments use standard CAGR methods.
---
📈 Performance Metrics Explained
- Current Portfolio Value: Your actual investment worth today
- Expected Value: What you should have based on historical returns (Auto) or your target return (Manual)
- Total Invested: Your actual money invested (initial + all monthly contributions)
- Total Gains/Loss: Absolute dollar difference between current value and total invested
- Total Return %: Percentage gain/loss on your total invested amount
- ROI from Initial Investment: How your starting lump sum has performed
- CAGR: Compound Annual Growth Rate of your initial investment (Note: This shows initial investment performance, not full DCA strategy)
- vs Benchmark: How you're performing compared to the expected returns
---
⚠️ Important Notes & Limitations
- Data Requirements: Auto mode requires sufficient historical data (minimum 3 years recommended)
- CAGR Limitation: CAGR calculation is based on initial investment growth only, not the complete DCA strategy
- Projection Accuracy: Future projections are theoretical and based on historical returns - actual results may vary
- Timeframe Support: Works ONLY on Daily (1D), Weekly (1W), and Monthly (1M) charts - no other timeframes supported
- Update Frequency: Update "Current Portfolio Value" regularly for accurate tracking
---
📚 Educational Use & Disclaimer
This analysis tool can be applied to various stock and ETF charts for educational study of DCA mathematical concepts and historical performance patterns.
Study Examples: Can be used with symbols like
EDUCATIONAL DISCLAIMER: This indicator is a study tool for analyzing Dollar-Cost Averaging strategies. It does not provide investment advice, trading signals, or guarantees. All calculations are theoretical examples for educational purposes only. Past performance does not predict future results. Users should conduct their own research and consult qualified financial professionals before making any investment decisions.
---
© 2025 TradeVizion. All rights reserved.
發行說明
DCA Investment Tracker Pro [tradeviZion] - Version 2.0 Release NotesRelease Date: 06.06.2025
Bug Fix Update: Corrected Projection Label Inconsistencies
---
🔧 What's Fixed in Version 2.0
Main Issue Resolved:
Fixed projection label showing different values than the projection table. All projection displays now show consistent values.
Key Corrections:
- Projection Label Fix: Corrected inconsistent calculation method in projection endpoint label
- Unified Calculations: All projection displays (table, label, line) now use the same calculation method
- Added Tooltips: Better explanations for projection methodology
---
📊 Example Chart:
發行說明
DCA Investment Tracker Pro [tradeviZion] - Version 3.0 Release NotesEnhanced with ETF Cost Analysis & Safety Assessment
---
What's New in Version 3.0?
This update adds powerful ETF analysis features while keeping all your existing DCA tracking functionality.
🏢 NEW: ETF Cost Analysis
- Expense ratio impact tracking with real dollar costs
- Tax drag estimation and annual cost calculations
- Tracking error monitoring for index fund accuracy
- Bid-ask spread costs for each DCA purchase
- Total cost impact shown in main performance table
🛡️ NEW: ETF Safety Assessment
- 10-criteria safety scoring system (0-100 points)
- Investment grade classification (A+ to F rating)
- Provider reputation analysis (Top/Second/Third Tier)
- AUM, fund age, liquidity, and diversification metrics
- Risk assessment with sector concentration analysis
📊 ENHANCED: Performance Analysis
- Cost-adjusted projections include all ETF fees
- Enhanced historical return calculations with volatility detection
- Share-based tracking for precise cross-timeframe consistency
- Table layouts with ETF cost breakdowns
---
How to Use the New ETF Features
Step 1: Research Your ETF
Find these values from your ETF provider website, Yahoo Finance, or Morningstar:
- Annual Expense Ratio % (look for "Net Expense Ratio" or "TER")
- Assets Under Management in billions
- Fund age in years since inception
- Number of holdings from fact sheet
- Daily trading volume in millions
- Largest sector allocation percentage
Step 2: Enter ETF Data
- Fill in the "🏢 ETF Cost Analysis" section with expense ratio, tax drag estimate, tracking error, and bid-ask spread
- Complete the "🛡️ ETF Safety Assessment" section with AUM, age, holdings, volume, provider tier, and sector data
- Use decimal format (e.g., 0.07 for 0.07%, 20.7 for $20.7 billion)
Step 3: Review Results
- Check your ETF's investment grade and safety score in the main table
- Review annual cost impact in dollars in the projection table
- Compare cost-adjusted projections vs your actual performance
---
AI ETF Research Template
Copy this complete prompt into ChatGPT/Claude and replace [INSERT ETF TICKER HERE] with your ETF:
I need you to research an ETF and provide specific data for my Pine Script DCA investment tracker. Please research [ETF_TICKER] and provide the information in the EXACT format below.
**ETF TO RESEARCH: [INSERT ETF TICKER HERE]**
Please provide the following data by researching the ETF on these sources:
- For US ETFs: ETF.com, Yahoo Finance, Morningstar.com
- For European ETFs: JustETF.com, Yahoo Finance
- Always cross-reference between 2-3 sources for accuracy
**REQUIRED OUTPUT:**
## **Pine Script Values for [ETF_TICKER]:**
**🏢 ETF Cost Analysis:**
- Annual Expense Ratio %: **[X.XX]**
- Estimated Tax Drag %: **[X.X]**
- Annual Tracking Error %: **[X.XX]**
- Bid-Ask Spread %: **[X.XX]**
**🛡️ ETF Safety Assessment:**
- Assets Under Management (Billions): **[XX.X]**
- Fund Age (Years): **[XX]**
- Number of Holdings: **[XXXX]**
- Daily Volume (Millions): **[XX.X]**
- Provider Reputation: **[Top Tier/Second Tier/Third Tier]**
- Largest Sector %: **[XX.X]**
**RESEARCH GUIDELINES:**
1. **Expense Ratio**: Look for "TER" or "Net Expense Ratio" - report as decimal (0.07 for 0.07%)
2. **Tax Drag**: Tax-efficient ETFs: 0.1-0.5%, Average: 0.5-1.5%, Tax-inefficient: 1.5-3.0%
3. **Tracking Error**: Quality ETFs: 0.05-0.15%, Average: 0.15-0.25%, Poor: >0.25%
4. **Bid-Ask Spread**: Liquid ETFs: 0.01-0.03%, Average: 0.03-0.05%, Less liquid: 0.05-0.10%
5. **AUM**: Convert to billions USD (20.7 for $20.7B)
6. **Fund Age**: Years since inception (whole numbers)
7. **Holdings**: Exact count from fact sheet
8. **Volume**: Daily trading volume in millions USD
9. **Provider Tier**: Top Tier = Vanguard/iShares/SPDR/Fidelity, Second Tier = Invesco/Schwab/VanEck, Third Tier = Others
10. **Largest Sector**: Highest sector allocation percentage as decimal (32.3 for 32.3%)
**EXAMPLE OUTPUT:**
## **Pine Script Values for VUAA:**
**🏢 ETF Cost Analysis:**
- Annual Expense Ratio %: **0.07**
- Estimated Tax Drag %: **0.2**
- Annual Tracking Error %: **0.10**
- Bid-Ask Spread %: **0.02**
**🛡️ ETF Safety Assessment:**
- Assets Under Management (Billions): **20.7**
- Fund Age (Years): **6**
- Number of Holdings: **503**
- Daily Volume (Millions): **50.0**
- Provider Reputation: **Top Tier**
- Largest Sector %: **32.3**
Trusted Sources: ETF.com, JustETF.com (Europe), Yahoo Finance, Morningstar, provider websites
---
Example ETF Data (VUAA)
🏢 ETF Cost Analysis:
- Annual Expense Ratio %: 0.07
- Estimated Tax Drag %: 0.5
- Annual Tracking Error %: 0.10
- Bid-Ask Spread %: 0.02
🛡️ ETF Safety Assessment:
- Assets Under Management (Billions): 22.0
- Fund Age (Years): 6
- Number of Holdings: 503
- Daily Volume (Millions): 50.0
- Provider Reputation: Top Tier
- Largest Sector %: 32.3
---
Notes
- Fully backward compatible - existing settings unchanged
- All calculations are for educational analysis only
- Update "Current Portfolio Value" regularly for best tracking
- Works identically on Daily, Weekly, and Monthly timeframes
I created this open-source DCA Investment Tracker Pro indicator so everyone can see and visualize the benefits of choosing a long, steady investment approach. Being able to see compound growth in action makes all the difference in staying committed to a strategy.
As someone truly said: compound interest is the 8th wonder of the world. I hope my one month of coding brings real value to those seeking to visualize the power of long-term investment in one ETF and help them make more informed decisions. If you find this helpful, please boost this code so more users can see my gift to the community.
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
TradeVizion™
For our premium indicators! whop.com/tradevizion/
For our premium indicators! whop.com/tradevizion/
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。
開源腳本
本著TradingView的真正精神,此腳本的創建者將其開源,以便交易者可以查看和驗證其功能。向作者致敬!雖然您可以免費使用它,但請記住,重新發佈程式碼必須遵守我們的網站規則。
TradeVizion™
For our premium indicators! whop.com/tradevizion/
For our premium indicators! whop.com/tradevizion/
免責聲明
這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。