adjust the hyperopt objective function to emphasize profit and allow more variation in trade counts
This commit is contained in:
parent
38fe7ec7cd
commit
501be8a3bc
@ -146,9 +146,9 @@ def log_results(results):
|
|||||||
|
|
||||||
def calculate_loss(total_profit: float, trade_count: int, trade_duration: float):
|
def calculate_loss(total_profit: float, trade_count: int, trade_duration: float):
|
||||||
""" objective function, returns smaller number for more optimal results """
|
""" 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)
|
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
|
return trade_loss + profit_loss + duration_loss
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user