DCA Simulator

A simple yet powerful Dollar Cost Averaging (DCA) simulator.

You just add the script to your chart, and you'll be able to see:
- Every single entry with its size
- The evolution of you average price in time (blue line)
- The profit and loss areas (where market price < average price the DCA is at loss, and the background is colored in red. At the contrary, where mkt price is > average price, it's profit area and the background is green).
- Max drawdown: the point in price and time where the DCA loss is maximum in the considered time interval. The drawdown amount is specified.
- Profit (or loss) and total cost at the end of the time interval or at the present day: the script shows how much the DCA is netting at a profit or loss, as well as the total cost of the DCA itself.

The parameters are:

- Date start and date end: time interval of the DCA simulation
- DCA period (you can choose between daily, weekly and monthly)
- Week day or month day if you choose those periods
- Single operation size (in base currency)
- Option to choose a DCA LONG or DCA SHORT (for uber bears)
- Option to include an exit strategy that partially closes your position (the % size closed can be chosen as well with the parameter "exit_close_perc") every time the DCA realizes a specific gain (choosable with the parameter "exit_gain_threshold"). If you choose "none" as an exit strategy, the script will assume to never close positions until the end of the period or the present day for simulation purpose.

NB: just ignore the TV strategy tester results, all the data are visible on the chart.

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.


The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?