From 1f703dc3419e8a6179363248f6443177b3f86942 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 11 Nov 2020 08:00:10 +0100 Subject: [PATCH] Improve protection documentation --- docs/includes/protections.md | 62 ++++++++++++++++++++++++++++++++---- freqtrade/constants.py | 2 +- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/docs/includes/protections.md b/docs/includes/protections.md index aa0ca0f97..8efb02b95 100644 --- a/docs/includes/protections.md +++ b/docs/includes/protections.md @@ -8,13 +8,14 @@ Protections will protect your strategy from unexpected events and market conditi #### Stoploss Guard -`StoplossGuard` selects all trades within a `lookback_period` (in minutes), and determines if the amount of trades that resulted in stoploss are above `trade_limit` - in which case it will stop trading until this condition is no longer true. +`StoplossGuard` selects all trades within a `lookback_period` (in minutes), and determines if the amount of trades that resulted in stoploss are above `trade_limit` - in which case trading will stop for `stop_duration`. ```json "protections": [{ "method": "StoplossGuard", "lookback_period": 60, - "trade_limit": 4 + "trade_limit": 4, + "stop_duration": 60 }], ``` @@ -27,25 +28,72 @@ Protections will protect your strategy from unexpected events and market conditi If that ratio is below `required_profit`, that pair will be locked for `stop_duration` (in minutes). ```json -"protections": [{ +"protections": [ + { "method": "LowProfitpairs", "lookback_period": 60, "trade_limit": 4, "stop_duration": 60, "required_profit": 0.02 -}], + } +], ``` -### Full example of Protections +#### Cooldown Period + +`CooldownPeriod` locks a pair for `stop_duration` (in minutes) after selling, avoiding a re-entry for this pair for `stop_duration` minutes. + -The below example stops trading if more than 4 stoploss occur within a 1 hour (60 minute) limit. ```json "protections": [ + { + "method": "CooldownPeriod", + "stop_duration": 60 + } +], +``` + +!!! Note: + This Protection applies only at pair-level, and will never lock all pairs globally. + +### Full example of Protections + +All protections can be combined at will, also with different parameters, creating a increasing wall for under-performing pairs. +All protections are evaluated in the sequence they are defined. + +The below example: + +* stops trading if more than 4 stoploss occur for all pairs within a 1 hour (60 minute) limit (`StoplossGuard`). +* Locks each pair after selling for an additional 10 minutes (`CooldownPeriod`), giving other pairs a chance to get filled. +* Locks all pairs that had 4 Trades within the last 6 hours with a combined profit ratio of below 0.02 (<2%). (`LowProfitpairs`) +* Locks all pairs for 120 minutes that had a profit of below 0.01 (<1%) within the last 24h (`60 * 24 = 1440`), a minimum of 7 trades + +```json +"protections": [ + { + "method": "CooldownPeriod", + "stop_duration": 10 + }, { "method": "StoplossGuard", "lookback_period": 60, - "trade_limit": 4 + "trade_limit": 4, + "stop_duration": 60 + }, + { + "method": "LowProfitpairs", + "lookback_period": 360, + "trade_limit": 4, + "stop_duration": 60, + "required_profit": 0.02 + }, + { + "method": "LowProfitpairs", + "lookback_period": 1440, + "trade_limit": 7, + "stop_duration": 120, + "required_profit": 0.01 } ], ``` diff --git a/freqtrade/constants.py b/freqtrade/constants.py index 812883da0..3f6b6f440 100644 --- a/freqtrade/constants.py +++ b/freqtrade/constants.py @@ -207,7 +207,7 @@ CONF_SCHEMA = { 'trade_limit': {'type': 'number', 'integer': 1}, 'lookback_period': {'type': 'number', 'integer': 1}, }, - 'required': ['method', 'trade_limit'], + 'required': ['method'], } }, 'telegram': {