From 1cf6e2c957de86054d5611ddf78230754e3fb112 Mon Sep 17 00:00:00 2001 From: hoeckxer Date: Mon, 4 Jan 2021 14:37:22 +0100 Subject: [PATCH] Changed documentation based on review comments Signed-off-by: hoeckxer --- docs/strategy-advanced.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/docs/strategy-advanced.md b/docs/strategy-advanced.md index 9d5930518..2431274d7 100644 --- a/docs/strategy-advanced.md +++ b/docs/strategy-advanced.md @@ -142,16 +142,10 @@ class AwesomeStrategy(IStrategy): return -1 # return a value bigger than the inital stoploss to keep using the inital stoploss # After reaching the desired offset, allow the stoploss to trail by half the profit - stoploss = current_profit / 2 + desired_stoploss = current_profit / 2 - if abs(stoploss) < 0.025: - # Maintain a minimum of 2.5% trailing stoploss - stoploss = 0.025 - if abs(stoploss) > 0.05: - # Maximize the stoploss at 5% - stoploss = 0.05 - - return stoploss + # Use a minimum of 2.5% and a maximum of 5% + return max(min(desired_stoploss, 0.05), 0.025) ``` #### Absolute stoploss