diff --git a/docs/configuration.md b/docs/configuration.md
index aa02a95a5..172ad468d 100644
--- a/docs/configuration.md
+++ b/docs/configuration.md
@@ -173,7 +173,7 @@ Mandatory parameters are marked as **Required**, which means that they are requi
| `dataformat_ohlcv` | Data format to use to store historical candle (OHLCV) data.
*Defaults to `json`*.
**Datatype:** String
| `dataformat_trades` | Data format to use to store historical trades data.
*Defaults to `jsongz`*.
**Datatype:** String
| `position_adjustment_enable` | Enables the strategy to use position adjustments (additional buys or sells). [More information here](strategy-callbacks.md#adjust-trade-position).
[Strategy Override](#parameters-in-the-strategy).
*Defaults to `false`.*
**Datatype:** Boolean
-| `max_buy_position_adjustment` | Maximum additional buy(s) for each open trade on top of the first buy. Set it to `-1` for unlimited additional buys. [More information here](strategy-callbacks.md#adjust-trade-position).
[Strategy Override](#parameters-in-the-strategy).
*Defaults to `-1`.*
**Datatype:** Positive Integer or -1
+| `max_entry_position_adjustment` | Maximum additional buy(s) for each open trade on top of the first entry Order. Set it to `-1` for unlimited additional additional orders. [More information here](strategy-callbacks.md#adjust-trade-position).
[Strategy Override](#parameters-in-the-strategy).
*Defaults to `-1`.*
**Datatype:** Positive Integer or -1
### Parameters in the strategy
@@ -199,7 +199,7 @@ Values set in the configuration file always overwrite values set in the strategy
* `ignore_roi_if_buy_signal`
* `ignore_buying_expired_candle_after`
* `position_adjustment_enable`
-* `max_buy_position_adjustment`
+* `max_entry_position_adjustment`
### Configuring amount per trade
diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md
index ca5fa4274..3a30a2a28 100644
--- a/docs/strategy-callbacks.md
+++ b/docs/strategy-callbacks.md
@@ -579,13 +579,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.
+`max_entry_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, or when you have reached the maximum amount of extra buys that you have set on `max_buy_position_adjustment`.
+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_entry_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"
@@ -616,7 +616,7 @@ class DigDeeperStrategy(IStrategy):
# ... populate_* methods
# Example specific variables
- max_buy_position_adjustment = 3
+ max_entry_position_adjustment = 3
# This number is explained a bit further down
max_dca_multiplier = 5.5
diff --git a/freqtrade/constants.py b/freqtrade/constants.py
index a166c074b..f02e39792 100644
--- a/freqtrade/constants.py
+++ b/freqtrade/constants.py
@@ -373,7 +373,7 @@ CONF_SCHEMA = {
'default': 'jsongz'
},
'position_adjustment_enable': {'type': 'boolean', 'default': False},
- 'max_buy_position_adjustment': {'type': ['integer', 'number'], 'minimum': -1},
+ 'max_entry_position_adjustment': {'type': ['integer', 'number'], 'minimum': -1},
},
'definitions': {
'exchange': {
diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py
index bc2be37ed..c3c03ed67 100644
--- a/freqtrade/freqtradebot.py
+++ b/freqtrade/freqtradebot.py
@@ -471,13 +471,13 @@ class FreqtradeBot(LoggingMixin):
If the strategy triggers the adjustment, a new order gets issued.
Once that completes, the existing trade is modified to match new data.
"""
- if self.strategy.max_buy_position_adjustment > -1:
+ if self.strategy.max_entry_position_adjustment > -1:
count_of_buys = trade.nr_of_successful_buys
- if count_of_buys > self.strategy.max_buy_position_adjustment:
- logger.debug(f"Max adjustment buy for {trade.pair} has been reached.")
+ if count_of_buys > self.strategy.max_entry_position_adjustment:
+ logger.debug(f"Max adjustment entries for {trade.pair} has been reached.")
return
else:
- logger.debug("Max adjustment buy is set to unlimited.")
+ logger.debug("Max adjustment entries is set to unlimited.")
current_rate = self.exchange.get_rate(trade.pair, refresh=True, side="buy")
current_profit = trade.calc_profit_ratio(current_rate)
diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py
index e5aff9374..e173c3367 100644
--- a/freqtrade/optimize/backtesting.py
+++ b/freqtrade/optimize/backtesting.py
@@ -382,9 +382,9 @@ class Backtesting:
# Check if we need to adjust our current positions
if self.strategy.position_adjustment_enable:
check_adjust_buy = True
- if self.strategy.max_buy_position_adjustment > -1:
+ if self.strategy.max_entry_position_adjustment > -1:
count_of_buys = trade.nr_of_successful_buys
- check_adjust_buy = (count_of_buys <= self.strategy.max_buy_position_adjustment)
+ check_adjust_buy = (count_of_buys <= self.strategy.max_entry_position_adjustment)
if check_adjust_buy:
trade = self._get_adjust_trade_entry_for_candle(trade, sell_row)
diff --git a/freqtrade/resolvers/strategy_resolver.py b/freqtrade/resolvers/strategy_resolver.py
index f48a42f11..e9fcc3496 100644
--- a/freqtrade/resolvers/strategy_resolver.py
+++ b/freqtrade/resolvers/strategy_resolver.py
@@ -98,7 +98,7 @@ class StrategyResolver(IResolver):
("disable_dataframe_checks", False),
("ignore_buying_expired_candle_after", 0),
("position_adjustment_enable", False),
- ("max_buy_position_adjustment", -1),
+ ("max_entry_position_adjustment", -1),
]
for attribute, default in attributes:
StrategyResolver._override_attribute_helper(strategy, config,
diff --git a/freqtrade/rpc/api_server/api_schemas.py b/freqtrade/rpc/api_server/api_schemas.py
index 421209863..96421ed32 100644
--- a/freqtrade/rpc/api_server/api_schemas.py
+++ b/freqtrade/rpc/api_server/api_schemas.py
@@ -174,7 +174,7 @@ class ShowConfig(BaseModel):
state: str
runmode: str
position_adjustment_enable: bool
- max_buy_position_adjustment: int
+ max_entry_position_adjustment: int
class TradeSchema(BaseModel):
diff --git a/freqtrade/rpc/rpc.py b/freqtrade/rpc/rpc.py
index b6bed9e0b..2374dbd39 100644
--- a/freqtrade/rpc/rpc.py
+++ b/freqtrade/rpc/rpc.py
@@ -138,9 +138,10 @@ class RPC:
'state': str(botstate),
'runmode': config['runmode'].value,
'position_adjustment_enable': config.get('position_adjustment_enable', False),
- 'max_buy_position_adjustment': (config['max_buy_position_adjustment']
- if config['max_buy_position_adjustment'] != float('inf')
- else -1)
+ 'max_entry_position_adjustment': (
+ config['max_entry_position_adjustment']
+ if config['max_entry_position_adjustment'] != float('inf')
+ else -1)
}
return val
@@ -251,7 +252,7 @@ class RPC:
profit_str
]
if self._config.get('position_adjustment_enable', False):
- max_buy = self._config['max_buy_position_adjustment'] + 1
+ max_buy = self._config['max_entry_position_adjustment'] + 1
filled_buys = trade.nr_of_successful_buys
detail_trade.append(f"{filled_buys}/{max_buy}")
trades_list.append(detail_trade)
diff --git a/freqtrade/rpc/telegram.py b/freqtrade/rpc/telegram.py
index 1017d5f48..0f0bd7432 100644
--- a/freqtrade/rpc/telegram.py
+++ b/freqtrade/rpc/telegram.py
@@ -1350,7 +1350,7 @@ class Telegram(RPCHandler):
if val['position_adjustment_enable']:
pa_info = (
f"*Position adjustment:* On\n"
- f"*Max buy position adjustment:* `{val['max_buy_position_adjustment']}`\n"
+ f"*Max enter position adjustment:* `{val['max_entry_position_adjustment']}`\n"
)
else:
pa_info = "*Position adjustment:* Off\n"
diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py
index 220c7f0a9..78dae6c5d 100644
--- a/freqtrade/strategy/interface.py
+++ b/freqtrade/strategy/interface.py
@@ -108,7 +108,7 @@ class IStrategy(ABC, HyperStrategyMixin):
# Position adjustment is disabled by default
position_adjustment_enable: bool = False
- max_buy_position_adjustment: int = -1
+ max_entry_position_adjustment: int = -1
# Number of seconds after which the candle will no longer result in a buy on expired candles
ignore_buying_expired_candle_after: int = 0
diff --git a/tests/test_freqtradebot.py b/tests/test_freqtradebot.py
index 6946cd08f..523696759 100644
--- a/tests/test_freqtradebot.py
+++ b/tests/test_freqtradebot.py
@@ -4570,7 +4570,7 @@ def test_process_open_trade_positions_exception(mocker, default_conf_usdt, fee,
def test_check_and_call_adjust_trade_position(mocker, default_conf_usdt, fee, caplog) -> None:
default_conf_usdt.update({
"position_adjustment_enable": True,
- "max_buy_position_adjustment": 0,
+ "max_entry_position_adjustment": 0,
})
freqtrade = get_patched_freqtradebot(mocker, default_conf_usdt)
@@ -4578,4 +4578,4 @@ def test_check_and_call_adjust_trade_position(mocker, default_conf_usdt, fee, ca
caplog.set_level(logging.DEBUG)
freqtrade.process_open_trade_positions()
- assert log_has_re(r"Max adjustment buy for .* has been reached\.", caplog)
+ assert log_has_re(r"Max adjustment entries for .* has been reached\.", caplog)