- ago
When I choose Profit for the Metric Name everything works fine, but when I start using the new Expectancy Ratio in Build 23 (Power Pack Build 14) as a filter, I am getting the following massage:

7 Replies



- ago
I think the root cause for this error lies in the fact that the metric "Expectancy Ratio" returns no result (double.NaN) if there are no trades in a backtest.

And with the huge number of parameters in your case, there are certainly a lot of parameter combination which result in no trades.

From here you have several options:

1. Use a different metric (which returns 0.0 if there are no trades) to find interesting parameter regions. Then restrict the parameter ranges (Start and Stop values) to reduce the probability of hitting a no-trades backtest.

2. Use a different optimizer algorithm which does not need a target metric (like Random) to find some working parameter combinations and restart from there with reduced parameter ranges (see above)

3. Ask WL8 Support to make "Expectancy ratio" return 0.0 if there are no trades.

4. Use the Formula ScoreCard (part of the finantic.ScoreCards extension) to create your own version of "Expectancy Ratio" which is coded in a way to return 0.0 if there are no trades.

Option 4 looks like this:
 ( 34.90% )
- ago
...WL8 Support to make "Expectancy ratio" return 0.0 if there are no trades.
This seems perfectly reasonable to me. Done for Build 24 unless someone can predict a side effect.
- ago
Could you please check other metrics for backtests without trades.
Many of them should return 0.0 instead of double.NaN if there are no trades.

This makes a big difference for optimizers like Shrinking Window or SMAC which use a target metric.
- ago
Which metrics specifically do you think should return 0? We need to be careful here not to distort them.
- ago
Basic ScoreCard:
Sharpe Ratio
Sortino Ratio
Avg Profit
Avg Profit %
Profit Factor
Payoff Ratio
Avg Bars Held
Avg Bars held as % of...
NSF Ratio
Recovery Factor

Profitable Positions: (see above)
Unprofitable Positions: (see above)

Extended Scorecard
Luck Coefficient
Performance Ratio
Pesssicmistoic rate of Return
Median Profit
Median Profit %
Ulcer Performance Index
Risk of Ruin

For mathematicians it is a complicated matter to calculate x/y with x -> 0 and y -> 0.
For performance metrics it is often practical and somehow correct to return 0.0 if there are no trades.

For example, a reward to risk ratio should be 0.0 if there is no reward, no matter what risk.
 ( 85.94% )
- ago
Good news! In Build 24, the metrics that are read by the Optimizer (the OptimizationResults class) will be stored as zeroes if they come in as Double.NaN.

This allows us to preserve the NaNs for Visualizers, but makes it easier to compare the metrics for Optimizers.
Best Answer
- ago
Very, very good Solutuon!