INVITE-ONLY SCRIPT

Advanced DCA

21
Advanced DCA

(Pine v5 – strategia & indicatore per TradingView)



➤ Che cos’è

Questo script implementa il Dollar-Cost Averaging “avanzato” illustrato nel video di riferimento e lo confronta - in tempo reale - con un DCA puro (versamento costante investito subito, senza logica di market-timing).

Oltre a inviare gli ordini di back-test, disegna un cruscotto in alto a destra che riassume capitale, depositi, valore attuale delle due strategie e rendimento complessivo/medio.



➤ Come funziona (logica passo-passo)

Fase Descrizione Parametri coinvolti
1. Versamento mensile Ogni nuova candela mensile → si parte dal valore di Deposito mensile base (1 000 $ pre-definito). Deposito mensile base
2. Riduzioni in fase “caro” Se il prezzo sta +10 % sopra la MA a 12 mesi versi solo il 75 %. Se sale oltre +20 % versi il 50 %. Media mobile (mesi) • % sopra MA → 75 % • % sopra MA → 50 % • Contrib. % > soglia1/2
3. Buffer La parte non investita confluisce in un cash-buffer. –
4. Boost in fase “scontato” Quando il prezzo scende -10 % sotto la MA, il buffer viene frazionato sui successivi 6 mesi e aggiunto ai versamenti (100 %). % sotto MA per boost • Mesi di redistribuzione
5. Acquisto Lo script compra quote intere appena il contante raggiunge il costo di 1 quota (puoi passare alle frazioni sostituendo math.floor() con deposit/close). –
6. Benchmark DCA puro In parallelo calcola quante quote avresti con un versamento fisso di 1 000 $ investito interamente ogni mese (quote frazionarie). –
7. Dashboard Mostra capitali, cash, valore di mercato, confronto fra DCA puro/avanzato e rendimento totale / medio mensile. –




➤ Significato dei campi nel cruscotto

Etichetta Cosa mostra
Start capital Capitale iniziale (tab Properties).
Deposito mensile Valore del tuo versamento base.
Investito (costo) Somma di capitale iniziale + tutti i depositi ufficiali.
Non investito (cash) Buffer + pendenza ancora da investire.
Valore mercato Valore a prezzo corrente delle quote eventualmente ancora in portafoglio.
Depositi totali Contatore dei versamenti (non ridotti).
DCA puro (valore) Quanto varrebbe oggi il DCA classico.
DCA avanzato (valore) Equity totale della strategia avanzata (quote + cash).
Rend. tot | medio % complessiva sul capitale versato e % media geometrica mensile.




➤ Personalizzare per i propri test

Vuoi… Imposta così
Simulare il DCA puro thr1/thr2 = 999 e perc1/perc2 = 100.
Media più “lunga” (come nel video: 50-year) Media mobile (mesi) = 600.
Boost più aggressivo Mesi di redistribuzione = 1 e % sotto MA = –5.
Riduzioni più frequenti Abbassa thr1/thr2 (es. 5 / 10 %).
Evitare contante fermo Sostituisci la riga d’acquisto con qty = (depositAdv + extra) / close (quote frazionarie).




➤ Avvertenze
• È uno strumento di studio: non genera ordini live.
• Le performance storiche non garantiscono risultati futuri.
• Prova più timeframe, ETF o crypto per vedere dove il DCA avanzato porta reale vantaggio rispetto al DCA puro.

Buon back-test!

-------------------------------

Advanced DCA – Overview

(Pine v5 strategy + indicator for TradingView)



What it does

This script reproduces the “advanced” dollar-cost averaging (DCA) shown in the reference video and compares it live with a simple DCA (the full deposit invested every month with no timing filter).
It places back-test orders and draws a compact dashboard in the top-right corner that tracks capital, deposits, current value of both approaches and total / average returns.



Workflow

Step What happens Key inputs
1 Monthly deposit On every new monthly candle the script starts with Base monthly deposit (default $1 000). Base deposit
2 Trim when “expensive” If price is +10 % above the chosen MA, only 75 % is invested.If +20 %, only 50 % is invested. MA length, % above MA → 75 % / 50 %, Contribution %
3 Buffer The skipped money is parked in a cash buffer. —
4 Boost when “cheap” If price drops –10 % below the MA, the buffer is split over the next 6 months and added to the deposits. % below MA, Redistribution months
5 Buy The script buys whole shares as soon as cash ≥ 1 share price (switch to fractional by replacing math.floor() with deposit/close). —
6 Simple-DCA benchmark In parallel it tracks what you’d have by investing the full deposit every month (fractional shares). —
7 Dashboard Displays capital, cash, market value, simple vs advanced DCA and total / average monthly return. —




Dashboard fields

Label Meaning
Start capital Initial account size (Properties tab).
Monthly deposit Your base contribution.
Invested (cost) Initial capital + all official deposits.
Un-invested (cash) Buffer + pending cash.
Market value Current value of any open shares.
Total deposits Count of all monthly deposits.
Simple DCA (value) Value today of classic DCA.
Advanced DCA (value) Total equity of the advanced method (shares + cash).
**Return total avg**




Quick tuning

Goal Change this
Simulate pure DCA thr1/thr2 = 999, perc1/perc2 = 100.
50-year MA like the video MA length = 600 months.
Stronger boost Redistribution months = 1, % below MA = –5.
More frequent trims Lower thr1/thr2 (e.g. 5 % / 10 %).
No idle cash Buy fractional shares: qty = (deposit + extra) / close.




Notes
• This is a research tool—no live orders are sent.
• Past results ≠ future returns.
• Test different assets / timeframes to see when advanced DCA really beats simple DCA.

Happy back-testing!

免責聲明

這些資訊和出版物並不意味著也不構成TradingView提供或認可的金融、投資、交易或其他類型的意見或建議。請在使用條款閱讀更多資訊。