From b50250139ec3171309ad62dd784b159e965245b9 Mon Sep 17 00:00:00 2001 From: misagh Date: Mon, 19 Nov 2018 20:02:26 +0100 Subject: [PATCH] Drafting stoploss on exchange --- freqtrade/strategy/interface.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/freqtrade/strategy/interface.py b/freqtrade/strategy/interface.py index 212559c8c..d1d4703a4 100644 --- a/freqtrade/strategy/interface.py +++ b/freqtrade/strategy/interface.py @@ -67,6 +67,11 @@ class IStrategy(ABC): # associated stoploss stoploss: float + # if the stoploss should be on exchange. + # if this is True then a stoploss order will be placed + # immediately after a successful buy order. + stoploss_on_exchange: bool = False + # associated ticker interval ticker_interval: str @@ -214,7 +219,11 @@ class IStrategy(ABC): # Set current rate to low for backtesting sell current_rate = low or rate current_profit = trade.calc_profit_percent(current_rate) - stoplossflag = self.stop_loss_reached(current_rate=current_rate, trade=trade, + + if self.stoploss_on_exchange: + stoplossflag = False + else: + stoplossflag = self.stop_loss_reached(current_rate=current_rate, trade=trade, current_time=date, current_profit=current_profit, force_stoploss=force_stoploss) if stoplossflag.sell_flag: