OPEN-SOURCE SCRIPT
Daily Dollar Cost Averaging (DCA) Simulator & Yearly Performance

This indicator simulates a "Daily Dollar Cost Averaging" strategy directly on your chart. Unlike standard backtesters that trade based on signals, this script calculates the performance of a portfolio where a fixed dollar amount is invested every single day, regardless of price action.
Key Features:
Daily Accumulation: Simulates buying a specific dollar amount (e.g., $10) at the market close every day.
Yearly Breakdown Table: A detailed dashboard displayed on the chart that breaks down performance by year. It tracks total invested, average entry price, total holdings, current value, and PnL percentage for each individual year.
Global Stats: The bottom row of the table summarizes the total performance of the entire strategy since the start date.
Breakeven Line: Plots a yellow line on the chart representing your "Global Average Price." When the current price is above this line, the total strategy is in profit.
How to Use:
Add to chart (Works best on the Daily (D) timeframe).
Open settings to adjust your Daily Investment Amount and Start Year.
The table will automatically update to show how a daily investment strategy would have performed over time.
Key Features:
Daily Accumulation: Simulates buying a specific dollar amount (e.g., $10) at the market close every day.
Yearly Breakdown Table: A detailed dashboard displayed on the chart that breaks down performance by year. It tracks total invested, average entry price, total holdings, current value, and PnL percentage for each individual year.
Global Stats: The bottom row of the table summarizes the total performance of the entire strategy since the start date.
Breakeven Line: Plots a yellow line on the chart representing your "Global Average Price." When the current price is above this line, the total strategy is in profit.
How to Use:
Add to chart (Works best on the Daily (D) timeframe).
Open settings to adjust your Daily Investment Amount and Start Year.
The table will automatically update to show how a daily investment strategy would have performed over time.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.