Main Page > Articles > Kelly Criterion > Optimal f and the Dangers of Curve Fitting

Optimal f and the Dangers of Curve Fitting

From TradingHabits, the trading encyclopedia · 5 min read · February 28, 2026
The Black Book of Day Trading Strategies
Free Book

The Black Book of Day Trading Strategies

1,000 complete strategies · 31 chapters · Full trade plans

Introduction

Optimal f, with its data-driven approach to position sizing, is a effective tool for maximizing geometric growth. However, its reliance on historical data also makes it susceptible to a common and insidious pitfall in quantitative finance: curve fitting. Curve fitting occurs when a model is overly optimized to fit a specific set of historical data, to the point where it loses its predictive power on new, unseen data. This article explores the dangers of curve fitting in the context of Optimal f, the statistical techniques that can be used to detect it, and the best practices for developing a robust and forward-looking Optimal f strategy.

The Allure and Peril of a Perfect Backtest

Curve fitting is a seductive trap for traders and quantitative analysts. It is the process of tailoring a model to the nuances of a historical dataset, often by adding more and more parameters, until the model produces a near-perfect backtest. The allure of a smooth, upward-sloping equity curve can be difficult to resist, but it is often an illusion. A curve-fit model is like a student who has memorized the answers to a specific set of questions but has not learned the underlying concepts. When presented with a new set of questions, the student will fail.

In the context of Optimal f, curve fitting can occur when the historical trade data used to calculate the Optimal f is not representative of the future performance of the trading system. This can happen if the historical period is too short, if it is characterized by a specific market regime that is unlikely to persist, or if the trading system itself has been overly optimized to the historical data.

Detecting Curve Fitting: Statistical Tools and Techniques

Fortunately, there are several statistical tools and techniques that can be used to detect curve fitting. One of the most common is out-of-sample testing. With this technique, the historical data is divided into two sets: an in-sample set, which is used to calculate the Optimal f, and an out-of-sample set, which is used to test the performance of the Optimal f on new, unseen data. A significant degradation in performance from the in-sample to the out-of-sample set is a red flag for curve fitting.

Another effective technique is the Monte Carlo simulation. With this technique, a large number of synthetic trade sequences are generated based on the statistical properties of the historical data. The Optimal f is then calculated for each of these synthetic sequences. If the calculated Optimal f values are highly variable, it is a sign that the Optimal f is not robust and is likely to be curve-fit.

A Walk-Forward Analysis Example

To illustrate the concept of out-of-sample testing, let's consider a walk-forward analysis. We have a historical trade sequence of 1,000 trades. We will divide this sequence into 10 segments of 100 trades each. We will use the first segment to calculate the Optimal f, and then we will test the performance of this Optimal f on the second segment. We will then use the second segment to recalculate the Optimal f, and test it on the third segment, and so on.

In-Sample SegmentOut-of-Sample SegmentIn-Sample ReturnOut-of-Sample Return
1225%15%
2330%12%
3420%18%
4515%10%
5622%14%
6728%16%
7818%12%
8924%15%
91026%17%

As the table shows, there is a consistent degradation in performance from the in-sample to the out-of-sample segments. This is a clear indication that the Optimal f is being curve-fit to the in-sample data.

Best Practices for a Robust Optimal f Strategy

To avoid the dangers of curve fitting, it is essential to follow a set of best practices when developing an Optimal f strategy:

  • Use a large and representative historical dataset. The more data, the better.
  • Avoid over-optimizing the trading system. A simple, robust system is better than a complex, curve-fit one.
  • Use out-of-sample testing and walk-forward analysis. This is the gold standard for detecting curve fitting.
  • Use a fractional f. This will reduce the sensitivity of the strategy to the precise value of the Optimal f.
  • Periodically recalculate the Optimal f. The market is constantly changing, and the Optimal f needs to be updated to reflect these changes.

Conclusion

Curve fitting is a significant danger in the application of Optimal f. The allure of a perfect backtest can lead traders to develop models that are overly optimized to historical data and that have no predictive power on new, unseen data. By using statistical tools such as out-of-sample testing and Monte Carlo simulation, and by following a set of best practices for robust model development, traders can avoid the dangers of curve fitting and develop an Optimal f strategy that is both profitable and forward-looking.