The No Job Lifestyle
Home β€Ί Guides
πŸ€– AI trading guide

How to Build a Trading Bot With Claude, Even If You Can't Code

You can go from a simple idea to a working demo bot in an afternoon. Here are the exact steps and the prompts we use.

πŸ—“ Updated ⏱ 3 min readβœ… 100% free
600+free guides and tools
10free trading calculators
5 mina day to stay on track
$0to read every guide

Quick answer: Write your strategy rules in plain English, ask Claude to turn them into code for your platform (MT5, TradingView Pine Script or a Python broker API), backtest the result, then run it on a demo account for a few weeks before you decide anything with real money.

Trading involves risk and you can lose money. Results vary.

1Step 1: Write Your Rules in Plain English

Claude can only code what you describe, so write every rule down before you open the chat.

Good rules answer five questions. What market and timeframe? When do we enter? When do we exit with a profit? When do we exit with a loss? How much do we risk per trade? For example: trade EURUSD on the 1 hour chart, buy when the 20 period moving average crosses above the 50, sell when it crosses below, stop loss 30 pips, take profit 60 pips, risk 1% of the balance per trade, one trade open at a time. Vague rules like buy when it looks strong will give you a vague bot.

2Step 2: Pick Your Platform

Choose where the bot will run first, because the code is different for each one.

MT5 bots are called Expert Advisors and are written in MQL5. They suit forex and gold and run inside the MetaTrader 5 app. TradingView strategies use Pine Script and are great for testing ideas on charts, then sending alerts. Python bots talk to a broker or exchange through its API and suit crypto and stocks. If you are brand new, MT5 or TradingView is the easiest place to start, because both have a built in tester.

πŸ€– Skip the hard way

The 6 steps from plain English rules to a running demo bot

Get my free AI trading guide β†’

3Step 3: Ask Claude to Write the Code

Paste your rules into Claude and name the platform and language clearly. Ask for comments in the code so you can follow it.

Here are prompts you can copy. For MT5: Write an MQL5 Expert Advisor for MT5 using these rules. Add inputs for lot size, stop loss and take profit, allow only one open trade, and add comments that explain each part. For TradingView: Write a Pine Script v6 strategy with these rules so I can backtest it in the Strategy Tester. For Python: Write a Python bot that connects to my broker's API, uses these rules, reads API keys from environment variables, and has a paper trading switch turned on by default. If you have Claude Code, you can ask it to create the project files for you.

4Step 4: Install It and Fix the Errors

Expect a few errors the first time. Copy each error back into Claude and ask it to fix the code.

On MT5, open MetaEditor from the Tools menu, create a new Expert Advisor, paste the code and press Compile. The file then appears under Expert Advisors in the Navigator. Drag it onto a chart and switch on the Algo Trading button. On TradingView, open the Pine Editor at the bottom of the chart, paste and click Add to chart. For Python, install the libraries Claude lists and run the script in paper mode. If something breaks, paste the exact error message into Claude with the line number.

5Step 5: Backtest, Then Run on Demo

A backtest shows how the rules would have done in the past. A demo account shows how the bot behaves live, with fake money.

Use the MT5 Strategy Tester or the TradingView Strategy Tester and check the number of trades, the biggest drawdown and the win rate over at least a year of data. Then ask Claude to explain the report in plain words. A good backtest does not mean future profit, so move to a free demo account and let the bot run for two to four weeks. Watch for trades that break your rules, wrong lot sizes and orders at odd times.

  1. Backtest over at least 12 months of data
  2. Ask Claude to explain the report and point out weak spots
  3. Run on a demo account for 2 to 4 weeks
  4. Only then decide if it is worth a small real account

6Step 6: Decide if You Want to Keep Maintaining It

A home built bot needs care. Someone has to keep the computer running, fix bugs and update settings when the market changes.

Most home built bots need a VPS so they run all day and night, plus regular checks after news events and broker updates. If that sounds fun, keep going and improve your rules one change at a time. If it sounds like a second job, a ready made AI bot lets AI trade for you without the coding and upkeep. Either way, trading involves risk and you can lose money.

Ready to start? Our free guide on letting AI trade for you walks you through it step by step, and our ai trading guides cover the rest of this topic.

Questions people ask

How do I ask Claude to create a trading bot?

Give it your exact rules, the platform and the language, for example: write an MQL5 Expert Advisor for MT5 with these entry, exit and risk rules, and comment each part. Clear rules in, clearer code out.

How do I install a Claude trading bot on MT5?

Open MetaEditor in MT5, create a new Expert Advisor, paste Claude's code and press Compile. Then drag the EA from the Navigator onto a chart and switch on Algo Trading. Start on a demo account.

Can Claude test the bot for me?

Claude can't run your MT5 tester for you in a normal chat, but it can explain the backtest report you paste in, spot risky settings and suggest fixes to try next.

How long does it take to build one?

A simple bot can be coded and running on demo in an afternoon. Testing it properly on demo takes a few weeks, and that part should not be skipped.

Related guides

Free gifts

Quit your job calculatorPassive income quizMore answersAll guides

Get my free AI trading guide β†’