From 17ae6a0c78ac771ffe76b7d15ba4612f483ac43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guillermo=20Rodr=C3=ADguez?= Date: Sat, 22 Jan 2022 18:01:56 +0100 Subject: [PATCH] Harmonize short parameter name in stoploss_from_open() --- freqtrade/strategy/strategy_helper.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/freqtrade/strategy/strategy_helper.py b/freqtrade/strategy/strategy_helper.py index 2ae0e8cf0..f07c14e24 100644 --- a/freqtrade/strategy/strategy_helper.py +++ b/freqtrade/strategy/strategy_helper.py @@ -69,7 +69,7 @@ def merge_informative_pair(dataframe: pd.DataFrame, informative: pd.DataFrame, def stoploss_from_open( open_relative_stop: float, current_profit: float, - for_short: bool = False + is_short: bool = False ) -> float: """ @@ -84,15 +84,15 @@ def stoploss_from_open( :param open_relative_stop: Desired stop loss percentage relative to open price :param current_profit: The current profit percentage - :param for_short: When true, perform the calculation for short instead of long + :param is_short: When true, perform the calculation for short instead of long :return: Stop loss value relative to current price """ # formula is undefined for current_profit -1 (longs) or 1 (shorts), return maximum value - if (current_profit == -1 and not for_short) or (for_short and current_profit == 1): + if (current_profit == -1 and not is_short) or (is_short and current_profit == 1): return 1 - if for_short is True: + if is_short is True: stoploss = -1+((1-open_relative_stop)/(1-current_profit)) else: stoploss = 1-((1+open_relative_stop)/(1+current_profit))