Skip to main content

Advanced DCA (for spot trading)

tested_in type_autoconfig developer

date_of_upload

Extends the built-in DCA options with the possibility to set a custom buydown percentage and DCA ratio for each DCA round.b

You do not need to be an AutoConfig wizard to use this: all options are controlled with pair overrides.

Features

  • Specify buydown and ratio per round
  • Option to use expressions as values for buydown and ratio
  • Option to stop buying after completing DCA
  • Supports "keep quote"
  • Includes ready made config bundle as example
  • works around known issues with "ducount" in Gunbot when changing settings mid-DCA

Tested on

  • v19.9.9.6
  • should stay working in future versions unless major changes happen to how "double up" works in Gunbot

Constraints

  • This probably won't work great with really tiny buydown percentages, it could happen that multiple orders get counted as a single DCA round
  • I've only tested this setup with market orders. Although the setup tries to identify open limit orders and wait for them to fill, unexpected behavior might occur

Included files

  • autoconfig.json
  • example bundle of autoconfig.json and config.js of a hedged trading setup for ETHUP and ETHDOWN, emulating "grid" and "sup/res" on spot trading. Since it trades both sides, it immediately opens a new position after closing and allows for up to 20 rounds of dca, each at 1x trading limit.
  • the same instructions as you're reading now

Setup instructions

  1. Add AutoConfig job Use the included autoconfig.json file if you don't use other jobs. If you have existing jobs in autoconfig.json, add the job called AC_DCA to your config.
  2. Set exchange Change the exchange in the job to the exchange name you want to use it on. By default it is set to "binance".
  3. Done! No need to change anything else in the autoconfig job, All DCA settings are controlled with pair overrides

If you want to use it on multiple exchanges, add the job once for each exchange and give it a unique job name each time.

Usage instructions

  1. Prepare DCA strategy settings
  • set DU_CAP_COUNT extremely high (for example, 9999), to effectively disable it, the autoconfig job will take care of counting
  • set your preferences for DU method, pick between "RSI" and "HIGHBB". Do not use a numerical value as method
  • it does not matter if you enable DU in your strategy, the autoconfig job will toggle it automatically when needed
  1. Enable the market buy option in your strategy, if your exchange supports it
  2. Set pair overrides to configure "Advanced DCA"

You can start running it on pair with and without balance. It will assume DCA has yet to begin, regardless of your starting balance.

Available settings options

"AC_DCA": true, --> when true, DCA is handled by AutoConfig. Pairs without this parameter are ignored by the AutoConfig job

"AC_DCA_CAP_COUNT": 2, --> max number of DCA rounds

"AC_DCA_STOP_AFTER_DCA": false, --> when true, buying gets disabled for the pair when DCA finishes or a profit sell happens after at least one round of DCA

"AC_DCA_RATIO_R1": 1, --> sets the ratio for DCA round 1. Works exactly the same as DOUBLE_UP_CAP, just for a specific round

"AC_DCA_BUYDOWN_R1": 2, --> sets the buydown percentage for DCA round 1. Works exactly the same as DU_BUYDOWN, just for a specific round

"AC_DCA_RATIO_R2": 0.8, --> sets the ratio for DCA round 1. Works exactly the same as DOUBLE_UP_CAP, just for a specific round

"AC_DCA_BUYDOWN_R2": 5, --> sets the buydown percentage for DCA round 1. Works exactly the same as DU_BUYDOWN, just for a specific round

Make sure to add both buydown and ratio for each allowed round as set with AC_DCA_CAP_COUNT. So if you set AC_DCA_CAP_COUNT: 5, make sure to have ratio and buydown overrides up to _R5

Besides settings, this setup stores a few data points in pair overrides (marked with _noModify in their names). You need to set these once, with default values as shown below.

Valid example for a new pair to start DCA on, configured for up to two rounds of DCA:

"USDT-ETHDOWN": {
"strategy": "acdca",
"enabled": true,
"override": {
"AC_DCA": true,
"AC_DCA_CAP_COUNT": 2,
"AC_DCA_STOP_AFTER_DCA": false,
"AC_DCA_RATIO_R1": 1,
"AC_DCA_BUYDOWN_R1": 2,
"AC_DCA_RATIO_R2": 0.8,
"AC_DCA_BUYDOWN_R2": 4,
"AC_DCA_ROUND_noModify": 0,
"AC_DCA_STATUS_noModify": "init",
"AC_DCA_REFCOUNT_noModify": 0,
"AC_DCA_QUOTE_noModify": 0
}
}

Done!

Using expressions as values for buydown and/or ratio:

When using expressions as values, it works exactly the same as in regular AutoConfig job, but with one difference: this. is called data.

This example of using an expression for DCA ratio makes it use 1x TL instead of doubling up: "AC_DCA_RATIO_R2": " data.pair.whatstrat.TRADING_LIMIT / (data.pair.quoteBalance * data.pair.Bid)"

Disclaimer

It's not feasible for a free config example to test all possible things that could go wrong. Use with caution!

Enjoy!

I’d appreciate it if you do not contact me through personal messages about this free config example.

Download

AC_DCA_v1.01.zip