# Import and export strategies

> Export a strategy as JSON and import it again, or bring in a Composer symphony or QuantMage spell: how each block carries over and what reads differently.

Every strategy can leave Tactfolio as a JSON file and come back from one, and
you can bring a strategy you already have from Composer or QuantMage. An import
opens as a private strategy in the [builder](https://tactfolio.com/builder), with its backtest ready,
and from there it's an ordinary Tactfolio strategy: edit it, save revisions,
trade it, or publish it.

An import either reads the same as the original or says where it doesn't. When
a strategy uses something the builder can't express yet, nothing is saved and
every such part is listed, so you know exactly what is missing.

## Export and import a Tactfolio strategy

In the builder, **Export** downloads the strategy on screen as a `.json` file,
unsaved edits included, or copies the same JSON to paste elsewhere, such as
into a message or an AI assistant.

There are two ways back in:

- On the [start page](https://tactfolio.com/builder), paste the JSON or upload the file under
  **Import a strategy**. It opens as a new private strategy.
- In the builder, **Import** replaces the rules, settings, and name of the
  strategy you are editing. It is one edit: **Undo** brings back what was there,
  and nothing is kept until you save. Composer and QuantMage JSON work here too.

A strategy that uses other saved strategies, as blocks or as its benchmark,
carries them in the file, along with the ones they use, so the file works in
any account. When you import it, the ones your account can already open, your
own and published versions, are used as they are; each other one is added to
your workspace as a private strategy, and the import tells you which.

## From Composer

1. Open the symphony in Composer and use **Copy Symphony JSON**.
2. In Tactfolio, open the [builder](https://tactfolio.com/builder), paste it into **Import a
   strategy**, and choose **Import**. If you saved the JSON as a file, choose
   **Upload a file** instead.

Tactfolio reads only the JSON you give it. It never fetches a strategy from
Composer, so a share link can't be imported on its own.

## From QuantMage

1. Open the spell in QuantMage's Grimoire and choose **Export**. It saves a
   `.json` file.
2. In Tactfolio, choose **Upload a file** under **Import a strategy**, or
   paste the file's contents.

A QuantMage link can't be imported on its own either; the export carries the
spell.

## How the blocks carry over

| Composer | QuantMage | Tactfolio |
| --- | --- | --- |
| Weight: equal, specified, inverse volatility | Weighted: Equal, Custom, Inverse Volatility | Weight with the same weighting |
| If / Else, including Else If | IfElse | If; combined *all* and *any* conditions become nested Ifs |
| Filter | Filtered | Rank |
| Group | (a named block) | Group |
| | Switch | Ifs that count how many conditions hold (*at least*); a case left empty falls back to the one below |
| | Enter/Exit | Enter / Exit; an *all* or *any* trigger becomes a rule with several conditions |
| Threshold rebalancing | Threshold trading | Runs daily and rebalances when a holding drifts by the same width |
| Weekly, monthly, quarterly, yearly | Weekly, monthly, quarterly, yearly | Runs on the same schedule, on the first trading day of each period, as the source does |

An empty branch in QuantMage holds cash here too. Composer's percentages are
converted: a cumulative return above `5` becomes `0.05`, and a daily standard
deviation of return becomes the builder's annualized volatility, so each
condition keeps its meaning, a return held against a standard deviation of
return included. The builder's
[indicators](https://tactfolio.com/docs/builder.md) cover price, moving averages, EMA, RSI, cumulative
and mean returns, volatility, price standard deviation, maximum drawdown, the
momentum scores, Ultimate Smoother, Trend Clarity, Aroon-Up, Aroon-Down, the
Aroon oscillator, the drawdown from the all-time high, and the month of the
year. QuantMage's Drawdown always reads from the all-time high, whatever window
the spell shows, and so does the import.

## Where an import reads differently

The import lists these as notes before the strategy opens.

- **Enter/Exit.** When both triggers fire on the same day, Tactfolio stays in;
  QuantMage exits. Tactfolio also keeps tracking the triggers while a branch
  above skips the block, where QuantMage starts over.
- **Empty branches in an equal split.** When one branch of a QuantMage equal
  split holds nothing on a given day, QuantMage hands its share to the others;
  Tactfolio holds that share in cash.

Costs don't follow the source: every backtest here charges 5 basis points a
trade, where Composer charges 1 and QuantMage spells set their own. Conditions
that can never change, such as a price above 0, are folded into the branch they
always take.

Prices come from a different data source than Composer's or QuantMage's, so a
backtest of the same rules can differ slightly, most often around splits and
dividends.

## What can't be imported yet

- Composer's percentage price oscillator, and conditions that compare readings
  in different units, such as a price with a return. Composer compares the raw
  numbers there (dollars with percent), so the import names each one to change.
- QuantMage's Mixed blocks, readings from days ago, percentile conditions, a
  bias added to a condition, conditions on a branch's own performance
  (`Subspell "Then"`), Aroon readings of economic series, and the MACD and
  percentage price oscillator indicators.
- Economic series the builder doesn't carry, and anything that isn't a
  US-listed stock or fund.

Your AI assistant can import too: see `import_strategy` in
[AI assistants](https://tactfolio.com/docs/mcp.md).

## Learn the ideas behind it

- [Composer alternatives](https://tactfolio.com/comparisons/composer-alternatives.md): Looking for a Composer alternative? Compare Tactfolio, QuantMage, Portfolio123, QuantConnect, and Option Alpha on brokers, building, and price.
- [Tactfolio vs Composer](https://tactfolio.com/comparisons/tactfolio-vs-composer.md): Tactfolio and Composer both automate rules-based portfolios.
- [Automate an ETF rotation](https://tactfolio.com/learn/automate-etf-rotation-strategy.md): How to automate an ETF rotation strategy: pick a classic rotation, read its rules and backtest, paper trade it, then run it in your own Alpaca account.
