Skip to content

Strategy input formats

The three formats you can use to describe a strategy — natural language, Python pseudocode, and Pine Script.

Updated 2026-05-29·2 min read

The terminal accepts three formats. You can mix them freely — the AI reads all three.

Natural language

The simplest way. Describe what you want in plain English:

Buy ETH when the 15-minute RSI drops below 28. Sell when price is up 4%
or RSI goes above 72. Use 8% of my portfolio.

Works well for strategies with 1–3 conditions. The more specific you are, the less editing you'll need to do afterward.

Tips:

  • Name the market: BTC/USDT, ETH/USD, or just BTC. If the market is ambiguous, we'll ask.
  • Mention the timeframe: on the 4h, daily candles. Defaults to 1h if absent.
  • Use numbers: RSI below 30, price up 5%, EMA(20). Vague terms like "low RSI" are less reliable.

Python pseudocode

# SMA crossover with trailing stop
entry_condition = sma_50 < sma_200  # "death cross" - short signal
exit_condition = trailing_stop(2.5) or profit >= 3
 
market = "BTC/USDT"
interval = "1h"
capital = 5  # % of portfolio
side = "short"

Python pseudocode reads identically to natural language for simple expressions. It's more reliable for:

  • Multi-condition entries with and / or
  • Indicator parameters: ema(close, 20) vs ema(20) vs EMA(20) all parse the same
  • Comments as annotations — the AI reads them

Pine Script (TradingView)

Paste a Pine Script strategy or study. The AI extracts indicator parameters, entry/exit logic, and alert conditions. It ignores anything that doesn't apply to Coinrule (e.g. strategy.entry labels, position sizing in lots, etc.).

//@version=5
indicator("EMA Cross", overlay=true)
fastLen = input.int(9, "Fast EMA")
slowLen = input.int(21, "Slow EMA")
fast = ta.ema(close, fastLen)
slow = ta.ema(close, slowLen)
longEntry = ta.crossover(fast, slow)
longExit  = ta.crossunder(fast, slow)

Pine Script strategies that use strategy.entry and strategy.exit are generally better as TradingView alert sources (see TradingView webhooks) than as Coinrule AI-parsed strategies.

What the AI cannot parse

  • Cross-exchange arbitrage (e.g. "buy on Binance when price is 0.3% below Coinbase")
  • Market-making / order book depth strategies
  • Strategies that require streaming tick data below the 1-minute interval
  • Strategies referencing custom data sources you host yourself

If your prompt includes unsupported logic, the AI will tell you what it dropped. See Supported vs unsupported strategies.

Was this article helpful?