adjust the hyperopt objective function to emphasize profit and allow more variation in trade counts

This commit is contained in:
Janne Sinivirta 2018-01-16 16:36:50 +02:00
parent 38fe7ec7cd
commit 501be8a3bc
1 changed files with 2 additions and 2 deletions

View File

@ -146,9 +146,9 @@ def log_results(results):
def calculate_loss(total_profit: float, trade_count: int, trade_duration: float):
""" objective function, returns smaller number for more optimal results """
trade_loss = 1 - 0.35 * exp(-(trade_count - TARGET_TRADES) ** 2 / 10 ** 5.2)
trade_loss = 1 - 0.25 * exp(-(trade_count - TARGET_TRADES) ** 2 / 10 ** 5.8)
profit_loss = max(0, 1 - total_profit / EXPECTED_MAX_PROFIT)
duration_loss = min(trade_duration / MAX_ACCEPTED_TRADE_DURATION, 1)
duration_loss = 0.7 + 0.3 * min(trade_duration / MAX_ACCEPTED_TRADE_DURATION, 1)
return trade_loss + profit_loss + duration_loss