Use oppen_rate instead of artificial defaults
This commit is contained in:
parent
fc360608b7
commit
2d4a2fd10b
@ -209,8 +209,8 @@ class Trade(_DECL_BASE):
|
|||||||
Adjust the max_rate and min_rate.
|
Adjust the max_rate and min_rate.
|
||||||
"""
|
"""
|
||||||
logger.debug("Adjusting min/max rates")
|
logger.debug("Adjusting min/max rates")
|
||||||
self.max_rate = max(current_price, self.max_rate or 0.0)
|
self.max_rate = max(current_price, self.max_rate or self.open_rate)
|
||||||
self.min_rate = min(current_price, self.min_rate or 10000000.0)
|
self.min_rate = min(current_price, self.min_rate or self.open_rate)
|
||||||
|
|
||||||
def adjust_stop_loss(self, current_price: float, stoploss: float, initial: bool = False):
|
def adjust_stop_loss(self, current_price: float, stoploss: float, initial: bool = False):
|
||||||
"""this adjusts the stop loss to it's most recently observed setting"""
|
"""this adjusts the stop loss to it's most recently observed setting"""
|
||||||
|
@ -303,6 +303,7 @@ class IStrategy(ABC):
|
|||||||
if ((self.stoploss is not None) and
|
if ((self.stoploss is not None) and
|
||||||
(trade.stop_loss >= current_rate) and
|
(trade.stop_loss >= current_rate) and
|
||||||
(not self.order_types.get('stoploss_on_exchange'))):
|
(not self.order_types.get('stoploss_on_exchange'))):
|
||||||
|
|
||||||
selltype = SellType.STOP_LOSS
|
selltype = SellType.STOP_LOSS
|
||||||
# If Trailing stop (and max-rate did move above open rate)
|
# If Trailing stop (and max-rate did move above open rate)
|
||||||
if trailing_stop and trade.open_rate != trade.max_rate:
|
if trailing_stop and trade.open_rate != trade.max_rate:
|
||||||
|
Loading…
Reference in New Issue
Block a user