From 6f401a9e150be8f569396e129fcf698182488a1f Mon Sep 17 00:00:00 2001 From: Joe Schr <8218910+TheJoeSchr@users.noreply.github.com> Date: Tue, 18 Apr 2023 11:10:46 +0200 Subject: [PATCH 1/4] docs: use helper function `stoploss_from_absolute` in strategy callbacks "absolute" example --- docs/strategy-callbacks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 329908527..070eb6d48 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -352,7 +352,7 @@ class AwesomeStrategy(IStrategy): # Convert absolute price to percentage relative to current_rate if stoploss_price < current_rate: - return (stoploss_price / current_rate) - 1 + return stoploss_from_absolute(stoploss_price, current_rate, is_short=trade.is_short)) # return maximum stoploss value, keeping current stoploss price unchanged return 1 From f9124ef5b9c5150f2d3edf58904d8d562cf74748 Mon Sep 17 00:00:00 2001 From: Joe Schr <8218910+TheJoeSchr@users.noreply.github.com> Date: Tue, 18 Apr 2023 17:36:36 +0200 Subject: [PATCH 2/4] docs: strategy-callbacks: removes outdated `leverage` argument --- docs/strategy-callbacks.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 070eb6d48..a99b2ae29 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -318,11 +318,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, is_short=trade.is_short, leverage=trade.leverage) + 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, is_short=trade.is_short, leverage=trade.leverage) + 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, is_short=trade.is_short, leverage=trade.leverage) + return stoploss_from_open(0.07, current_profit, is_short=trade.is_short) # return maximum stoploss value, keeping current stoploss price unchanged return 1 From 94e190b954d48aec11d549c0de7aa25de172fbdc Mon Sep 17 00:00:00 2001 From: TheJoeSchr <8218910+TheJoeSchr@users.noreply.github.com> Date: Wed, 19 Apr 2023 13:22:52 +0200 Subject: [PATCH 3/4] docs: strategy-callbacks: revert `leverage=trade.leverage` removal --- docs/strategy-callbacks.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index a99b2ae29..070eb6d48 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -318,11 +318,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, is_short=trade.is_short) + return stoploss_from_open(0.25, current_profit, is_short=trade.is_short, leverage=trade.leverage) elif current_profit > 0.25: - return stoploss_from_open(0.15, current_profit, is_short=trade.is_short) + return stoploss_from_open(0.15, current_profit, is_short=trade.is_short, leverage=trade.leverage) elif current_profit > 0.20: - return stoploss_from_open(0.07, current_profit, is_short=trade.is_short) + return stoploss_from_open(0.07, current_profit, is_short=trade.is_short, leverage=trade.leverage) # return maximum stoploss value, keeping current stoploss price unchanged return 1 From 2f9e6c990c3908168a85903839cdec6b8996faca Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 19 Apr 2023 15:26:33 +0200 Subject: [PATCH 4/4] Update docs/strategy-callbacks.md --- docs/strategy-callbacks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/strategy-callbacks.md b/docs/strategy-callbacks.md index 070eb6d48..a13bdfd02 100644 --- a/docs/strategy-callbacks.md +++ b/docs/strategy-callbacks.md @@ -352,7 +352,7 @@ class AwesomeStrategy(IStrategy): # Convert absolute price to percentage relative to current_rate if stoploss_price < current_rate: - return stoploss_from_absolute(stoploss_price, current_rate, is_short=trade.is_short)) + return stoploss_from_absolute(stoploss_price, current_rate, is_short=trade.is_short) # return maximum stoploss value, keeping current stoploss price unchanged return 1