Skip to content

Compose a strategy

Goal: combine two or more existing strategies into one composite strategy that a scenario can name as its strategy leg.

An atomic strategy is a strategy worker (one row each, named by its type tag). A composite strategy is a name over 2+ strategies (atomic or composite), saved in cfg.strategy.<NAME>.

Prerequisites

  • An active context (Switch context).
  • At least two strategies. To add an atomic one from the Strategy pane, see step 2; strategy workers from the registry (e.g. MovingAverageCrossover) are created on Infra › Workers (Start a worker).

Steps

  1. Open Strategy: Trading top tab, 8 (Strategy) in the default layout.
  2. Optional — add an atomic strategy: press a. In Add Atomic Strategy enter:

    • Strategy name (becomes the worker's type tag), e.g. mystrategy_equity;
    • Worker type: .NET DLL, Python or Python script;
    • Source: URL (package) with the package URL, or Code (inline) with the code;
    • Subscribe topic;
    • Config — optional JSON, fixed after creation.

    Press Create. Toast: Created atomic strategy '<name>'. The worker is created but not started: start it on Infra › Workers (m → Start Worker). 3. Compose: press c. In Compose Strategy: - Name — upper-case letters, digits and _, e.g. MY_STRATEGY; - Components — tick 2 or more.

    Press Compose. 4. Use it in a scenario: Trading › Scenario, a, pick it as Strategy id (Scenarios).

What you should see

  • Toast Composed strategy '<NAME>'; a row with Kind composite and Detail listing the components joined by +. Atomic rows show atomic and the worker id.
  • d on a row removes it (an atomic one asks ... This will also delete its worker.).

Troubleshooting

Symptom Cause and fix
Need at least 2 existing strategies to compose Add strategies first (step 2 or Workers).
Name must be uppercase letters, digits and _, e.g. MY_STRATEGY Fix the name.
Pick at least 2 components Tick two or more.
Compose <NAME>: ... error toast Saving failed; the reason is in the toast and on Infra › Alerts.

From the AI tab: strategies__list, strategies__compose (upper-case name, at least two known strategies, no cycle). Reference: Keybindings › Strategy.