mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-08 17:01:15 +00:00
Add trailing stoploss hyperspace
This commit is contained in:
@@ -8,7 +8,7 @@ import math
|
||||
from abc import ABC
|
||||
from typing import Dict, Any, Callable, List
|
||||
|
||||
from skopt.space import Dimension, Integer, Real
|
||||
from skopt.space import Categorical, Dimension, Integer, Real
|
||||
|
||||
from freqtrade import OperationalException
|
||||
from freqtrade.exchange import timeframe_to_minutes
|
||||
@@ -174,6 +174,20 @@ class IHyperOpt(ABC):
|
||||
Real(-0.35, -0.02, name='stoploss'),
|
||||
]
|
||||
|
||||
@staticmethod
|
||||
def trailing_space() -> List[Dimension]:
|
||||
"""
|
||||
Create a trailing stoploss space.
|
||||
|
||||
You may override it in your custom Hyperopt class.
|
||||
"""
|
||||
return [
|
||||
Categorical([True, False], name='trailing_stop'),
|
||||
Real(-0.35, -0.02, name='trailing_stop_positive'),
|
||||
Real(0.01, 0.1, name='trailing_stop_positive_offset'),
|
||||
Categorical([True, False], name='trailing_only_offset_is_reached'),
|
||||
]
|
||||
|
||||
# This is needed for proper unpickling the class attribute ticker_interval
|
||||
# which is set to the actual value by the resolver.
|
||||
# Why do I still need such shamanic mantras in modern python?
|
||||
|
||||
Reference in New Issue
Block a user