When running optimizations I would like to filter out systems that have less than x amount of total trades. While still seeing systems that have the highest NetProfit.
I'm guessing entering JS in the Custom Criteria place is the correct area to do this in?
I tried but was not able to get it working, then saw this thread with code but it's a bit over my head and looks like they adjust the total trade number and I'd rather have it be a firm threshold. Any advice appreciated.
viewtopic.php?f=5&t=8838&p=55855&hilit= ... ter#p55855
Code: Select all
if (StrategyPerformance.AvgWinningTrade == 0 || StrategyPerformance.AvgLosingTrade == 0) {
return 0; // Prevents division by zero
}
var netProfit = StrategyPerformance.NetProfit;
var percentProfitable = StrategyPerformance.PercentProfitable / 100;
var ratioWinLoss = StrategyPerformance.AvgWinningTrade / Math.abs(StrategyPerformance.AvgLosingTrade);
var profitFactor = StrategyPerformance.GrossProfit / Math.abs(StrategyPerformance.GrossLoss);
var m = 30;
var p = ( StrategyPerformance.TotalTrades - m^0.8 )*-1;
var L = 1/(1+Math.exp(p));
return (netProfit * percentProfitable * ratioWinLoss * profitFactor*L);