Skip to content

Guide / Checked Nov 2026

How do I build a trading bot with Claude or Cursor?

Let Claude or Cursor write the logic that decides when to trade, as a Pine Script strategy or a short Python script. Nyria handles the broker side. The chart or the script sends an alert, and a bot places the order. Start on Nyria Paper, which is free, and connect your assistant over MCP so it can preview and send alerts.

Official documentation

Build the bot in six steps

  1. 1

    Ask for the alert logic

    Tell the assistant the rule in plain words. Ask for a Pine Script strategy or a Python script that sends an alert naming the ticker and the side when the rule fires.

  2. 2

    Create a strategy in Nyria

    Select Create strategy and pick TradingView or Webhook as the alert source. Copy the webhook URL from the Integration tab.

  3. 3

    Send the alert to the URL

    A Pine Script strategy sends it from a TradingView alert with the URL pasted in. A Python script posts to the URL, as the example below does.

  4. 4

    Check what Nyria read

    Select Check format and paste a sample into the alert tester. The Logs tab shows the ticker and side Nyria read from every alert.

  5. 5

    Deploy a bot on Nyria Paper

    Select Deploy bot, choose Nyria Paper and set a Budget per entry. Let real alerts fire for a week or two and read the Logs tab against the rule.

  6. 6

    Connect the assistant over MCP

    Create a strategy with the alert source AI Agent (MCP), copy its MCP server URL and add it to Claude or Cursor. Ask the assistant to list your bots, then to preview an alert. A preview places nothing.

Prompt and code to copy

Prompt for the assistant

Write a Pine Script v6 strategy for SPY that buys when the 20 day average crosses above the 50 day and sells when it crosses back. Use strategy.entry and strategy.close. Leave out order sizes and stops.

Python alert

import requests

requests.post(
    "https://trades.nyria.io/webhooks/YOUR_STRATEGY_TOKEN",
    json={"ticker": "SPY", "action": "buy"},
    timeout=10,
)

What to check in AI code

  • Read every line before it runs against a live bot.
  • Ask the assistant to explain each entry and exit rule in plain words.
  • Keep the strategy's token out of prompts, chats and repositories.
  • Select Rotate token on the Integration tab to cut off an old URL.

What Nyria does for the bot

  • Reads the alert, matches it to the strategy and sizes it per bot.
  • Places the order at Charles Schwab, Tradier, tastytrade or Alpaca, or fills it on Nyria Paper.
  • Logs every alert and order on the strategy's Logs tab.

Questions

Can Claude or Cursor place trades with Nyria?
Yes, over MCP. They connect to a strategy's MCP server URL, then preview and send alerts. A live bot places a real order and a paper bot only simulates.
Do I need to know how to code?
Not to place orders. An assistant can write the Pine Script or Python, but read the code before it runs.
Who sets the position size?
The bot does. An alert names the trade, and the Budget per entry set on the bot decides how much.
What does it cost?
Paper is free. Live trading from $15 a month.

Next

Try a paper bot first

No card required. Paper is free. Live trading from $15 a month.