Skip to content
A language for people and AI

Your trading rules.
See them run.

Arcana is a language for trading strategies. It reads time series, calculates signals and produces metrics and action intents your app can use.

Write it yourself or with your AI. Embed its compiler and runtime in your own application, or use ftw.trade's data and execution.

The guides and reference are public. No account needed.
signals.arcnProgram excerpt
DEMO-USD 1h bars105.00
const close = bars.close("DEMO-USD", "1h");const average = isNa(close[2]) ? na : sma(close, 3);const above = close > average;metric("close", close);metric("average", average);when (above) { signals.publish({ message: "above average", close: close }); }when (!above) { signals.publish({ message: "at or below average", close: close }); }
RETURNED METRICSabove average
Close 105.00Average 101.67signals.publish
↗ Chart≡ App log{ } Your APIExplore the output ↓
Illustrated data · actual compiler output
From stream to strategy

See the moment your rules take over.

Data keeps arriving. Your strategy waits for a completed bar, checks its rules, then acts or waits.

Interactive illustration
crossover.arcn PAPER

01 Receive data

02 Close the bar

Bar complete

Many incoming records. One completed bar.

03 Evaluate rules

Arcana
Update fast & slow
crossover(fast, slow)
!inPosition()
Cross above · no position

EMA crossover · ftw.trade paper strategy ↗

04 Act or wait

Paper buyBoth conditions are truepaper.buy({ quote: 100 })

A paper buy needs both a cross above and no position.

Spot prices collect into market bars.

Illustrated events, not live data. Each cycle is an independent example on closed bars.
Beyond the decision

Your strategy is a data source, too.

Chart its metrics. Inspect its activity. Send structured output to your own app.

signals.arcnIllustrated inputs · evaluated by Arcana
INPUTDEMO-USD · 1h barsYOUR PROGRAMAverage + state changesOUTPUTMetrics, text & action intents
01

Visualize the metrics

CHART
Close105.00
Average · SMA 3101.67
03:00 UTC · signals.publish · action intent04:00 UTC · signals.publish · action intent06:00 UTC · signals.publish · action intent
CloseAverageIntent01:00–06:00 UTC

Pass the returned series to a chart, a dashboard, or a table.

02

Explain the activity

APP LOG
at or below averagesignals.publish · intent emitted
at or below averageNo new action intent
above averagesignals.publish · intent emitted
Your app decides how to handle this intent.

Build a log from text states and decisions returned by the run.

03

Use it in your app

DATA ROW
{
  "time": 1767247200,
  "close": 105,
  "average": 101.66666666666667,
  "state": "above average",
  "actions": [
    "signals.publish"
  ]
}

Store a row, publish an event, or expose an API through your host.

Read the program behind these views
Arcana
arcana "0.1";
uses { bars: "^1", signals: "^1" }
const close = bars.close("DEMO-USD", "1h");
const average = isNa(close[2]) ? na : sma(close, 3);
const above = close > average;
metric("close", close);
metric("average", average);
metric("state", isNa(average) ? "warming up" : above ? "above average" : "at or below average");
when (above) { signals.publish({ message: "above average", close: close }); }
when (!above) { signals.publish({ message: "at or below average", close: close }); }

The example uses six illustrated hourly closes. Its host declares the price source and signals.publish action. Arcana returns data; your application owns charts, storage, delivery, and execution.

See the complete host and JavaScript example ↗
Start with the idea. Learn the details.

A short guide, then as deep as you need.

Follow the introduction from top to bottom, or go straight to the part you need.

START HERE

Your first Arcana program

Compile a complete program against an explicit host and replay an illustrated price sequence with @arcana/core.

02

Run Arcana locally

Install the standalone package, declare your own typed sources, evaluate JSONL files or producer pipes, and save and resume a local run.

03

Moving to Arcana 0.1

Update source files and developer tools while preserving historical programs, signatures and checkpoints.

04

Values, series and na

Values and series, missing observations, expressions, functions, folds, enums and phases.

05

Indicators and models

Moving averages, oscillators, windows, sessions, market profile and models over the inputs your host supplies.

06

Language reference

The compiler-owned reference for syntax, types, hosts, actions, functions, diagnostics and runtime semantics.

07

Embed Arcana

Use the compiler and runtime in your own application: declare a host, replay data, step a live run and retain checkpoints.

08

Build libraries and tools

Compose and test your own libraries, declare custom data and actions, and feed recorded external model predictions into an incremental strategy.

09

Dependent actions and recovery

Compose primitive actions on confirmed settlement, inspect captured inputs, handle each failed leg and retain uncertain submissions through recovery.

10

Performance and latency

Choose native or WASM embedding, measure retained evaluation and execution latency, bound memory and queues, and account for ML training and host scheduling.

11

Use strategy outputs

Consume evaluated metrics, text and action intents in charts, application logs and your own data consumers, with delivery and storage owned by the host.

From reading to running

Try your first strategy.

Open the editor on ftw.trade, or connect your AI. Check the code, backtest it and run on paper before choosing to use real funds.