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.
- Open Strategies and choose Strategy templates.
- Filter by category (trend following, breakout, momentum and so on) and pick one.
- 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 whereamoves aboveb;CROSSUNDER(a, b)the reverse. - Earlier values:
EMA(13)[1]is the EMA one candle ago, soEMA(13) > EMA(13)[1]means "the EMA is rising". - Logic: join conditions with
ANDandOR.
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.