Improve protection documentation
This commit is contained in:
parent
1f703dc341
commit
bb06365c50
@ -2,35 +2,46 @@
|
|||||||
|
|
||||||
Protections will protect your strategy from unexpected events and market conditions.
|
Protections will protect your strategy from unexpected events and market conditions.
|
||||||
|
|
||||||
|
!!! Note
|
||||||
|
Not all Protections will work for all strategies, and parameters will need to be tuned for your strategy.
|
||||||
|
|
||||||
|
!!! Tip
|
||||||
|
Each Protection can be configured multiple times with different parameters, to allow different levels of protection (short-term / long-term).
|
||||||
|
|
||||||
### Available Protection Handlers
|
### Available Protection Handlers
|
||||||
|
|
||||||
* [`StoplossGuard`](#stoploss-guard) (default, if not configured differently)
|
* [`StoplossGuard`](#stoploss-guard) Stop trading if a certain amount of stoploss occurred within a certain time window.
|
||||||
|
* [`LowProfitPairs`](#low-profit-pairs) Lock pairs with low profits
|
||||||
|
* [`CooldownPeriod`](#cooldown-period) Don't enter a trade right after selling a trade.
|
||||||
|
|
||||||
#### Stoploss Guard
|
#### 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 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`.
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"protections": [{
|
"protections": [
|
||||||
|
{
|
||||||
"method": "StoplossGuard",
|
"method": "StoplossGuard",
|
||||||
"lookback_period": 60,
|
"lookback_period": 60,
|
||||||
"trade_limit": 4,
|
"trade_limit": 4,
|
||||||
"stop_duration": 60
|
"stop_duration": 60
|
||||||
}],
|
}
|
||||||
|
],
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! 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 result was negative.
|
||||||
|
`trade_limit` and `lookback_period` will need to be tuned for your strategy.
|
||||||
|
|
||||||
#### 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).
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"protections": [
|
"protections": [
|
||||||
{
|
{
|
||||||
"method": "LowProfitpairs",
|
"method": "LowProfitPairs",
|
||||||
"lookback_period": 60,
|
"lookback_period": 60,
|
||||||
"trade_limit": 4,
|
"trade_limit": 4,
|
||||||
"stop_duration": 60,
|
"stop_duration": 60,
|
||||||
@ -43,8 +54,6 @@ If that ratio is below `required_profit`, that pair will be locked for `stop_dur
|
|||||||
|
|
||||||
`CooldownPeriod` locks a pair for `stop_duration` (in minutes) after selling, avoiding a re-entry for this pair for `stop_duration` minutes.
|
`CooldownPeriod` locks a pair for `stop_duration` (in minutes) after selling, avoiding a re-entry for this pair for `stop_duration` minutes.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"protections": [
|
"protections": [
|
||||||
{
|
{
|
||||||
@ -66,7 +75,7 @@ The below example:
|
|||||||
|
|
||||||
* stops trading if more than 4 stoploss occur for all pairs within a 1 hour (60 minute) limit (`StoplossGuard`).
|
* 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`)
|
* 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
|
* 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
|
```json
|
||||||
@ -82,14 +91,14 @@ The below example:
|
|||||||
"stop_duration": 60
|
"stop_duration": 60
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"method": "LowProfitpairs",
|
"method": "LowProfitPairs",
|
||||||
"lookback_period": 360,
|
"lookback_period": 360,
|
||||||
"trade_limit": 4,
|
"trade_limit": 4,
|
||||||
"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": 7,
|
||||||
"stop_duration": 120,
|
"stop_duration": 120,
|
||||||
|
@ -27,7 +27,7 @@ AVAILABLE_PAIRLISTS = ['StaticPairList', 'VolumePairList',
|
|||||||
'AgeFilter', 'PerformanceFilter', 'PrecisionFilter',
|
'AgeFilter', 'PerformanceFilter', 'PrecisionFilter',
|
||||||
'PriceFilter', 'RangeStabilityFilter', 'ShuffleFilter',
|
'PriceFilter', 'RangeStabilityFilter', 'ShuffleFilter',
|
||||||
'SpreadFilter']
|
'SpreadFilter']
|
||||||
AVAILABLE_PROTECTIONS = ['StoplossGuard', 'CooldownPeriod', 'LowProfitpairs']
|
AVAILABLE_PROTECTIONS = ['StoplossGuard', 'CooldownPeriod', 'LowProfitPairs']
|
||||||
AVAILABLE_DATAHANDLERS = ['json', 'jsongz', 'hdf5']
|
AVAILABLE_DATAHANDLERS = ['json', 'jsongz', 'hdf5']
|
||||||
DRY_RUN_WALLET = 1000
|
DRY_RUN_WALLET = 1000
|
||||||
DATETIME_PRINT_FORMAT = '%Y-%m-%d %H:%M:%S'
|
DATETIME_PRINT_FORMAT = '%Y-%m-%d %H:%M:%S'
|
||||||
|
@ -11,7 +11,7 @@ from freqtrade.plugins.protections import IProtection, ProtectionReturn
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class LowProfitpairs(IProtection):
|
class LowProfitPairs(IProtection):
|
||||||
|
|
||||||
def __init__(self, config: Dict[str, Any], protection_config: Dict[str, Any]) -> None:
|
def __init__(self, config: Dict[str, Any], protection_config: Dict[str, Any]) -> None:
|
||||||
super().__init__(config, protection_config)
|
super().__init__(config, protection_config)
|
||||||
|
Loading…
Reference in New Issue
Block a user