sell_profit_offset -> exit_profit_offset
This commit is contained in:
parent
66cadcac01
commit
cc8dd76879
@ -116,8 +116,8 @@ Mandatory parameters are marked as **Required**, which means that they are requi
|
||||
| `ask_strategy.use_order_book` | Enable selling of open trades using [Order Book Asks](#sell-price-with-orderbook-enabled). <br> **Datatype:** Boolean
|
||||
| `ask_strategy.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 Asks](#sell-price-with-orderbook-enabled)<br>*Defaults to `1`.* <br> **Datatype:** Positive Integer
|
||||
| `use_exit_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 `sell_profit_offset` before taking a sell 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_only` | Wait until the bot reaches `exit_profit_offset` before taking a sell decision. [Strategy Override](#parameters-in-the-strategy). <br>*Defaults to `false`.* <br> **Datatype:** Boolean
|
||||
| `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_enter_signal` | Do not sell if the buy signal is still active. This setting takes preference over `minimal_roi` and `use_exit_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 (`"buy"`, `"sell"`, `"stoploss"`, `"stoploss_on_exchange"`). [More information below](#understand-order_types). [Strategy Override](#parameters-in-the-strategy).<br> **Datatype:** Dict
|
||||
@ -195,7 +195,7 @@ Values set in the configuration file always overwrite values set in the strategy
|
||||
* `disable_dataframe_checks`
|
||||
* `use_exit_signal`
|
||||
* `exit_profit_only`
|
||||
* `sell_profit_offset`
|
||||
* `exit_profit_offset`
|
||||
* `ignore_roi_if_enter_signal`
|
||||
* `ignore_buying_expired_candle_after`
|
||||
|
||||
|
@ -89,7 +89,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_exit_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_exit_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:
|
||||
|
||||
|
@ -75,8 +75,8 @@ def process_temporary_deprecated_settings(config: Dict[str, Any]) -> None:
|
||||
None, 'use_exit_signal')
|
||||
process_deprecated_setting(config, 'ask_strategy', 'exit_profit_only',
|
||||
None, 'exit_profit_only')
|
||||
process_deprecated_setting(config, 'ask_strategy', 'sell_profit_offset',
|
||||
None, 'sell_profit_offset')
|
||||
process_deprecated_setting(config, 'ask_strategy', 'exit_profit_offset',
|
||||
None, 'exit_profit_offset')
|
||||
process_deprecated_setting(config, 'ask_strategy', 'ignore_roi_if_enter_signal',
|
||||
None, 'ignore_roi_if_enter_signal')
|
||||
process_deprecated_setting(config, 'ask_strategy', 'ignore_buying_expired_candle_after',
|
||||
|
@ -149,7 +149,7 @@ CONF_SCHEMA = {
|
||||
'trailing_only_offset_is_reached': {'type': 'boolean'},
|
||||
'use_exit_signal': {'type': 'boolean'},
|
||||
'exit_profit_only': {'type': 'boolean'},
|
||||
'sell_profit_offset': {'type': 'number'},
|
||||
'exit_profit_offset': {'type': 'number'},
|
||||
'ignore_roi_if_enter_signal': {'type': 'boolean'},
|
||||
'ignore_buying_expired_candle_after': {'type': 'number'},
|
||||
'trading_mode': {'type': 'string', 'enum': TRADING_MODES},
|
||||
|
@ -461,7 +461,7 @@ def generate_strategy_stats(btdata: Dict[str, DataFrame],
|
||||
'minimal_roi': config['minimal_roi'],
|
||||
'use_exit_signal': config['use_exit_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_enter_signal': config['ignore_roi_if_enter_signal'],
|
||||
**daily_stats,
|
||||
**trade_stats
|
||||
|
@ -94,7 +94,7 @@ class StrategyResolver(IResolver):
|
||||
("use_exit_signal", True),
|
||||
("exit_profit_only", False),
|
||||
("ignore_roi_if_enter_signal", False),
|
||||
("sell_profit_offset", 0.0),
|
||||
("exit_profit_offset", 0.0),
|
||||
("disable_dataframe_checks", False),
|
||||
("ignore_buying_expired_candle_after", 0)
|
||||
]
|
||||
|
@ -103,7 +103,7 @@ class IStrategy(ABC, HyperStrategyMixin):
|
||||
|
||||
use_exit_signal: bool
|
||||
exit_profit_only: bool
|
||||
sell_profit_offset: float
|
||||
exit_profit_offset: float
|
||||
ignore_roi_if_enter_signal: bool
|
||||
|
||||
# Number of seconds after which the candle will no longer result in a buy on expired candles
|
||||
@ -790,7 +790,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_exit_signal and not enter:
|
||||
|
@ -987,7 +987,7 @@ def test_backtest_start_multi_strat(default_conf, mocker, caplog, testdatadir):
|
||||
default_conf.update({
|
||||
"use_exit_signal": True,
|
||||
"exit_profit_only": False,
|
||||
"sell_profit_offset": 0.0,
|
||||
"exit_profit_offset": 0.0,
|
||||
"ignore_roi_if_enter_signal": False,
|
||||
})
|
||||
patch_exchange(mocker)
|
||||
@ -1062,7 +1062,7 @@ def test_backtest_start_multi_strat_nomock(default_conf, mocker, caplog, testdat
|
||||
default_conf.update({
|
||||
"use_exit_signal": True,
|
||||
"exit_profit_only": False,
|
||||
"sell_profit_offset": 0.0,
|
||||
"exit_profit_offset": 0.0,
|
||||
"ignore_roi_if_enter_signal": False,
|
||||
})
|
||||
patch_exchange(mocker)
|
||||
@ -1174,7 +1174,7 @@ def test_backtest_start_multi_strat_nomock_detail(default_conf, mocker,
|
||||
default_conf.update({
|
||||
"use_exit_signal": True,
|
||||
"exit_profit_only": False,
|
||||
"sell_profit_offset": 0.0,
|
||||
"exit_profit_offset": 0.0,
|
||||
"ignore_roi_if_enter_signal": False,
|
||||
})
|
||||
patch_exchange(mocker)
|
||||
|
@ -1122,8 +1122,8 @@ def test_pairlist_resolving_fallback(mocker):
|
||||
None, "use_exit_signal", False),
|
||||
("ask_strategy", "exit_profit_only", True,
|
||||
None, "exit_profit_only", False),
|
||||
("ask_strategy", "sell_profit_offset", 0.1,
|
||||
None, "sell_profit_offset", 0.01),
|
||||
("ask_strategy", "exit_profit_offset", 0.1,
|
||||
None, "exit_profit_offset", 0.01),
|
||||
("ask_strategy", "ignore_roi_if_enter_signal", True,
|
||||
None, "ignore_roi_if_enter_signal", False),
|
||||
("ask_strategy", "ignore_buying_expired_candle_after", 5,
|
||||
|
@ -3437,7 +3437,7 @@ def test_exit_profit_only(
|
||||
default_conf_usdt.update({
|
||||
'use_exit_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)
|
||||
@ -3456,7 +3456,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
|
||||
|
||||
|
||||
|
10
tests/testdata/strategy_SampleStrategy.fthypt
vendored
10
tests/testdata/strategy_SampleStrategy.fthypt
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user