Skip to content
Strategies

Building a strategy

Write a strategy as entry and exit rules, start from a template, and add stop loss, take profit and trailing stops.

A strategy is a rule for when to buy, a rule for when to sell, and optional risk settings. You write the rules as a short statement that reads almost like English.

Start from a template

The quickest way in is a template.

  1. Open Strategies and choose Strategy templates.
  2. Filter by category (trend following, breakout, momentum and so on) and pick one.
  3. The template opens in the editor as your own copy. Give it a Strategy name.

Each template is described in the public strategy catalogue.

Write the rules

The rule statement has a buy condition and a sell condition:

BUY WHEN Close > SMA(50) AND RSI(14) > 50
SELL WHEN Close < SMA(50)
  • Prices and volume: Open, High, Low, Close, Volume.
  • Indicators: for example SMA(50), EMA(20), RSI(14), MACDHIST(12,26,9), ATR(14), SUPERTREND(10, 3).
  • Comparisons: >, <, >=, <=.
  • Events: CROSSOVER(a, b) is true on the candle where a moves above b; CROSSUNDER(a, b) the reverse.
  • Earlier values: EMA(13)[1] is the EMA one candle ago, so EMA(13) > EMA(13)[1] means "the EMA is rising".
  • Logic: join conditions with AND and OR.

The editor checks the statement as you type and marks it Valid when it can run.

Add risk settings

Under Risk, set any of:

  • Stop loss - exit if price moves against the position by this much.
  • Take profit - exit once the position gains this much.
  • Trailing stop - a stop that follows price up and exits on a pullback of this size.

These apply alongside your sell rule: whichever triggers first closes the position.

Save and test

Save the strategy, then backtest it. The number of strategies you can keep depends on your plan.