# Your first strategy

> Build a rule-card strategy in the workflow editor, walked through with a golden cross on SPY, and see it listed in Backtesting ready to run.

Source: https://orbitalaip.com/docs/getting-started/your-first-strategy

## What you will build

A golden cross on SPY. Buy when the 50-day simple moving average crosses above the 200-day. Exit when it crosses back below, with a 10% stop loss and a 15% trailing stop. Each position takes 95% of equity, and a regime filter allows entries only while SPY trades above its 200-day average.

In Orbital a Rules strategy is a workflow built from [rule cards](https://orbitalaip.com/docs/glossary#rule-cards).

## Before you start

The Backtesting app must be on in your project. If the Backtesting page says **Backtesting is turned off in this project**, click **Manage apps in Settings** and turn it on. You also need edit access to the project.

## Create the workflow

1. **Open Workflows**
   
   Click **Workflows** in the sidebar.

2. **Create a blank workflow**
   
   Click **Create workflow**, then **Blank workflow**. The editor opens with an **Untitled Workflow**.

3. **Name it**
   
   Click the name at the top left and rename it, for example SPY golden cross. The strategy takes this name.

## Add the nodes

Click the shapes button at the top left of the canvas (its tooltip reads **Show nodes**) to open the **Nodes** panel, then click a node to add it or drag it onto the canvas; see [How the panel is organised](https://orbitalaip.com/docs/workflows/nodes#how-the-panel-is-organised). Add eight nodes:

1. **From Data Sources, add Input**
   
   It holds the tickers to trade.

2. **From Strategy, add six nodes**
   
   Add **Indicator** twice, one for the 50-day average and one for the 200-day. Then add **Entry Rule**, **Exit Rules**, **Position Sizing** and the optional **Regime Filter**.

3. **From Core, add Output**
   
   It declares the signal columns a strategy must have.

## Set each node

Click a node to open its settings on the right. Required fields are marked with an asterisk.

1. **Input**
   
   Set **Source** to **Universe** (a screener candidate pool), **Universe preset** to **Custom list (use field below)**, and **Custom tickers (preset = "Custom")** to SPY.

2. **Indicator (first)**
   
   Leave **Indicator** at **SMA** (simple moving average) and set **Period (bars)** to 50.

3. **Indicator (second)**
   
   Set **Period (bars)** to 200.

4. **Entry Rule**
   
   Type golden-cross in **Rule name**. Keep **Direction** at **Buy (long)**, **First value** at **The wired indicator (input A)**, **Fires when the first value…** at **Crosses above** and **Compare against** at **The second indicator (input B)**.

5. **Exit Rules**
   
   Set the **Signal exit** field to **Crosses below** and keep **Compare against** at **The second indicator (input B)**. Set **Stop loss** to **Percent below entry**, keep **Stop distance (%)** at 10, and set **Trailing stop (%)** to 15.

6. **Position Sizing**
   
   Keep **Sizing method** at **Percent of equity** and set **Amount** to 95.

7. **Regime Filter**
   
   Keep **Only trade when** at **Price is above the moving average (uptrend)** and **Moving average period (bars)** at 200.

8. **Output**
   
   Untick **Use upstream schema**, click **Add column** three times, and name the columns symbol, action and asOf with the types string, string and timestamp.

## Wire the nodes

Drag from a node's output handle to another node's input handle. A node's settings list its ports under **Ports**.

1. **Wire the indicators into the Entry Rule**
   
   The 50-day **Indicator** is input A (its **First value**) and the 200-day **Indicator** is input B (its **Compare against** value).

2. **Wire both into the Exit Rules the same way**
   
   

3. **Chain the rest**
   
   Wire the **Entry Rule**'s **Strategy** output to the **Exit Rules**, the **Exit Rules** to **Position Sizing**, and **Position Sizing** to the **Output**'s **Data** input.

The **Input** and the **Regime Filter** need no wires. A backtest reads its tickers from the **Input** node and applies the regime gate to every entry.

## Timeframe

Each **Indicator** node has a **Timeframe**. It defaults to **Daily bars** (one per trading day), so this strategy decides once a day. Hourly or minute bars make the strategy intraday: it then backtests on the minute tape and cannot be deployed to alerts. The **Regime Filter** always reads daily closes.

## Save

The editor saves on its own about two seconds after each edit, and the **Save** button reads **Saved** once everything is stored; click it to save at once. Once the graph qualifies, a **Strategy** badge appears beside the name and Backtesting lists it under **Strategies** as **Draft**; see [how a workflow becomes a strategy](https://orbitalaip.com/docs/backtesting/overview#saving-a-strategy-enrols-it).

## Versions

**Save version…** saves the graph as a numbered version, v1, v2 and so on, and a first backtest also makes v1; see [Versions](https://orbitalaip.com/docs/workflows/runs-and-versions#versions). The first version whose backtest you run to completion becomes main, marked **Main**, and **Make main** later moves it to another version with a completed backtest; see [Main](https://orbitalaip.com/docs/workflows/runs-and-versions#main).

## Two other ways in

- **Ask Chat.** Open **Chat** and describe the strategy. Chat answers with a proposal card, **Create workflow “…”**; click **Apply** to create it.

- **Connect Claude.** With the Orbital AI connector, Claude builds the same nodes through tools in your project. See [Connect Claude to Orbital](https://orbitalaip.com/docs/claude-and-chatgpt/connecting) and [Rule cards and Programs](https://orbitalaip.com/docs/claude-and-chatgpt/rule-cards-and-programs).

The **New strategy** menu on the Backtesting page also offers **Write code**, which starts a [Program](https://orbitalaip.com/docs/glossary#program) instead.

## Next

Run the strategy against history: [Your first backtest](https://orbitalaip.com/docs/getting-started/your-first-backtest).
