Merge pull request #6276 from clover-es/feat/short

Add support for shorts in strategy.stoploss_from_absolute()
This commit is contained in:
Matthias
2022-01-25 19:11:05 +01:00
committed by GitHub
4 changed files with 35 additions and 20 deletions

View File

@@ -284,11 +284,11 @@ class AwesomeStrategy(IStrategy):
# evaluate highest to lowest, so that highest possible stop is used
if current_profit > 0.40:
return stoploss_from_open(0.25, current_profit)
return stoploss_from_open(0.25, current_profit, is_short=trade.is_short)
elif current_profit > 0.25:
return stoploss_from_open(0.15, current_profit)
return stoploss_from_open(0.15, current_profit, is_short=trade.is_short)
elif current_profit > 0.20:
return stoploss_from_open(0.07, current_profit)
return stoploss_from_open(0.07, current_profit, is_short=trade.is_short)
# return maximum stoploss value, keeping current stoploss price unchanged
return 1