Como criar blocos, grupos e modelos StrategyQuant com IA

A StrategyQuant strategy is never conjured whole. The platform assembles it from parts you supply, then searches the combinations for something that works. Those parts stack in a fixed order — and I have built an AI skill for each layer of the stack, four in all. Together they make up the SQX Authoring Toolkit (the sqx-lab plugin). You describe the part you want in plain English; the matching skill authors a real, import-ready artifact, checked against your own installation. This is a practical guide to what the four skills do and how you build with them.

Why this matters now

We have reached a strange moment. Any AI can now produce something that reads like a trading strategy — a confident paragraph, a plausible rule, a block of code that sounds right. Almost none of it survives contact with a real engine. That gap — between output that looks correct and output that actually runs — is the whole problem, and it is exactly what this workflow is built to close.

Nothing here rests on the AI’s word. Every artifact is authored to be accepted by StrategyQuant itself, and the workflow ends where it should: in an actual AlgoWizard Build on real data. The platform — its parser, its builder, its backtesting engine — has the final say, not the model. A strategy either imports, builds and backtests, or it does not; there is no room for a plausible-looking answer that quietly fails.

That is the beautiful part of doing this today. Generation has become cheap; verification is everything. An AI that can generate a thousand strategies is a liability. One whose every output is answerable to a real backtesting engine is a tool you can actually trust — and it is why, in my own pipeline, the next step is an oracle that loads each artifact into a live StrategyQuant and lets the engine confirm it before I ever rely on it.

The idea: four layers, four skills

Everything in StrategyQuant is built from four kinds of part, each composed from the one before it:

  • custom block is a single trading rule — a signal, a filter, or a price level;
  • grupo aleatório pools blocks or atoms into a menu the builder draws one item from;
  • strategy template wires those pools into a buildable strategy shape;
  • projeto runs one or more templates as build tasks on real data.

Authoring each layer by hand is expert, click-heavy work that assumes deep knowledge of the platform. Each skill automates one layer — and because they compose in the same order, a single idea can travel from one rule all the way to a running build project without your writing a line of XML.

Layer Skill What it authors
Bloco sqx-custom-block A single trading rule — a signal, a filter, or a price level.
Group sqx-random-group A pool of blocks or atoms the builder samples one item from.
Modelo sqx-strategy-template A buildable .sqx strategy that wires groups into a shape.
Project sqx-strategy-project A runnable project.cfx that builds templates on real data.

One principle underpins all of them, and it is the reason they are trustworthy: every skill is install-derived. Before it authors anything, it reads your StrategyQuant installation and builds a catalog of exactly what your build can do — the native indicators, your exported custom blocks, and even indicators you have only coded in the editor. It then builds strictly from that catalog. It cannot reach for an indicator you do not have, so nothing it produces is a “phantom” that fails on import.

The workflow: the same six steps every time

All four skills follow one disciplined workflow. Learn it once and it applies to blocks, groups, templates and projects alike.

  1. Point it at your install (once). The skill reads your StrategyQuant folder — the config file, your exported custom blocks, even your coded Java snippets — and builds a catalog of exactly what your build can do, your own custom indicators included. Everything it authors comes from that catalog.
  2. Describe what you want, in plain English. “Long when RSI crosses above 30.” “A pool of my breakout triggers.” “Breakouts only in the trend direction.” “A EURUSD project on H1 over 2015–2020.” There is no syntax to learn.
  3. It specs it back before writing anything. It states the plan in plain language first — the name, the shape, the exact indicators and parameters — for you to approve or redirect. The cheapest moment to catch a wrong idea is before any XML exists.
  4. It checks every piece against your catalog. If an indicator or block you mentioned is not in your build, it says so and proposes an equivalent that is — never a phantom that fails silently.
  5. It generates the artifact and validates it. The XML must pass the validator before you ever see it. Custom blocks get a second, edge-hygiene pass that grades each block A–D and flags the silent killers a syntax check cannot see: look-ahead on the developing bar, repainting indicators, and thresholds a rule could never actually reach.
  6. You import into AlgoWizard. Blocks and groups import straight in. Templates and projects you import and then Construir — and the Build is the final proof that the strategy is real, not merely well-formed.

Skill 1 — sqx-custom-block: the trading rule

A custom block is the atomic unit of a StrategyQuant strategy: a single, reusable piece of logic you drop into AlgoWizard. The skill authors both kinds. A Condição block is a true/false rule — a signal or a filter. A Price-level block returns a price — a stop, a target, a band, or a breakout reference.

You describe — “long when RSI(14) crosses above 30, and short the mirror.”

You get — a validated Condition block whose RSI period (2–50) and oversold level are exposed as optimizable parameters, together with its short-side mirror, paired automatically, as import-ready XML.

Como funciona

  • It reads four sources inside your install, so it finds your own custom indicators — not just the natives — whether they are registered in AlgoWizard, present in an export, or only coded in the editor. This is what fixes the familiar “it did not find my indicator” problem.
  • One block is one idea. It will not quietly stack a second confirming indicator unless you ask for it.
  • The guardrails that separate a robust rule from a subtly broken one are built in: OHLC is read from the last fechado bar (never the developing one), thresholds are checked against the indicator’s real range, and repainting indicators are flagged.
  • If you want ideas rather than a specific rule, a research mode proposes candidates, an adversarial critic kills the weak, overfit or duplicate ones, and only genuinely buildable specifications survive to authoring.

Import: AlgoWizard → Custom Blocks → Import.

Skill 2 — sqx-random-group: the pool

A random group is a menu the builder draws one item from — per strategy, per slot. It overrides the global Building-Blocks settings for that single slot: instead of the builder choosing from everything, it samples one item from a set you curated. Groups come in two types. A Condição group pools boolean rules; a Valor group pools prices or levels. A template binds a group to one of its holes by the group’s unique identifier.

You describe — “group my breakout trigger blocks into one pool.”

You get — a validated Condition group that re-exports your breakout blocks by reference — the exact menu the builder will sample from — as import-ready XML.

Como funciona

  • There are two ways to fill a group. Híbrido re-uses your existing custom blocks by reference — the common case. Em linha builds fresh items directly from catalog atoms.
  • Items are flat: one rule or one comparison each. Compound AND/OR logic belongs inside a custom block, which you then pool — keeping groups clean and the builder’s search well-defined.
  • You decide, per item, which parameters the builder is free to optimize and which stay frozen.
  • Type discipline is enforced: a Condition group’s items must be boolean; a Value group’s must be prices or numbers.

Import: AlgoWizard → Random / Block groups → Import.

Skill 3 — sqx-strategy-template: the strategy

A strategy template is a StrategyQuant strategy with some of its sub-expressions left as typed buracos that the builder fills and varies. This is the most delicate layer, because a strategy’s validity is not guaranteed by its structure alone — engine exclusions, magic-number wiring and the signal-variable protocol all live outside the schema, and only an actual Build proves a strategy sound. So the skill does not hand-write strategy XML. It transplants your chosen groups into a Esqueleto com compilação confirmada and varies only the holes, staying strictly inside proven territory.

You describe — “breakouts only in the trend direction, entered on a stop at the prior-period high.”

You get — a .sqx template that wires a trend filter, a breakout trigger and a stop-price pool into a proven shape, with the short side mirrored automatically and the full exit stack already in place.

Como funciona

  • Every entry is expressed as a filtro — the regime, or quando you may act — plus a gatilho — the event that fires. A design step pairs them for genuine confluence rather than redundancy, and writes the falsifiable thesis behind the edge.
  • It emits proven shapes: immediate-market and pending-stop entries, session-gated entries, multi-timeframe entries (a higher-timeframe filter over a main-timeframe trigger), role-structured entries (regime E gatilho E NÃO veto), and multi-leg strategies.
  • The short side always mirrors automatically, and the complete exit stack — stop, target, trailing, break-even, exit-after-bars — is already wired; the template only decides which exits the builder may optimize.
  • It never invents a group. If a pool it needs does not exist, you build it first with the random-group skill.

Import: AlgoWizard → import the .sqx → run a Build.

Skill 4 — sqx-strategy-project: the build

A project file carries everything a build needs: the data feed, the symbol and timeframe, and the entire exit and acceptance stack. That is far too much to regenerate safely, so this skill clones a project you already trust and swaps in one build task per template — each task with its own results databank.

You describe — “clone my EURUSD H1 base and wire these three templates as tasks, over 2015–2020.”

You get — a ready-to-run project — three build tasks, each writing to its own databank, inheriting your base’s data and settings with the new date window applied — deployed into your install.

Como funciona

  • It is clone-based and install-bound: it never hand-builds a project. It copies a donor task byte-for-byte and varies only the template and the output databank per task.
  • Optional project-wide overrides let you swap the instrument (StrategyQuant re-resolves the tick economics itself on load), set the backtest window, or change spread, slippage, session and trade direction.
  • It self-verifies every clone — unique databanks, templates that resolve on disk — before anything touches your install.
  • One rule matters: deploy with StrategyQuant fechado, because it rewrites the project on close; then open it and Build.

Use: deploy into the install → open the project → run a Build.

The stack in action

Because the skills compose, a single idea can travel all four layers in one sitting, each output feeding the next:

  1. Block. Author “RSI(14) crosses above 30” into a mean-reversion Condition block, with its short mirror.
  2. Group. Pool that block with your other reversion triggers into a Condition group the builder can sample.
  3. Template. Wire that group as the trigger, behind a ranging-regime filter, into a buildable .sqx with a thesis.
  4. Project. Clone your EURUSD base, wire the template as a task, run the Build and read the databank.

Every step is validated before the next, and every atom is one your install actually has — so the whole chain imports and builds.

What I am building next

The four skills above are what I have released — the authoring layer. Two things sit on top of them that I am actively building, and I want to be clear that neither is released yet.

The oracle — verification against a live platform

The skills validate everything for import, but in my own work I go one step further. I load each artifact into a running StrategyQuant over its REST interface, so the platform itself confirms the artifact is real before I trust it — a LOAD PASS from StrategyQuant is worth more than any self-check. I am building this oracle into a strategy plugin that authors e verifies whole strategies end to end. It runs privately today; it is not something you can download yet.

The template factory — judging a whole population

Above that sits a factory. It takes a market hypothesis, has these skills author the template and its groups, uses the oracle to confirm they load, then generates and judges an entire população of strategies on out-of-sample statistics — the Deflated Sharpe Ratio and the Probability of Backtest Overfitting — and returns a verdict: graduate, revise, or kill. It is in active development.

In short

  • Four skills, one for each layer of a StrategyQuant strategy: block, group, template, project — shipped together as the SQX Authoring Toolkit (the sqx-lab plugin).
  • One workflow for all of them: point at your install, describe in plain English, approve the spec, let it validate, import.
  • Everything is authored from your own build, so it always imports — and nothing is a phantom.
  • The verification oracle and the population-judging factory are what I am building on top next.

The four skills ship together as the SQX Authoring Toolkit — the sqx-lab plugin. If you would like to put them to work on your own StrategyQuant install, or you are curious where the oracle and the factory are heading, get in touch.

clonex / Ivan Hudec

Ivan Hudec — “Clonex” no fórum

Negocio há 15 anos e venho desenvolvendo com o StrategyQuant X desde 2014. Hoje em dia, faço três coisas: desenvolvo e testo estratégias automatizadas em condições reais de mercado, amplio o próprio SQX com indicadores personalizados, trechos de código e ferramentas em Python para aprendizado de máquina e pesquisa quantitativa, e ajudo outros traders a chegarem lá mais rápido — sem passar pelos anos de erros caros que cometi ao longo do caminho.
A maioria das estratégias de trading parece ótima em um backtest, mas desmorona na prática. Meu trabalho é exatamente o oposto: estratégias que são honestas, validadas e robustas o suficiente para que se possa confiar nelas com dinheiro real. Escrevo sobre esse processo — o que dá certo, o que dá errado e o sobreajuste de que ninguém fala — no meu site, algotrading.space.
Se você quiser se aprofundar no tema da validação, no desenvolvimento personalizado de SQX ou na criação de uma vantagem competitiva real com dados e código, é lá que eu compartilho tudo isso.  www.algotrading.space

0 Comentários
mais antigos
mais recentes Mais votado

Continuar lendo