Custom Criteria - TotalTrades > X  [SOLVED]

Questions about MultiCharts and user contributed studies.
shane1800
Posts: 80
Joined: 28 Feb 2014
Has thanked: 5 times
Been thanked: 5 times

Custom Criteria - TotalTrades > X

Postby shane1800 » 17 Mar 2014

Hi,

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);

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2944 times

Re: Custom Criteria - TotalTrades > X  [SOLVED]

Postby Henry MultiСharts » 21 Mar 2014

Hello shane1800,

When TotalTrades is too low the output results are too low as well.
For example TotalTrades = 10, then p = 20, but L = 1 / 485165196.41
When TotalTrades = 50 then the output results are more significant.

shane1800
Posts: 80
Joined: 28 Feb 2014
Has thanked: 5 times
Been thanked: 5 times

Re: Custom Criteria - TotalTrades > X

Postby shane1800 » 21 Mar 2014

I think it get it somewhat. Will trust it and use. Thank you.


Return to “MultiCharts”