Backtesting 3commas DCA Bot v2

Updating previously published simulated 3commas DCA logic with a sexier insert and more meaningful default parameters.
Release Notes: Added possibility to use the RSI as buy signal
Release Notes: Large Revamp:
- Added Label with warning and summary
- Added Stop Loss support
- Improved time inputs
- General bug fixes
Release Notes: Quick amend on previous commit:
- add comments in script
- add warnings for limitations on backtesting with stop loss (in general, do not use a stop loss if you use DCA on the Spot market)
Release Notes: Quick amend previous commit:
- Improved currency formatting
Release Notes: more realistic amount of BTC (divided amount of BTC by 1000 because who owns 2000 BTC ?!)
Release Notes: Fixed stop loss, reordered input as per 3c bot setup, fix max deviation calculation, add list of bot parameters on label printout
Release Notes: - Fix quantities calculation
- Default to RSI-7 < 30 for buy signal
Release Notes: amend previous commit
Release Notes: - fix RSI start condition (Below; not crossover)
- set RSI default timeframe to 15
- small rework on the warning/results labels
Release Notes: - Fixed Stop Loss triggers. Thank you @RealSaim for testing and reporting !
Release Notes: - more meaningful default inputs
- Slightly more sexy snapshot
Release Notes: New feature:
- Add a counter of total deals
Release Notes: New Feature:
- Add nb of deals closed on hitting Stop Loss
Release Notes: added support for Take Profit Type "% From Total Volume" or "% From Base Order "
Release Notes: After getting the request from many of you, here it is:
Release Notes: new update includes:
- refactored closing deal code
- add comparison of DCA bot performance to simple Buy and Hold.
Release Notes: Fix Trailing TP logic for short bot
Release Notes: New features !!
- Using TA Presets (Buy/Strong Buy/Sell/Strong Sell)
- Allow using different timeframes for RSI
- Allow using a percentage of equity rather than fixed amount of currency
- Numbered warnings
Release Notes: New feature !!
- Backtesting timeframe updated automatically on the label

This is because the number of bars available is a fixed amount so if you select a 1m timeframe, you can backtest over only a few days, but if you select a 15m timeframe you can backtest over several months.

free account = 5000 bars
pro/pro+ account = 10000 bars
premium account = 20000 bars
Release Notes: Fix bug on deal closure
Renamed "TA Preset" to "TV Preset"
Release Notes: fixed typo
Release Notes: Fancy update people !! A few weeks ago, TradingView released a new object called a "Table" and this is really a big upgrade on the usability of this backtester.
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.

Want to use this script on a chart?


Hi @rouxam ,
First of all, thank you for the effort you put into this project!
Question, How can I update the list of trades to the current date? right now it's until May 19.

+10 Reply
rouxam avibeker1
@avibeker1, that’s funny. Can you PM me a screenshot of your setup ?
+1 Reply
rouxam rouxam
@rouxam, resolved. the market simply crashed further than Max Deviation from your setup.
+2 Reply
Awesome work!
Just 1 question as a 3COMMAS newbie trying to get my head around all this.
The summary green "label" on the chart (copied below), does not match the overview analysis on the 15m chart (or any other time frame) . Sanity checks out fine, but there is a big difference in the profit loss analysis. The the green box net result-$743 and the overview shows +$266. Do you know what i am doing wrong to have the disparity ?

Backtesting 3commas DCA Bot v2 (1.3, % from total volume, 0, 0, Fixed, 98, 147, 7, 0.7, 1.2, 0.9, RSI-7, 30, Strong, , Long)
+7 Reply
rouxam TheHiddenTruth
@TheHiddenTruth do you have any open deal ? ;) TV overview does not seem to account for these?
+1 Reply
Another stat that would be a good one is the number of safety orders. It gives a nice insight into how a coin behaves :)
+6 Reply
rouxam ProFunder
@ProFunder, could you be more precise ? maximum number of SO triggered ? so that you can lower the nb of SO to (over)fit the backtest?
+1 Reply
@rouxam, thanks for the quick reply. From the manual that you linked on the previous iteration for this it seemed to be describing the stop loss % after the last SO. But I guess I read that wrong as after your reply I tested as a percentage that takes the last SO into account and it worked. Thanks for the clarification.
@rouxam, Yes, the most useful indicator would be the average number of SO's per trade. The lower the number the higher the velocity of trades (profits). Thanks... keep up the good work!
@rouxam, The maximum number of SO's experienced during the backtest would also be a good one.