Optimization

Backtest optimization splits into two: signal parameters of the strategy (indicators and conditions for buy / long, sell / short) and execution parameters (TP/SL, position, risk). Each side is covered separately—how to think about ranges, search, and validation.

Backtest optimization involves defining search ranges for strategy and execution-related parameters, running multiple backtests on historical data for comparison, and selecting parameter combinations with better performance. Backtest optimization can be roughly divided into two modules: first, strategy signal parameters (determining when to buy/long and when to sell/short), and second, execution parameters (take-profit, stop-loss, position sizing, and other trading and risk control logic). The two can be optimized separately or combined (while controlling overfitting). Before optimization, recommend completing at least one Create Backtest and analyzing results, then targeting optimization on modules needing improvement; for backtest concepts, see Backtest Basics.


Optimization Content Overview

ModuleOptimization TargetImpact ScopeConfiguration Location
Strategy parametersIndicator periods, thresholds, and comparisons that buy / sell conditions depend onWhen buy / long fires, when sell / short fires; signal frequency and qualityStrategy Library: Conditions, Indicators
Execution-config parametersPosition, stop-loss / take-profit, max drawdown, scale-in, etc.Per-trade size, exit method, and risk ceilingPer-pair Execution Config

Can optimize only one category (e.g., first fix execution parameters and only optimize strategy signal parameters), or optimize both; if optimizing simultaneously, recommend controlling parameter count and doing out-of-sample validation to avoid overfitting. Below we explain typical parameters and optimization approaches for the two modules separately.


Module 1: Strategy Signal Parameter Optimization

This module adjusts indicator parameters and condition thresholds that buy/long and sell/short signals depend on, affecting "when to enter positions and when to close positions," without changing execution-level take-profit, stop-loss, and position sizing.

What to Optimize

Strategy signals consist of Condition Combinations and Technical Indicators, etc.; typically optimizable items are:

  • Indicator Period / Length: Such as fast/slow MA periods (5, 20 in MA5/MA20), RSI period, MACD fast/slow line and signal line periods, etc.; larger periods mean fewer, smoother signals, smaller periods are more sensitive.
  • Indicator Thresholds: Such as RSI overbought/oversold (70/30), MACD golden/death cross determination conditions, Bollinger Band width or breakout thresholds, etc.; determine when conditions are judged as met.
  • Multi-Condition Combinations: If strategy consists of multiple AND/OR conditions, can adjust each condition's threshold or add/remove filter conditions (requires modifying logic in strategy editing, some systems also support optimizing parameters within conditions).

Above parameters are typically set in strategy's "Conditions" and "Indicators" configuration; during backtest optimization, select parameters to optimize in the system and set ranges (if supported).

Typical Parameters and Range Considerations

Parameter TypeExampleRange and Step Size Considerations
MA / Period TypesFast line period, slow line period (e.g., MA5/MA20)Fast line < slow line; e.g., fast line 5–20, slow line 20–60, step 5; larger periods mean fewer signals
Indicator ThresholdsRSI overbought/oversold (e.g., 70/30)Search within commonly used ranges, e.g., overbought 65–80, oversold 20–35, step 5; avoid extreme values (e.g., 95/5)
MACD etc.Fast line, slow line, signal line periodsSet reasonable ranges according to indicator specifications; larger periods are smoother
Time-RelatedIndicator calculation period, periods in multi-timeframe conditionsAlign with Timeframes; shorter periods mean more combinations and slower calculation

Recommend optimizing only 1–2 parameters with greatest impact on signals at a time (such as MA slow line period, RSI oversold threshold), determine better ranges before considering others; avoid changing too many at once to prevent overfitting.


Module 2: Execution Parameter Optimization

This module adjusts execution and risk control logic such as take-profit, stop-loss, position sizing, and max drawdown, affecting "how much position per trade, when to take profit/stop loss, overall drawdown limit," etc., without changing the strategy's buy/sell signal conditions.

What to Optimize

Execution config is detailed in Execution Config; the backtest simulates orders and risk control based on these settings. Typical optimizable items:

  • Stop-Loss: E.g., percentage stop-loss (3%, 5%) or other rules; too tight leads to frequent stops, too wide increases drawdown.
  • Take-Profit: E.g., percentage take-profit (8%, 15%) or trailing take-profit; together with stop-loss affects profit/loss ratio and holding time.
  • Position Sizing: Proportion of capital per trade (e.g., 20%, 50%); larger positions amplify both returns and drawdown volatility.
  • Max Drawdown Limit: If system supports, pause or reduce position when drawdown reaches a threshold; can be treated as risk control ceiling tuning.

Adjust above parameters individually or in combination during backtest optimization, observe changes in returns, drawdown, Sharpe, etc.; must match strategy style (e.g., short-term strategies often use tighter stops and should avoid oversized positions).

Typical Parameters and Range Considerations

Parameter TypeExampleRange and Step Size Considerations
Stop-LossPercentage stop-loss (e.g., 3%, 5%)Set range by underlying volatility, e.g., 2%–8%; too small gets shaken out easily, too large means large single-trade loss
Take-ProfitPercentage take-profit (e.g., 8%, 15%)E.g., 5%–20%; can consider profit/loss ratio with stop-loss (e.g., take-profit/stop-loss > 1.5)
Position SizingSingle-trade position ratio (e.g., 30%)E.g., 10%–50%; align with risk tolerance, avoid single-trade overweight
Max DrawdownDrawdown threshold triggering reduce/pauseIf system supports, can set 10%–20%, etc.; must match strategy drawdown characteristics

Recommend first fixing strategy signal parameters and only optimizing execution parameters (or optimize strategy signals first then execution) for easier attribution; if optimizing both execution and strategy parameters, be sure to control total parameter count and do out-of-sample validation.


Optimization Objectives and Methods

Optimization Objectives

Whether optimizing strategy signal or execution parameters, need to choose an optimization objective (which metric defines "better"); objectives often trade off (e.g., pursuing highest returns often comes with larger drawdowns).

Objective TypeCommon ObjectivesNotes and Trade-offs
Single ObjectiveMaximize total return / annualized returnPursuing returns, drawdown may be larger
Minimize maximum drawdownPrioritize risk control, returns may be lower
Maximize Sharpe ratioRisk-adjusted returns, balanced in most scenarios
Multi-Objective / CompositeReturn + drawdown composite scoreIf system supports, can balance return and risk

Selection advice: When more concerned about maximum loss tolerance in live trading, prefer "minimize max drawdown" or "maximize Sharpe"; when more concerned about returns and can accept some drawdown, prefer "maximize return." Multi-objective options depend on actual system.

Optimization Methods

MethodDescriptionUse Case
System auto-optimizationIn the UI, pick parameters to optimize (from the strategy or execution config), set range and step, choose the objective; the system iterates / searches and backtests, returning a result list or the best comboMany parameters, want fast comparison; the actual search method is whatever the system ships
Manual optimizationEdit conditions / indicators in the Strategy Library, or adjust the execution config when re-creating a backtest, run several Create Backtest + Result Analysis, compare and pick a better comboFew parameters, or the system has no auto-optimization; controllable but time-consuming

In results, look not only at the "best" set but also stability and acceptable drawdown of top sets; if the best set has extreme parameters and is clearly better than the rest, overfitting risk is higher.


Parameter and Range Settings (General)

  • Which parameters: Prefer parameters with large impact on performance and uncertain values; optimize 1–3 at a time to avoid combinatorial explosion and overfitting. Can do strategy signal optimization first, then execution parameters, or only one category.
  • Range and step size: Range should cover reasonable interval, avoid extremes; step too large may miss good solutions, too small increases computation. Can refer to strategy docs, historical backtests, or common industry ranges.
  • Fix other conditions: During optimization, keep Backtest Configuration (time range, trading pair, initial capital, fees, slippage) unchanged; only vary parameters being optimized for meaningful comparison.

Result Analysis and Validation

  • What to look at: After optimization, use Backtest Results Analysis to review returns, drawdown, Sharpe, etc., for each combination; look at top sets for stability and acceptable drawdown, not just the single best.
  • Out-of-sample validation: Run 1–2 more Create Backtest with time periods not used in optimization or another trading pair; if performance degrades noticeably, narrow ranges or reduce parameter count.
  • Re-validate before live: Run Paper Trading for a period, then go Live and Monitor performance.

Usage Recommendations

  • Single backtest before optimization: Do one Create Backtest and Result Analysis first, confirm logic and direction are reasonable, then optimize strategy signals or execution parameters.
  • Optimize the two modules separately: First fix execution parameters and only optimize strategy signal parameters (or vice versa) for easier attribution; if optimizing both, control total parameters and do out-of-sample validation.
  • Always do out-of-sample validation: Backtest on different time periods or trading pairs to check robustness.
  • Record and reproduce: Record parameter ranges, objectives, best combination, and backtest configuration at the time for reproduction and comparison.

Common Questions

Can strategy signal and execution parameters be optimized together?
Yes, but total parameters increase and overfitting risk is higher. Recommend optimizing one category first (e.g., strategy signals then execution), or pick 1–2 most critical parameters from each and do out-of-sample validation.

Good backtest after optimization but poor live performance?
Often overfitting. Solutions: narrow ranges, reduce parameters, do out-of-sample validation, and use Paper Trading before going live.

Which optimization objective to choose?
Risk-focused: "minimize max drawdown" or "maximize Sharpe"; return-focused: "maximize return." No single answer; align with your risk preference.

The system doesn't have auto-optimization—now what?
Manually edit conditions / indicators in the Strategy Library, or adjust the execution config when re-creating a backtest; run Create Backtest and Result Analysis several times and pick the better combo by comparison.

Optimization takes too long?
Shorten backtest time range, increase step size, or reduce number of parameters to optimize; run a small trial first then expand.


Next steps