freqtrade机器人 参数优化之 自定义止损范围 和 ROI

from freqtrade.optimize.space import Categorical, Dimension, Integer, SKDecimal, Real
from typing import List

class MyAwesomeStrategy(IStrategy):
    class HyperOpt:
        # Define a custom stoploss space.
        def stoploss_space():
            return [SKDecimal(-0.05, -0.01, decimals=3, name='stoploss')]

        # Define custom ROI space
        def roi_space() -> List[Dimension]:
            return [
                Integer(10, 120, name='roi_t1'),
                Integer(10, 60, name='roi_t2'),
                Integer(10, 40, name='roi_t3'),
                SKDecimal(0.01, 0.04, decimals=3, name='roi_p1'),
                SKDecimal(0.01, 0.07, decimals=3, name='roi_p2'),
                SKDecimal(0.01, 0.20, decimals=3, name='roi_p3'),
            ]

详细说明:

https://www.freqtrade.io/en/stable/advanced-hyperopt/

https://github.com/freqtrade/freqtrade/blob/develop/docs/advanced-hyperopt.md

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

92 − = 87