Skip to content

Strategy language reference

How to write strategy descriptions that the AI parser handles well — syntax, timeframes, operators, and tips.

Updated 2026-05-29·2 min read

Coinrule uses natural language as its primary input format. There is no formal DSL — you describe your strategy in plain English (or plain code) and the AI interprets it.

Which candle intervals are supported?

1m5m15m30m1h4h1d

How do you describe entry and exit conditions?

Describe conditions using indicator names and comparison operators:

  • RSI(14) is below 30
  • EMA(20) crosses above EMA(50)
  • price breaks above Bollinger upper band
  • ATR(14) is greater than 0.5% of price

Multiple conditions joined with "and" are ANDed together. The AI translates these into Python evaluate() logic.

How do you describe exits?

You can describe exits as conditions or time-based:

  • close when RSI(14) is above 70
  • close after 48 hours
  • stop loss at 3%
  • take profit at 8%
  • trailing stop 2%

Multiple exit conditions can coexist — the engine fires whichever triggers first.

How do you specify position sizing?

  • buy 10% of balance
  • buy $500 worth
  • buy $200 per signal

How do you limit concurrent positions?

Use max_open_positions to cap how many concurrent positions a strategy (especially a scan strategy) can hold simultaneously. For example: max 5 positions at once. Setting this to null or not specifying it means the strategy will open positions for every signal independently.

max_open_positions: 0 blocks the strategy from opening any new positions immediately. To remove the cap, set it to null (or leave it unspecified).

Scan (multi-market) strategies

For scan strategies, you can describe the universe:

  • scan top 50 coins by volume
  • scan BTC, ETH, SOL

See Scan and multi-market strategies.

What are tips for better parses?

  • Be specific about indicator periods: RSI(14) not just RSI
  • Specify the candle interval: on 1h candles
  • Mention the asset: for BTC/USDT on Binance
  • Describe the position direction: long only or both long and short

Was this article helpful?