From 3cce668353322e3d134b94442d218141e22286b5 Mon Sep 17 00:00:00 2001 From: Bruno Gouvea Date: Tue, 8 Jun 2021 02:57:44 -0300 Subject: [PATCH] Creating a control variable to determine the existence of max drawdown in the final result. --- freqtrade/optimize/hyperopt_tools.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/freqtrade/optimize/hyperopt_tools.py b/freqtrade/optimize/hyperopt_tools.py index a739ab9b9..eaea4aa4a 100644 --- a/freqtrade/optimize/hyperopt_tools.py +++ b/freqtrade/optimize/hyperopt_tools.py @@ -222,10 +222,12 @@ class HyperoptTools(): # Ensure compatibility with older versions of hyperopt results trials['results_metrics.winsdrawslosses'] = 'N/A' + has_drawdown = True if 'results_metrics.max_drawdown_abs' not in trials.columns: # Ensure compatibility with older versions of hyperopt results trials['results_metrics.max_drawdown_abs'] = None trials['results_metrics.max_drawdown'] = None + has_drawdown = False legacy_mode = True @@ -278,7 +280,7 @@ class HyperoptTools(): stake_currency = config['stake_currency'] - if not legacy_mode: + if has_drawdown: trials['Max Drawdown'] = trials.apply( lambda x: '{} {}'.format( round_coin_value(x['max_drawdown_abs'], stake_currency),