sell_profit_offset -> exit_profit_offset
This commit is contained in:
parent
bba9629a2a
commit
5ce5c70be6
|
@ -17,7 +17,7 @@
|
|||
"trailing_only_offset_is_reached": false,
|
||||
"use_sell_signal": true,
|
||||
"exit_profit_only": false,
|
||||
"sell_profit_offset": 0.0,
|
||||
"exit_profit_offset": 0.0,
|
||||
"ignore_roi_if_buy_signal": false,
|
||||
"ignore_buying_expired_candle_after": 300,
|
||||
"trading_mode": "spot",
|
||||
|
|
|
@ -118,7 +118,7 @@ Mandatory parameters are marked as **Required**, which means that they are requi
|
|||
| `exit_pricing.order_book_top` | Bot will use the top N rate in Order Book "price_side" to sell. I.e. a value of 2 will allow the bot to pick the 2nd ask rate in [Order Book Exit](#exit-price-with-orderbook-enabled)<br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
|
||||
| `use_sell_signal` | Use sell signals produced by the strategy in addition to the `minimal_roi`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `true`.* <br> **Datatype:** Boolean
|
||||
| `exit_profit_only` | Wait until the bot reaches `exit_profit_offset` before taking an exit decision. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `sell_profit_offset` | Sell-signal is only active above this value. Only active in combination with `exit_profit_only=True`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0`.* <br> **Datatype:** Float (as ratio)
|
||||
| `exit_profit_offset` | Sell-signal is only active above this value. Only active in combination with `exit_profit_only=True`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `0.0`.* <br> **Datatype:** Float (as ratio)
|
||||
| `ignore_roi_if_buy_signal` | Do not sell if the buy signal is still active. This setting takes preference over `minimal_roi` and `use_sell_signal`. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `ignore_buying_expired_candle_after` | Specifies the number of seconds until a buy signal is no longer used. <br> **Datatype:** Integer
|
||||
| `order_types` | Configure order-types depending on the action (`"entry"`, `"exit"`, `"stoploss"`, `"stoploss_on_exchange"`). [More information below](#understand-order_types). [Strategy Override](#parameters-in-the-strategy).<br> **Datatype:** Dict
|
||||
|
@ -200,7 +200,7 @@ Values set in the configuration file always overwrite values set in the strategy
|
|||
* `disable_dataframe_checks`
|
||||
* `use_sell_signal`
|
||||
* `exit_profit_only`
|
||||
* `sell_profit_offset`
|
||||
- `exit_profit_offset`
|
||||
* `ignore_roi_if_buy_signal`
|
||||
* `ignore_buying_expired_candle_after`
|
||||
* `position_adjustment_enable`
|
||||
|
|
|
@ -91,7 +91,7 @@ For example you could implement a 1:2 risk-reward ROI with `custom_exit()`.
|
|||
Using custom_exit() signals in place of stoploss though *is not recommended*. It is a inferior method to using `custom_stoploss()` in this regard - which also allows you to keep the stoploss on exchange.
|
||||
|
||||
!!! Note
|
||||
Returning a (none-empty) `string` or `True` from this method is equal to setting sell signal on a candle at specified time. This method is not called when sell signal is set already, or if sell signals are disabled (`use_sell_signal=False` or `exit_profit_only=True` while profit is below `sell_profit_offset`). `string` max length is 64 characters. Exceeding this limit will cause the message to be truncated to 64 characters.
|
||||
Returning a (none-empty) `string` or `True` from this method is equal to setting sell signal on a candle at specified time. This method is not called when sell signal is set already, or if sell signals are disabled (`use_sell_signal=False` or `exit_profit_only=True` while profit is below `exit_profit_offset`). `string` max length is 64 characters. Exceeding this limit will cause the message to be truncated to 64 characters.
|
||||
|
||||
An example of how we can use different indicators depending on the current profit and also sell trades that were open longer than one day:
|
||||
|
||||
|
|
|
@ -318,3 +318,4 @@ def _validate_pricing_rules(conf: Dict[str, Any]) -> None:
|
|||
def _strategy_settings(conf: Dict[str, Any]) -> None:
|
||||
|
||||
process_deprecated_setting(conf, None, 'sell_profit_only', None, 'exit_profit_only')
|
||||
process_deprecated_setting(conf, None, 'sell_profit_offset', None, 'exit_profit_offset')
|
||||
|
|
|
@ -151,7 +151,7 @@ CONF_SCHEMA = {
|
|||
'trailing_only_offset_is_reached': {'type': 'boolean'},
|
||||
'use_sell_signal': {'type': 'boolean'},
|
||||
'exit_profit_only': {'type': 'boolean'},
|
||||
'sell_profit_offset': {'type': 'number'},
|
||||
'exit_profit_offset': {'type': 'number'},
|
||||
'ignore_roi_if_buy_signal': {'type': 'boolean'},
|
||||
'ignore_buying_expired_candle_after': {'type': 'number'},
|
||||
'trading_mode': {'type': 'string', 'enum': TRADING_MODES},
|
||||
|
|
|
@ -462,7 +462,7 @@ def generate_strategy_stats(pairlist: List[str],
|
|||
'minimal_roi': config['minimal_roi'],
|
||||
'use_sell_signal': config['use_sell_signal'],
|
||||
'exit_profit_only': config['exit_profit_only'],
|
||||
'sell_profit_offset': config['sell_profit_offset'],
|
||||
'exit_profit_offset': config['exit_profit_offset'],
|
||||
'ignore_roi_if_buy_signal': config['ignore_roi_if_buy_signal'],
|
||||
**daily_stats,
|
||||
**trade_stats
|
||||
|
|
|
@ -88,7 +88,7 @@ class StrategyResolver(IResolver):
|
|||
("use_sell_signal", True),
|
||||
("exit_profit_only", False),
|
||||
("ignore_roi_if_buy_signal", False),
|
||||
("sell_profit_offset", 0.0),
|
||||
("exit_profit_offset", 0.0),
|
||||
("disable_dataframe_checks", False),
|
||||
("ignore_buying_expired_candle_after", 0),
|
||||
("position_adjustment_enable", False),
|
||||
|
@ -193,6 +193,7 @@ class StrategyResolver(IResolver):
|
|||
# TODO: Implementing one of the following methods should show a deprecation warning
|
||||
# buy_trend and sell_trend, custom_sell
|
||||
warn_deprecated_setting(strategy, 'sell_profit_only', 'exit_profit_only')
|
||||
warn_deprecated_setting(strategy, 'sell_profit_offset', 'exit_profit_offset')
|
||||
|
||||
if (
|
||||
not check_override(strategy, IStrategy, 'populate_buy_trend')
|
||||
|
|
|
@ -92,7 +92,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||
|
||||
use_sell_signal: bool
|
||||
exit_profit_only: bool
|
||||
sell_profit_offset: float
|
||||
exit_profit_offset: float
|
||||
ignore_roi_if_buy_signal: bool
|
||||
|
||||
# Position adjustment is disabled by default
|
||||
|
@ -881,7 +881,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
|||
current_rate = rate
|
||||
current_profit = trade.calc_profit_ratio(current_rate)
|
||||
|
||||
if (self.exit_profit_only and current_profit <= self.sell_profit_offset):
|
||||
if (self.exit_profit_only and current_profit <= self.exit_profit_offset):
|
||||
# exit_profit_only and profit doesn't reach the offset - ignore sell signal
|
||||
pass
|
||||
elif self.use_sell_signal and not enter:
|
||||
|
|
|
@ -1153,7 +1153,7 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
|
|||
default_conf.update({
|
||||
"use_sell_signal": True,
|
||||
"exit_profit_only": False,
|
||||
"sell_profit_offset": 0.0,
|
||||
"exit_profit_offset": 0.0,
|
||||
"ignore_roi_if_buy_signal": False,
|
||||
})
|
||||
patch_exchange(mocker)
|
||||
|
@ -1230,7 +1230,7 @@ def test_backtest_start_multi_strat_nomock(default_conf, mocker, caplog, testdat
|
|||
default_conf.update({
|
||||
"use_sell_signal": True,
|
||||
"exit_profit_only": False,
|
||||
"sell_profit_offset": 0.0,
|
||||
"exit_profit_offset": 0.0,
|
||||
"ignore_roi_if_buy_signal": False,
|
||||
})
|
||||
patch_exchange(mocker)
|
||||
|
@ -1348,7 +1348,7 @@ def test_backtest_start_nomock_futures(default_conf_usdt, mocker,
|
|||
"margin_mode": "isolated",
|
||||
"use_sell_signal": True,
|
||||
"exit_profit_only": False,
|
||||
"sell_profit_offset": 0.0,
|
||||
"exit_profit_offset": 0.0,
|
||||
"ignore_roi_if_buy_signal": False,
|
||||
"strategy": CURRENT_TEST_STRATEGY,
|
||||
})
|
||||
|
@ -1452,7 +1452,7 @@ def test_backtest_start_multi_strat_nomock_detail(default_conf, mocker,
|
|||
default_conf.update({
|
||||
"use_sell_signal": True,
|
||||
"exit_profit_only": False,
|
||||
"sell_profit_offset": 0.0,
|
||||
"exit_profit_offset": 0.0,
|
||||
"ignore_roi_if_buy_signal": False,
|
||||
})
|
||||
patch_exchange(mocker)
|
||||
|
@ -1559,7 +1559,7 @@ def test_backtest_start_multi_strat_caching(default_conf, mocker, caplog, testda
|
|||
default_conf.update({
|
||||
"use_sell_signal": True,
|
||||
"exit_profit_only": False,
|
||||
"sell_profit_offset": 0.0,
|
||||
"exit_profit_offset": 0.0,
|
||||
"ignore_roi_if_buy_signal": False,
|
||||
})
|
||||
patch_exchange(mocker)
|
||||
|
|
|
@ -3659,7 +3659,7 @@ def test_exit_profit_only(
|
|||
default_conf_usdt.update({
|
||||
'use_sell_signal': True,
|
||||
'exit_profit_only': profit_only,
|
||||
'sell_profit_offset': 0.1,
|
||||
'exit_profit_offset': 0.1,
|
||||
})
|
||||
freqtrade = FreqtradeBot(default_conf_usdt)
|
||||
patch_get_signal(freqtrade, enter_short=is_short, enter_long=not is_short)
|
||||
|
@ -3679,7 +3679,7 @@ def test_exit_profit_only(
|
|||
assert freqtrade.handle_trade(trade) is handle_first
|
||||
|
||||
if handle_second:
|
||||
freqtrade.strategy.sell_profit_offset = 0.0
|
||||
freqtrade.strategy.exit_profit_offset = 0.0
|
||||
assert freqtrade.handle_trade(trade) is True
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue