Add new protections to full sample, documentation

This commit is contained in:
Matthias 2020-12-01 06:52:19 +01:00
parent f06b58dc91
commit b36f333b2f
2 changed files with 60 additions and 13 deletions

View File

@ -85,6 +85,20 @@
{ {
"method": "CooldownPeriod", "method": "CooldownPeriod",
"stopduration": 20 "stopduration": 20
},
{
"method": "MaxDrawdown",
"lookback_period": 2000,
"trade_limit": 20,
"stop_duration": 10,
"max_allowed_drawdown": 0.2
},
{
"method": "LowProfitPairs",
"lookback_period": 360,
"trade_limit": 1,
"stop_duration": 2,
"required_profit": 0.02
} }
], ],
"exchange": { "exchange": {

View File

@ -15,6 +15,7 @@ All protection end times are rounded up to the next candle to avoid sudden, unex
### Available Protection Handlers ### Available Protection Handlers
* [`StoplossGuard`](#stoploss-guard) Stop trading if a certain amount of stoploss occurred within a certain time window. * [`StoplossGuard`](#stoploss-guard) Stop trading if a certain amount of stoploss occurred within a certain time window.
* [`MaxDrawdown`](#maxdrawdown) Stop trading if max-drawdown is reached.
* [`LowProfitPairs`](#low-profit-pairs) Lock pairs with low profits * [`LowProfitPairs`](#low-profit-pairs) Lock pairs with low profits
* [`CooldownPeriod`](#cooldown-period) Don't enter a trade right after selling a trade. * [`CooldownPeriod`](#cooldown-period) Don't enter a trade right after selling a trade.
@ -23,33 +24,56 @@ All protection end times are rounded up to the next candle to avoid sudden, unex
`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`. `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`.
This applies across all pairs, unless `only_per_pair` is set to true, which will then only look at one pair at a time. This applies across all pairs, unless `only_per_pair` is set to true, which will then only look at one pair at a time.
The below example stops trading for all pairs for 2 hours (120min) after the last trade if the bot hit stoploss 4 times within the last 24h.
```json ```json
"protections": [ "protections": [
{ {
"method": "StoplossGuard", "method": "StoplossGuard",
"lookback_period": 60, "lookback_period": 1440,
"trade_limit": 4, "trade_limit": 4,
"stop_duration": 60, "stop_duration": 120,
"only_per_pair": false "only_per_pair": false
} }
], ],
``` ```
!!! Note !!! Note
`StoplossGuard` considers all trades with the results `"stop_loss"` and `"trailing_stop_loss"` if the result was negative. `StoplossGuard` considers all trades with the results `"stop_loss"` and `"trailing_stop_loss"` if the resulting profit was negative.
`trade_limit` and `lookback_period` will need to be tuned for your strategy. `trade_limit` and `lookback_period` will need to be tuned for your strategy.
#### MaxDrawdown
`MaxDrawdown` uses all trades within `lookback_period` (in minutes) to determine the maximum drawdown. If the drawdown is below `max_allowed_drawdown`, trading will stop for `stop_duration` (in minutes) after the last trade - assuming that the bot needs some time to let markets recover.
The below sample stops trading for 12 hours (720min) if max-drawdown is > 20% considering all trades within the last 2 days (2880min).
```json
"protections": [
{
"method": "MaxDrawdown",
"lookback_period": 2880,
"trade_limit": 20,
"stop_duration": 720,
"max_allowed_drawdown": 0.2
},
],
```
#### Low Profit Pairs #### Low Profit Pairs
`LowProfitPairs` uses all trades for a pair within a `lookback_period` (in minutes) to determine the overall profit ratio. `LowProfitPairs` uses all trades for a pair within a `lookback_period` (in minutes) to determine the overall profit ratio.
If that ratio is below `required_profit`, that pair will be locked for `stop_duration` (in minutes). If that ratio is below `required_profit`, that pair will be locked for `stop_duration` (in minutes).
The below example will stop trading a pair for 60 minutes if the pair does not have a required profit of 2% (and a minimum of 2 trades) within the last 6 hours (360min).
```json ```json
"protections": [ "protections": [
{ {
"method": "LowProfitPairs", "method": "LowProfitPairs",
"lookback_period": 60, "lookback_period": 360,
"trade_limit": 4, "trade_limit": 2,
"stop_duration": 60, "stop_duration": 60,
"required_profit": 0.02 "required_profit": 0.02
} }
@ -79,10 +103,11 @@ All protections are evaluated in the sequence they are defined.
The below example: 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 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`) * Stops trading if the last 2 days had 20 trades, which caused a max-drawdown of more than 20%. (`MaxDrawdown`).
* 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 * Stops trading if more than 4 stoploss occur for all pairs within a 1 day (1440min) limit (`StoplossGuard`).
* Locks all pairs that had 4 Trades within the last 6 hours (`60 * 6 = 360`) 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 4 trades.
```json ```json
"protections": [ "protections": [
@ -90,23 +115,31 @@ The below example:
"method": "CooldownPeriod", "method": "CooldownPeriod",
"stop_duration": 10 "stop_duration": 10
}, },
{
"method": "MaxDrawdown",
"lookback_period": 2880,
"trade_limit": 20,
"stop_duration": 720,
"max_allowed_drawdown": 0.2
},
{ {
"method": "StoplossGuard", "method": "StoplossGuard",
"lookback_period": 60, "lookback_period": 1440,
"trade_limit": 4, "trade_limit": 4,
"stop_duration": 60 "stop_duration": 120,
"only_per_pair": false
}, },
{ {
"method": "LowProfitPairs", "method": "LowProfitPairs",
"lookback_period": 360, "lookback_period": 360,
"trade_limit": 4, "trade_limit": 2,
"stop_duration": 60, "stop_duration": 60,
"required_profit": 0.02 "required_profit": 0.02
}, },
{ {
"method": "LowProfitPairs", "method": "LowProfitPairs",
"lookback_period": 1440, "lookback_period": 1440,
"trade_limit": 7, "trade_limit": 4,
"stop_duration": 120, "stop_duration": 120,
"required_profit": 0.01 "required_profit": 0.01
} }