diff --git a/docs/configuration.md b/docs/configuration.md index 20b26ec13..9fd0208b8 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -277,7 +277,7 @@ For example, if your strategy is using a 1h timeframe, and you only want to buy ### Understand order_types -The `order_types` configuration parameter maps actions (`buy`, `sell`, `stoploss`, `emergencysell`, `forcesell`, `forcebuy`) to order-types (`market`, `limit`, ...) as well as configures stoploss to be on the exchange and defines stoploss on exchange update interval in seconds. +The `order_types` configuration parameter maps actions (`buy`, `sell`, `stoploss`, `trailing_stop_loss`, `emergencysell`, `forcesell`, `forcebuy`) to order-types (`market`, `limit`, ...) as well as configures stoploss to be on the exchange and defines stoploss on exchange update interval in seconds. This allows to buy using limit orders, sell using limit-orders, and create stoplosses using market orders. It also allows to set the @@ -286,7 +286,7 @@ the buy order is fulfilled. `order_types` set in the configuration file overwrites values set in the strategy as a whole, so you need to configure the whole `order_types` dictionary in one place. -If this is configured, the following 4 values (`buy`, `sell`, `stoploss` and +If this is configured, the following 5 values (`buy`, `sell`, `stoploss`, `trailing_stop_loss` and `stoploss_on_exchange`) need to be present, otherwise the bot will fail to start. For information on (`emergencysell`,`forcesell`, `forcebuy`, `stoploss_on_exchange`,`stoploss_on_exchange_interval`,`stoploss_on_exchange_limit_ratio`) please see stop loss documentation [stop loss on exchange](stoploss.md) @@ -301,6 +301,7 @@ order_types = { "forcebuy": "market", "forcesell": "market", "stoploss": "market", + "trailing_stop_loss": "limit", "stoploss_on_exchange": False, "stoploss_on_exchange_interval": 60, "stoploss_on_exchange_limit_ratio": 0.99, @@ -317,6 +318,7 @@ Configuration: "forcebuy": "market", "forcesell": "market", "stoploss": "market", + "trailing_stop_loss": "limit", "stoploss_on_exchange": false, "stoploss_on_exchange_interval": 60 } diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 53672c834..b47041e4d 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -1141,8 +1141,10 @@ class FreqtradeBot(LoggingMixin): :return: True if it succeeds (supported) False (not supported) """ sell_type = 'sell' - if sell_reason in (SellType.STOP_LOSS, SellType.TRAILING_STOP_LOSS): + if sell_reason == SellType.STOP_LOSS: sell_type = 'stoploss' + elif sell_reason == SellType.TRAILING_STOP_LOSS: + sell_type = 'trailing_stop_loss' # if stoploss is on exchange and we are on dry_run mode, # we consider the sell price stop price diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 6d40e56cc..adb29077e 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -100,6 +100,7 @@ class IStrategy(ABC): 'buy': 'limit', 'sell': 'limit', 'stoploss': 'limit', + 'trailing_stop_loss': 'limit', 'stoploss_on_exchange': False, 'stoploss_on_exchange_interval': 60, }