LEARN · EN · easyquanttrading.com

CTA template sweep: the reproducible baseline

Most strategy search is presented as if the algorithm were the interesting part. It usually is not. A template sweep — running a fixed library of well-known CTA rules across a parameter grid — is the least glamorous method available, and it is the one you should run first. It cannot invent a rule you did not write, but everything it produces is deterministic, reproducible and explainable, and it gives you a baseline against which every cleverer method must justify itself.

What a template sweep actually is

A template is a hand-written rule shape with named parameters. A dual moving-average crossover has a fast period and a slow period. A Donchian breakout has a channel lookback. A volatility-targeted position rule has a target volatility, an estimation window and a leverage cap. The rule's structure — what it looks at, and how it decides — is fixed before the search starts.

The sweep then enumerates or samples that parameter space: every combination of fast and slow in some grid, every channel lookback in a range. Each combination produces a candidate. Nothing about the rule's logic changes; only the numbers move.

This is worth stating plainly because it is routinely confused with something else. A template sweep is not a search for a strategy. It is a search for the best parameters of strategies you already specified.

Why determinism is the underrated property

The same dataset and the same parameters produce the same signals, every time. That sounds trivial. It is not, and it is the property most other search methods lack.

With a stochastic search, two runs on identical data can produce structurally different results. You then cannot tell whether a change in outcome came from your change or from the seed. With a deterministic sweep, any difference between two runs is caused by something you did.

Determinism also makes a result auditable months later. A candidate is fully described by its template name and its parameter dictionary — no hidden state, no serialised model file, no ambiguity about which run produced it. If someone disputes a result, they can re-run it exactly.

What it cannot do

  • It cannot discover structure. If the profitable behaviour is not expressible by a rule in the library with some choice of parameters, no amount of sweeping will find it. The search space simply does not contain the answer.
  • It inherits every assumption of its library. A library of trend and mean-reversion rules over price and indicators cannot express a rule based on order-flow, cross-asset relationships, or anything not represented in its feature set.
  • It is exposed to selection bias like any other search. Sweeping 500 parameter combinations is 500 trials. The best of them is the maximum of 500 draws, and reporting it without a trial-count correction overstates the evidence.

Selection bias is the real risk, not opacity

Because template sweeps are transparent, people tend to assume they are safe. The opposite is true: transparency makes the overfitting easier to miss, because each individual result looks reasonable and explainable.

A rule that says 'buy when the 20-period average crosses above the 60-period average' is perfectly intelligible. That intelligibility does not stop the choice of 20 and 60 from being a fitted choice. The rule reads like a hypothesis; a swept parameter set is a fitted artefact wearing the clothes of a hypothesis.

The discipline is the same as anywhere else: count the trials, hold data out, and check whether performance is robust in a neighbourhood of the chosen parameters rather than only at the optimum. A parameter set that works at 20 and 60 but fails at 18 and 58 is a description of the sample, not a finding.

Where a sweep belongs in a research pipeline

  • First, as a baseline. Run the standard library before anything cleverer. If an evolutionary search cannot beat a plain moving-average crossover after honest validation, the complexity is not earning its place.
  • Second, as an interpretable reference. When a structure search produces something opaque, a comparable template result gives you a legible point of comparison.
  • Third, as a feature probe. Which templates survive across symbols and timeframes tells you something about the data before you build anything elaborate on top of it.

How this works in EasyQuant

EasyQuant ships a CTA template library with a parameter sweep alongside its evolutionary engines. Two design choices are worth naming, because both are about honesty rather than capability.

First, template candidates are stored as reproducible parameter dictionaries, not as opaque objects. A candidate is fully described by its template key and parameters, so it can be re-run and independently checked rather than taken on trust. Second, template candidates pass through the same validation pipeline as everything else — a strategy is not treated as more trustworthy for having come from a readable rule.

There is also an explicit limit written into how we describe volatility targeting: it scales order quantity as a risk budget. It is not a full target-position rebalancer, and we do not describe it as one. And the underlying data is CFD or spot bars, not continuous futures contracts — we do not claim institutional CTA returns for a rule swept on retail CFD data.

FAQ

Is a template sweep the same as a genetic algorithm?
Both search parameters rather than structure, so they share the same ceiling. A GA samples the space stochastically and can cycle; a sweep is deterministic and exhaustive over whatever grid you define. For small parameter spaces a sweep is usually more informative because it shows you the whole landscape rather than one trajectory.
Then why use an evolutionary algorithm at all?
Because some problems have structure worth searching: expression shapes, rule sets, network topology. If your hypothesis is genuinely a known rule shape, evolution buys you nothing and costs you reproducibility.
How large a parameter grid is too large?
There is no threshold, because the issue is not size but disclosure. A large grid is fine if you correct the final statistic for the number of trials. The failure mode is sweeping thousands of combinations and reporting the winner as if it were a single test.
Does determinism mean the result is correct?
No. Determinism means the computation is reproducible; it says nothing about whether the rule generalises. A deterministic sweep of a bad hypothesis produces a reproducible bad result.
Should I trust a template result more than an evolved one?
You can understand it better, which is a different thing. Interpretability is not evidence. The template advantage is that you can audit the logic and the parameter sensitivity, not that it is more likely to work.

More guides

Not investment advice. Historical results do not guarantee future performance. EasyQuant is a research factory — you execute on accounts you control.