diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 7a4aed5d6..8ff4cc095 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -576,11 +576,13 @@ The `position_adjustment_enable` strategy property enables the usage of `adjust_ For performance reasons, it's disabled by default and freqtrade will show a warning message on startup if enabled. `adjust_trade_position()` can be used to perform additional orders, for example to manage risk with DCA (Dollar Cost Averaging). +`max_buy_position_adjustment` property is used to limit the number of additional buys per trade (on top of the first buy) that the bot can execute. By default, the value is -1 which means the bot have no limit on number of adjustment buys. + The strategy is expected to return a stake_amount (in stake currency) between `min_stake` and `max_stake` if and when an additional buy order should be made (position is increased). If there are not enough funds in the wallet (the return value is above `max_stake`) then the signal will be ignored. Additional orders also result in additional fees and those orders don't count towards `max_open_trades`. -This callback is **not** called when there is an open order (either buy or sell) waiting for execution. +This callback is **not** called when there is an open order (either buy or sell) waiting for execution, or when you have reached the maximum amount of extra buys that you have set on `max_buy_position_adjustment`. `adjust_trade_position()` is called very frequently for the duration of a trade, so you must keep your implementation as performant as possible. !!! Note "About stake size" diff --git a/freqtrade/constants.py b/freqtrade/constants.py index 504c7dce9..a166c074b 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -371,7 +371,9 @@ CONF_SCHEMA = { 'type': 'string', 'enum': AVAILABLE_DATAHANDLERS, 'default': 'jsongz' - } + }, + 'position_adjustment_enable': {'type': 'boolean', 'default': False}, + 'max_buy_position_adjustment': {'type': ['integer', 'number'], 'minimum': -1}, }, 'definitions': { 'exchange': {