Documentação
Aplicações
Last updated on 20. 11. 2026 by clonex / Ivan Hudec
Custom databank columns and snippets
Conteúdo da página
A snippet is a small piece of Java code that adds something StrategyQuant doesn’t have: a databank column, a custom statistic, a money management method, a Monte Carlo method, a What-If filter. Writing one by hand means knowing the snippet API, the template and the compiler.
With Q you describe what you want in a sentence. Q writes the snippet, compiles it, fixes what the compiler complains about and tells you when it is ready to use. No restart is needed.
Nota!
Q writes the code; you still decide whether it measures what you meant. Check the first values against a strategy you know before you sort a databank by a new column.
Step 1: Describe the column
Open Q, start a new chat and pick Custom Analysis Tabs & Code on the home screen, or just write your request. Clicking one of the tile’s examples sends it at once. This is one of them:
Add a custom databank column AvgTradeDurationHours — the average time from a trade’s open to its close in hours, excluding balance orders like deposits and withdrawals. Compile it and confirm I can add it to my databank views.
Say what the column measures, what to leave out, and the unit.
Step 2: Read what Q did
When the turn ends, Q tells you what it wrote and whether it compiled. Below the answer is the step list. Click it to see every step.
14 steps in 34 seconds. The red mark means one step failed: Q tried to read a file that doesn’t exist and carried on without it. The column compiled on the first try.
If the first compile fails, you don’t have to do anything. Q reads the compiler’s errors, fixes the code and compiles again until it passes.
Step 3: Add the column to a databank view
The column is now in the list of databank columns, next to the built-in ones:
- In the databank, click the gear icon next to Ver. The Manage views window opens.
- The default views can’t be changed. Click Clone this view to copy the current one, or Create new view to start empty.
- Clique Add columns, type the column’s name and pick it from the list. Click Adicione.
- Give the view a name and click Save changes. A view name can contain letters, numbers, spaces, hyphens (-) and underscores (_), nothing else.
- Choose the view in the Ver list above the databank.
Type the first letters of the name and the new column shows up like any other.
Strategies that were already in the databank show 0 in the new column. StrategyQuant works out a column’s value when it backtests a strategy, so retest them:
- Select the strategies and click Reteste.
- In the window that opens, click Copy (keep original). With Apply current config on, the Builder’s settings replace your Retester settings, and every strategy in the Retester’s databank is retested with them.
- In the Retester, click Início.
The values appear in the Retester’s databank. Choose your view there too.
After the retest the values are there. Strategy 0.1108 averages 12.86 bars per trade on M15, about 3.2 hours, and the new column shows 3.23.
The code itself is a normal snippet. You find it in the Editor de código under User > Snippets > SQ > Columns > Databanks, and you can change it there or ask Q to change it for you.
Step 4: Other kinds of snippets
The same works for the other snippet types. Ask for what you need in plain words, for example:
- Databank columns and custom statistics: a value per strategy
- Trade-list columns: a value per trade
- Money management: how a strategy sizes its positions
- Monte Carlo methods: your own robustness test, either a change to the trade list or a retest with randomized settings or data
- What-If filters: “what if this strategy had skipped these trades”
- Order actions, custom analysis and trade-analysis charts
- Indicators and signals: see Indicadores personalizados
If you have a custom snippet already, ask Q to change or improve it.
Solução de problemas
The new column shows 0 for every strategy. The strategies were tested before the column existed. Retest them and the values appear.
Save changes does nothing. The view name has a character other than letters, numbers, spaces, hyphens or underscores, and StrategyQuant shows no message. A “+” is enough to block it.
Where to go from here
- Indicadores personalizados: indicators and signals you can use as building blocks
- Custom analysis tabs: when one number per strategy is not enough and you want a whole tab
- Extending Q: AI plugins and AI tools of your own
What it costs. A custom databank column or another snippet takes on average about 60 credits with GPT-6.1 Terra (real usage, October–November 2026). Sonnet 5 and Opus 5.5 cost several times as much. The column on this page took 33 credits with GPT-6.1 Terra.
Este artigo foi útil? O artigo foi útil O artigo não foi útil


