SuperAPI AI Directory

xq-xs

Coding & development

View repository

Updated 10-22 12:36

About this skill

XQ / XS

Create and review XS scripts with current XQ semantics, explicit script-type boundaries, and honest validation limits.

Classify the request

Determine these facts before writing code:

  1. Select the artifact type: indicator, sensor/alert, filter/stock selection, autotrade, or function.
  2. Identify the market, symbol class, bar frequency, and whether the task uses historical, real-time, backtest, or live-trading data.
  3. Separate the user's entry/exit idea from execution details such as target position, order price, quantity, and risk controls.
  4. Ask only for missing facts that materially change the script. State safe, reversible assumptions for the rest.

Read references/xs-language-guide.md when choosing a script header, declaration form, data API, or trading primitive.

Ground claims in the right source

Use this order of authority:

  1. Use XSHelp for current language and function semantics.
  2. Use XScript_Preset for official system-script idioms across script types.
  3. Use XS_Blocks for selection, alert, and ranking-block patterns.
  4. Use XQStrategy for stock-selection condition examples.
  5. Use vscode-xs only for lexical clues and editor support, never as semantic authority.

Read references/source-map.md before researching syntax or reusing an upstream example. Verify unstable details live. Cite the exact help page or repository path when a non-obvious API or compatibility claim affects the result.

Do not assume that similarity to EasyLanguage or PowerLanguage implies compatibility. Do not invent a function, field, frequency, or script-type capability when the official sources do not establish it.

Write or modify a script

  1. Put the correct {@type:...} header on the first line.
  2. Keep inputs, variables, arrays, and calculation stages easy to audit.
  3. Prefer built-in XS functions when their semantics match the requirement.
  4. Guard insufficient history, zero denominators, unsupported fields, frequency mismatches, and real-time-only data where relevant.
  5. Keep trigger logic separate from plotting, output fields, or order execution.
  6. Add concise Traditional Chinese comments when the user does not specify a language.
  7. Preserve the existing style and behavior when editing user code unless the requested correction requires a change.

For autotrade code, distinguish Position (target position) from Filled (executed position). Make target size, order price, entry, exit, and stop/risk behavior explicit. Never silently turn an alert or research rule into a live order path.

Review or debug a script

Inspect the smallest reproducible section first. Report findings in this order:

  1. compile or syntax blockers;
  2. wrong script-type or unsupported-API use;
  3. look-ahead, frequency, history-window, and real-time/backtest errors;
  4. order and position-state risks;
  5. numerical edge cases;
  6. maintainability improvements.

Preserve the user's intended trading logic unless they ask for strategy redesign. Explain behavioral changes in plain language and show a minimal patch or corrected script.

Read references/review-checklist.md for the full review and confidence checklist.

Validate and report

Run all validation that the available environment supports:

  • inspect the script header, declarations, delimiters, references, and type restrictions;
  • compare non-obvious functions and fields with current XSHelp;
  • compare the pattern with a relevant official system script;
  • compile in the XQ XScript editor and run the appropriate historical, simulation, or paper-trading test when that environment is available.

There is no bundled standalone XS compiler. If the XQ editor was not used, say static review only; XQ compile/runtime validation not performed. Never call a script validated merely because it looks like EasyLanguage or matches an old example.

Return:

  1. the chosen script type and assumptions;
  2. the complete or patched XS code;
  3. a short explanation of the logic;
  4. validation performed and remaining XQ-side checks;
  5. a risk note for autotrade or strategy requests.

Respect source and financial boundaries

Treat upstream repositories and XSHelp as references. Link and paraphrase by default. Do not mirror or bulk-copy code whose license does not permit redistribution. Keep excerpts minimal and attribute their exact source.

Treat generated strategy code as a software artifact, not an investment recommendation. Do not claim profitability, safety, or production readiness without evidence from the user's own XQ environment and data.