Add support for trailing_stop_loss order_type
This commit is contained in:
parent
8daafc875d
commit
a5161ad433
@ -52,6 +52,7 @@
|
|||||||
"forcesell": "market",
|
"forcesell": "market",
|
||||||
"forcebuy": "market",
|
"forcebuy": "market",
|
||||||
"stoploss": "market",
|
"stoploss": "market",
|
||||||
|
"trailing_stop_loss": "limit",
|
||||||
"stoploss_on_exchange": false,
|
"stoploss_on_exchange": false,
|
||||||
"stoploss_on_exchange_interval": 60
|
"stoploss_on_exchange_interval": 60
|
||||||
},
|
},
|
||||||
|
@ -280,13 +280,13 @@ For example, if your strategy is using a 1h timeframe, and you only want to buy
|
|||||||
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.
|
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
|
This allows to buy using limit orders, sell using
|
||||||
limit-orders, and create stoplosses using market orders. It also allows to set the
|
limit-orders, and create stoplosses or trailing_stop_loss using market orders. It also allows to set the
|
||||||
stoploss "on exchange" which means stoploss order would be placed immediately once
|
stoploss "on exchange" which means stoploss order would be placed immediately once
|
||||||
the buy order is fulfilled.
|
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.
|
`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 5 values (`buy`, `sell`, `stoploss`, `trailing_stop_loss` and
|
If this is configured, the following 4 values (`buy`, `sell`, `stoploss` and
|
||||||
`stoploss_on_exchange`) need to be present, otherwise the bot will fail to start.
|
`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)
|
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)
|
||||||
|
@ -1144,7 +1144,10 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
if sell_reason == SellType.STOP_LOSS:
|
if sell_reason == SellType.STOP_LOSS:
|
||||||
sell_type = 'stoploss'
|
sell_type = 'stoploss'
|
||||||
elif sell_reason == SellType.TRAILING_STOP_LOSS:
|
elif sell_reason == SellType.TRAILING_STOP_LOSS:
|
||||||
sell_type = 'trailing_stop_loss'
|
if 'trailing_stop_loss' in self.strategy.order_types:
|
||||||
|
sell_type = 'trailing_stop_loss'
|
||||||
|
else:
|
||||||
|
sell_type = 'stoploss'
|
||||||
|
|
||||||
# if stoploss is on exchange and we are on dry_run mode,
|
# if stoploss is on exchange and we are on dry_run mode,
|
||||||
# we consider the sell price stop price
|
# we consider the sell price stop price
|
||||||
|
Loading…
Reference in New Issue
Block a user