Skip to content

Commit

Permalink
update lamboloss
Browse files Browse the repository at this point in the history
  • Loading branch information
stash86 committed Dec 10, 2024
1 parent c4c878f commit 607f784
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions user_data/hyperopts/LamboLoss.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,23 @@ def hyperopt_loss_function(
# Return 0 because this is unwanted scenario
return 0

# if (nb_loss_trades == 0):
# return -total_profit * 100

loss_value = (
total_profit
* min(average_profit, max_avg_profit)
* profit_factor
* min(expectancy_ratio, max_expectancy)
* total_trades
/ (max_drawdown[0] * 1000)
)
if (max_drawdown.drawdown_abs == 0):
loss_value = (
total_profit
* min(average_profit, max_avg_profit)
* profit_factor
* min(expectancy_ratio, max_expectancy)
* total_trades
)
else:
loss_value = (
total_profit
* min(average_profit, max_avg_profit)
* profit_factor
* min(expectancy_ratio, max_expectancy)
* total_trades
/ (max_drawdown.drawdown_abs * 1000)
)

if (total_profit < 0) and (loss_value > 0):
return loss_value
Expand Down

0 comments on commit 607f784

Please sign in to comment.