Skip to content
A language for people and AI

Your trading rules.
Written clearly.

Flowscript is ftw.trade's language for trading strategies. It reads market data, calculates signals and defines when a strategy acts.

Write it yourself or with your AI. Backtest on real history, inspect each decision, then start on paper.

The guides and reference are public. No account needed.
crossover.flowPaper strategy
Flowscript
uses { bars: "^1", paper: "^1" }
const close = bars.close(market, interval);
const fast = ema(close, 12);
const slow = ema(close, 26);
when (crossover(fast, slow) && !inPosition()) { paper.buy({ quote: 100 }); }
when (crossunder(fast, slow) && inPosition()) { paper.sell({}); }
metric("fast", fast);
metric("slow", slow);

Two moving averages. Buy on a cross above; sell on a cross below. Use a spot price feed to try this example.

Read it line by line
01 / INPUT

Read the market

Closing prices arrive as a series: one value for each completed bar.

02 / SIGNAL

Describe the condition

Built-in indicators calculate the averages. A crossing becomes a signal.

03 / ACTION

Say when to act

when fires as a condition turns true. Metrics show the values behind the decision.

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.flow PAPER

01 Receive data

02 Close the bar

Bar complete

Many incoming records. One completed bar.

03 Evaluate rules

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

The same rules as the example above.

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.
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.

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.