Appearance

Personalize your experience

Mode
Accent Color
Direction
Parameter Optimization

Parameter Optimization

Backtesting

A sweep backtests every combination of a parameter grid on the same data and costs and ranks them. Used well it shows how sensitive a strategy is to its settings; used badly it manufactures a backtest.

How a sweep runs

StrategyHow the grid runs
SQL rulesone query for the whole grid (the combinations are partitions); 30 combinations of 100,000 bars took about 1.4 s in the engine tests
Builder (DSL), QuaScript, Python, , JavaScript, C++every combination is a full backtest, four at a time; C++ compiles once and runs many times

Up to 2,000 combinations per , 500 per walk-forward and 300 for the overfitting report. The whole sweep costs one credit.

Objectives

ObjectiveRewardsWatch out for
return per unit of volatilitystrategies that rarely trade can look
return per unit of downside volatilitysame, and very few losing bars inflate it
CAGR per unit of one decides it
Total return / CAGRraw profitleverage and risk are ignored
gross profit / gross lossa handful of gives extreme values

Read the shape, not the top row

  • Heatmap (two parameters): a broad green region means the idea works across settings. A single bright surrounded by red is noise you fitted.
  • Neighbour / best: the mean objective of the best combination's grid neighbours divided by its own. Above 0.8 is a plateau; below 0.5 is a spike.
  • Choose from the middle of the plateau, not its peak: markets move the optimum, and the middle survives the move.
  • Keep the grid . Every extra combination is another chance to find a lucky one; the overfitting report quantifies this.
!
Caution:The best parameters of a are an result. them with walk-forward analysis before trusting them.

Through the API and the SDKs

POST /backtest/engine/sweep
{
  "data": { "kind": "historical", "exchange": "NSE", "symbol": "INFY", "interval": "1d", "from": "2018-01-01" },
  "strategy": { "language": "dsl", "dsl": { "...": "builder document" } },
  "grid": { "entry.signals.0.conditions.params.period": [7, 10, 14, 21],
            "exit.stopLoss.value": [2, 3, 4] },
  "sortBy": "sharpe"
}
quatick.optimize
from quatick import optimize
res = optimize.grid_search(strategy, bars, {"fast": [5, 10, 20], "slow": [40, 80, 120]}, objective="sharpe", n_jobs=8)
print(res.table(5))
print(optimize.parameter_stability(res))          # neighbour mean / best
rnd = optimize.random_search(strategy, bars, {"fast": (3, 30), "slow": (30, 200)}, n=200)

See also

Related articles

  • Python: Research Toolkit

    Backtesting / SDKs / Python

    Everything after the first backtest: tearsheet analytics, multi-asset portfolios, position sizing, optimization and walk-forward, overfitting tests, Monte…

  • Liquidity Heatmap

    Trading / Order Book / Views

    Resting size at every price, over time — where liquidity has been sitting, not just where it is now.

  • Step 7 — Strategy Testing

    Automation / Strategy Builder / Wizard Steps

    The testing step offers three modes, each answering different questions about strategy behavior. Use all three in sequence: backtest to validate logic,…

  • Strategy DSL — Execution Model

    Coding / Strategy DSL

    What the engine does on every bar: protective exits, exit signals, entries, layers and re-entries, sizing and costs, and where every statistic in the result…

  • Backtesting in Python and C++

    Backtesting / SDKs

    The quatick Python package and the header-only C++ library let you import indicators, backtest on your own machine and send the same file to Quatick.…

  • Backtesting Methodology

    Backtesting / Methodology

    What a backtest is actually evidence of, the assumptions built into it, how much data is enough, and the procedure that makes a result worth acting on.

  • C++ SDK Reference

    Backtesting / SDKs / C++

    Header-only C++20 (packages/quatick-backtest-cpp): the position simulator, an event-driven engine with the same order rules as Python, analytics, a parallel…

  • Execution Modelling

    Backtesting / Execution Modelling

    Commission, slippage, spread and fill assumptions — the difference between a backtest that means something and one that flatters. Costs are where most…

  • From Backtest to Live

    Backtesting / Going Live

    The staged path from a validated backtest to full size, what each stage can detect that the previous one cannot, and the monitoring that tells you when to stop.

Browse all knowledge base articles →