Pillinger Works

Strategy Optimization

ExpertE-034
Ready to move forward?

You can explore the materials without registering, but with a free account you can track your progress and earn rewards along the way. By the end of your learning journey, you can have the knowledge you need to become a profitable Trader!

Join →

Introduction

Strategy optimization is the process of deliberately changing defined strategy parameters or rules to improve a specified research objective. In professional research, optimization is not the same as making a backtest look better.

Optimization can be useful. A stop may be too wide, a holding period may be economically unreasonable, or a filter may have a clearly defined purpose. The danger begins when historical data becomes a feedback machine: change a rule, inspect the result, keep the change if it helps, and repeat until the past looks excellent.

The central question is therefore not “Can I improve the backtest?” but “Can I improve the strategy without merely fitting it more closely to the research sample?”

1. What Optimization Actually Means

Optimization means searching a defined set of alternatives according to a defined objective.

Examples:• comparing stop distances;• testing a small predefined range of lookback periods;• comparing two exit rules;• selecting among a limited set of position-sizing methods.

The research process must define the search space and objective before interpreting the outcome. Otherwise “optimization” can become unrestricted experimentation.

2. Improvement vs. Fitting

An optimized strategy improves historical performance. That fact alone says nothing about why it improved.

There are two broad possibilities:

1. The change captures a real feature of the trading mechanism.2. The change captures accidental characteristics of the sample.

The first is useful improvement. The second is fitting.

The distinction can only be investigated through disciplined validation, stability analysis and control of research freedom.

3. Define the Optimization Objective

Never optimize “everything.”

Choose the property that the research question actually cares about.

Possible objectives:• expectancy;• net expectancy after costs;• drawdown;• return relative to drawdown;• trade frequency;• stability across subperiods;• a combination defined before the search.

A strategy optimized for maximum historical profit may behave very differently from one optimized for stable expectancy and controlled drawdown.

4. Single-Metric Optimization Is Dangerous

If you optimize only one number, the process will naturally search for ways to improve that number.

Maximum net profit may favor a few exceptional trades.Maximum win rate may encourage tiny winners and large losses.Maximum Profit Factor may become unstable when gross loss is small.Minimum drawdown may produce an under-traded system.

Use a primary objective plus predefined secondary diagnostics. The goal is not to make every metric perfect; it is to understand the trade-offs.

5. Define a Reasonable Search Space

A research parameter should have an economic or structural reason to exist.

For example, testing a moving-average period from 20 to 50 may be defensible if the strategy concerns medium-term trend behavior. Testing 20, 20.1, 20.2 … 50.0 simply because software allows it creates enormous search freedom without necessarily adding economic information.

The search space should be broad enough to investigate the hypothesis and narrow enough to remain interpretable.

6. Parameter Sensitivity

After optimization, examine what happens around the selected value.

Suppose the best historical result occurs at parameter 37.

If 36, 38, 39 and 40 produce broadly similar behavior, the result may be less dependent on one exact value.

If 37 is exceptional while nearby values collapse, the optimization may have found a local historical accident.

A parameter table or heatmap can make this visible, but the underlying idea is simple: look for a stable region, not a magical number.

7. Optimization Plateaus

A plateau is a broad region of parameter values producing similar results.

Plateaus are often more informative than isolated peaks because they suggest the strategy is not dependent on extreme precision.

For example:

Parameter 30–45 → similar positive expectancy.Parameter 37 → absolute maximum.

The maximum itself is less important than the shape of the surrounding region.

8. Optimize Rules, Not Just Numbers

Overfitting can occur through logic as well as numerical parameters.

Examples:• adding a second confirmation condition;• changing an exit after observing losses;• excluding certain days;• adding an event filter because it improves history;• changing the universe to remove weak instruments.

A rule change can provide more research freedom than changing one numerical parameter. Record both.

9. In-Sample Optimization

Optimization should generally be performed within a defined development sample.

The purpose of in-sample research is to learn about the candidate strategy and make controlled design decisions.

The moment the optimized specification is frozen, the information boundary matters. The next unseen sample should evaluate the result rather than continue optimizing it.

10. Out-of-Sample Evaluation

An optimized strategy must be evaluated on data that did not determine the final specification.

Example:Before optimization: +0.18R expectancy.After development optimization: +0.34R.OOS: +0.20R.

The historical improvement is real as a measured development result, but the OOS result is the more important evidence for whether the improvement transferred beyond the development sample.

If OOS collapses, the optimization may have captured sample-specific structure.

11. Walk-Forward Optimization

Walk-forward optimization repeats the process through time:

Development window → parameter selection → next unseen evaluation window → move forward.

This allows the researcher to study whether parameter selection remains useful as the market changes.

Important: walk-forward optimization does not eliminate overfitting. The optimization rules, search space, objective and selection method can themselves be overfit.

12. Optimization and Data Snooping

Every additional research decision is another opportunity to learn from the same historical data.

Testing ten parameters is one form of search.Testing ten parameters with five exits and three filters is a much larger search.

If the final strategy is selected because it performed best among many attempts, the headline result does not reveal how much searching was required to obtain it.

Keep a research log and record failed as well as successful candidates.

13. Optimization and Sample Size

A small sample gives the optimizer fewer observations and therefore more opportunity to mistake noise for structure.

If a strategy has only 60 trades, a parameter that happens to improve three unusual winners can materially change the score.

Larger samples do not guarantee validity, but they usually provide more information for distinguishing stable behavior from isolated outcomes.

Always ask how many trades actually influenced the optimization.

14. Optimize the Distribution, Not Only the Average

A change can improve average expectancy while making the distribution worse.

Compare:• average R;• median R;• large-winner dependence;• large-loss frequency;• loss clustering;• drawdown;• trade frequency.

Example:Version A: +0.20R expectancy with moderate dispersion.Version B: +0.27R expectancy, but most profit comes from two +12R trades.

Version B has a higher historical average, but the research question should investigate whether the underlying edge actually improved.

15. Optimization and Drawdown

Drawdown can be an optimization objective, a constraint, or a diagnostic.

For example, instead of maximizing profit without limits, the research protocol might require:• positive net expectancy;• maximum drawdown below a predefined level;• sufficient trade count;• no extreme dependence on one winner.

This changes the optimization problem from “find the biggest number” to “find an acceptable region of strategy behavior.”

16. Costs Must Be Inside the Optimization

If costs are ignored during optimization, the optimizer may prefer strategies that trade too frequently or rely on marginal price differences.

Include realistic:• commissions;• spread;• slippage;• liquidity assumptions.

Be careful with uncertain cost estimates. Overly optimistic assumptions can create another form of fitting.

17. Case Study — The Perfect Parameter

A trader optimizes a breakout lookback from 10 to 100 and finds that 63 produces +0.52R expectancy.

The nearby values are:

60 → +0.24R61 → +0.31R62 → +0.28R63 → +0.52R64 → +0.25R65 → +0.30R

The peak is striking. The surrounding region is not.

The trader should not automatically conclude that 63 is the correct parameter. The shape suggests that the exact maximum may be sample-specific. The next step is controlled validation and investigation of the mechanism.

18. Case Study — Useful Optimization

Another strategy has a fixed entry and two plausible stop definitions.

Stop A: −0.12R expectancy after costs.Stop B: +0.09R expectancy after costs.

The research question explicitly concerns which predefined stop mechanism better captures the strategy's volatility behavior. Both alternatives were specified before the comparison, and the final choice is frozen before OOS testing.

OOS then produces +0.07R with Stop B.

Here optimization was not unlimited curve fitting. It was a constrained research comparison followed by validation.

19. Professional Optimization Protocol

A practical protocol:

1. Define the research question.2. Define what is allowed to change.3. Define the search space.4. Define the objective and constraints.5. Freeze the data and cost assumptions.6. Run the predefined search.7. Record all meaningful candidates.8. Examine parameter stability.9. Examine distribution and drawdown.10. Select the candidate according to the predefined rule.11. Freeze the specification.12. Validate on unseen data.13. Record the OOS result without immediate retuning.14. If necessary, start a new research cycle with a new version.

20. Common Mistakes

• Optimizing until the equity curve looks perfect.• Searching huge parameter spaces without a hypothesis.• Selecting the best single number from a noisy surface.• Changing logic after seeing the result without recording it.• Optimizing on the validation set.• Ignoring costs.• Ignoring trade count.• Optimizing win rate alone.• Ignoring R-multiple distribution.• Ignoring drawdown.• Deleting failed candidates from the research record.• Treating optimization as proof of an edge.

21. Expert Exercise — Build an Optimization Map

Choose one parameter in a strategy.

Before testing, write:• why the parameter exists;• the economically reasonable range;• the step size;• the primary objective;• secondary diagnostics;• minimum sample;• maximum acceptable drawdown;• validation boundary.

Then map the result across the full range.

Do not immediately select the maximum. First inspect the shape.

Ask:“Is there a stable region, or did I find one historical peak?”

22. Knowledge Check

1. What is the difference between optimization and simply making a backtest better?2. Why must the optimization objective be defined in advance?3. Why can a single-metric objective be dangerous?4. What does parameter sensitivity tell you?5. Why are optimization plateaus informative?6. How can rule changes create more overfitting than numerical changes?7. Why must OOS data remain outside the optimization process?8. How does sample size affect optimization risk?9. Why should R-multiple distribution be inspected?10. What does a professional optimization protocol protect you from?

Key idea: optimization should search a defined, economically meaningful space for a better version of a hypothesis. It should not be a machine for repeatedly asking the past how to look better.