use profit_abs

This commit is contained in:
sid 2021-10-07 08:07:07 +05:30
parent 93e4cf4006
commit 46c320513a

View File

@ -32,9 +32,9 @@ class MaxDrawDownHyperOptLoss(IHyperOptLoss):
Uses profit ratio weighted max_drawdown when drawdown is available. Uses profit ratio weighted max_drawdown when drawdown is available.
Otherwise directly optimizes profit ratio. Otherwise directly optimizes profit ratio.
""" """
total_profit = results['profit_ratio'].sum() total_profit = results['profit_abs'].sum()
try: try:
max_drawdown = calculate_max_drawdown(results) max_drawdown = calculate_max_drawdown(results, value_col='profit_abs')
except ValueError: except ValueError:
# No losing trade, therefore no drawdown. # No losing trade, therefore no drawdown.
return -total_profit return -total_profit