mkajnar / DailyBuyStrategy

GNU General Public License v3.0
26 stars 17 forks source link

hyperopt error #3

Closed Daniel595 closed 8 months ago

Daniel595 commented 8 months ago

Hey @mkajnar, thanks for sharing your strategie. I really enjoy it so far :-)

Im wondering if you're Hyperopting your Strategies inheriting from HPStrategy? I tried to hyperopt as I do usually using:

freqtrade hyperopt --hyperopt-loss SharpeHyperOptLossDaily --spaces roi stoploss trailing buy sell --strategy HPStrategyTFJPA --config /freqtrade/user_data/configs/hp_config.json --config /freqtrade/user_data/configs/static_pairlist.json --config /freqtrade/user_data/configs/whitelist_50.json -e 500 --timerange=20230101- 

I get an error:

2023-12-28 22:03:48,288 - freqtrade - ERROR - Fatal exception!
Traceback (most recent call last):
  File "/freqtrade/freqtrade/main.py", line 42, in main
    return_code = args['func'](args)
                  ^^^^^^^^^^^^^^^^^^
  File "/freqtrade/freqtrade/commands/optimize_commands.py", line 106, in start_hyperopt
    hyperopt = Hyperopt(config)
               ^^^^^^^^^^^^^^^^
  File "/freqtrade/freqtrade/optimize/hyperopt.py", line 98, in __init__
    self.hyperopt_pickle_magic(self.backtesting.strategy.__class__.__bases__)
  File "/freqtrade/freqtrade/optimize/hyperopt.py", line 156, in hyperopt_pickle_magic
    cloudpickle.register_pickle_by_value(sys.modules[modules.__module__])
                                         ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
KeyError: 'HPStrategy'

Did you ever faced this problem? Im using docker freqtrade:stable.

Also I'd be really interested in some hyperopt results if you're willing to publish them :-)

Thank you very much

Daniel595 commented 8 months ago

With some advices from the freqtrade discord channel I solved the problem by flattening the classes. Suddenly hyprtopting works. I also got the Hint that hyperopting of derived classes will drop the hyperopt params from the base classes.

May I ask for your practice of hyperopting? Thanks again :-)

mkajnar commented 8 months ago

Try this - it is flattened and working better than HPStrategy* childs . Of course it is hyperoptable... https://raw.githubusercontent.com/mkajnar/HighProfitStrategy/main/user_data/strategies/HPStrategyTFJPAConfirmV1.py

mkajnar commented 8 months ago

Best results on 5 m timeframe

mkajnar commented 8 months ago

We can cooperate together for better results. :)

Mcm5s commented 8 months ago

Iam gonna dry run HPStrategyTFJPAConfirmV1.

Maybe its an idea to make a discord?

mkajnar commented 8 months ago

Take new version HPStrategyTFJPAConfirmV1 - added combinations for more signals

mkajnar commented 8 months ago

Iam gonna dry run HPStrategyTFJPAConfirmV1.

Maybe its an idea to make a discord?

https://discord.gg/DRHuuHtD

mkajnar commented 8 months ago

Done