Add penality for bad risk reward
This commit is contained in:
@@ -189,6 +189,19 @@ public class BacktestScorer
|
||||
result.AddPenaltyCheck("HODL Underperformance", newMultiplier, $"Underperforming HODL by {hodlUnderperformance:F2}% applied {hodlPenalty:F1}% penalty");
|
||||
}
|
||||
|
||||
// 9. Money Management Risk/Reward Penalty (Dynamic)
|
||||
if (p.MoneyManagement != null && p.MoneyManagement.StopLoss > 0 && p.MoneyManagement.TakeProfit > 0)
|
||||
{
|
||||
var riskRewardRatio = (double)(p.MoneyManagement.TakeProfit / p.MoneyManagement.StopLoss);
|
||||
if (riskRewardRatio <= 1.0) // If Risk/Reward ratio is not above 1:1
|
||||
{
|
||||
var riskRewardPenalty = (1.0 - riskRewardRatio) * 0.5; // 50% penalty per 0.1 ratio below 1.0
|
||||
var newMultiplier = Math.Max(0.2, 1 - riskRewardPenalty);
|
||||
penaltyMultiplier *= newMultiplier;
|
||||
result.AddPenaltyCheck("Poor Risk/Reward Ratio", newMultiplier, $"Risk/Reward ratio of {riskRewardRatio:F2}:1 below 1:1 threshold applied {riskRewardPenalty:F1}% penalty");
|
||||
}
|
||||
}
|
||||
|
||||
return baseScore * penaltyMultiplier;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user