# MASTER AI Trading Bots in 61 Minutes (Claude + TradingView)

**Channel:** Mind Math Money
**Source:** https://www.youtube.com/watch?v=Ec1TVzF0S4I
**Transcript page:** https://www.withtranscript.ai/video/Ec1TVzF0S4I

## Chapters

- 0:00 — Course Overview and Learning Roadmap
- 6:27 — What AI Trading Bots Actually Do
- 10:01 — Requirements and Setup for Connection
- 15:52 — Connecting Claude to TradingView
- 19:41 — Core Rules for Trading Bots
- 23:34 — Turtle Traders and Strategy Rules
- 29:47 — Building the Pine Script Strategy
- 36:49 — Manual Verification of Bot Signals
- 42:08 — Understanding Backtests and Results
- 50:09 — Creating Alerts and Turning Bot On
- 55:29 — Oversight, Safety, and Wrap-Up

## Transcript

**[0:00]:** In this free video course, you will learn everything you need to know about building your own AI trading bot for stocks, crypto, forex, or any other financial market. By the end of this course, you will not only have built your very own trading bot with Claude and TradingView, but you will also know how to backtest it, check that it follows your rules, and of course, to switch it on. All right. So, hello guys and welcome to this full course on how to build, control, and use your own AI trading bot. And here of, you know, all trading courses I have made on this channel, this course is, you know, high up there on, you know, the most important courses I have ever made. And the reason for this is that, you know, AI, or in other words, artificial intelligence is becoming more and more important, not only in trading, but as you as you guys know, in society in general.

**[1:05]:** So, if you want to, you know, be able to stay ahead of the curve, stay ahead of other traders, it's very important to be able to start using AI to your advantage in your trading. And yeah, this is what this course is going to be all about. I will in a very sort of step-by-step manner go over everything you need to build your own AI trading bot. So, at the end of this course, if you watch this course from start to finish, you will be able to, you know, build your own AI trading bot, and you will also be able to use, you know, Claude, which at this, in my opinion, is the best AI right now. You will be able to use Claude together with TradingView, and TradingView is the platform I use for all my trading and also investing actually. So, you can connect these to and you can also create your own AI trading bot.

**[1:56]:** But yeah, guys, and this is very important, to get the most out of course. I want you all to really really, you know, lock in and focus. So please guys, you know, if you have your phone, you know, put it in another room. Make sure to, you know, put this uh YouTube video to full screen and remove all distractions. You know, if you have anything that gives you cheap dopamine, you know, fast food, uh you know, games, everything like that, try to remove it to really focus on this course. But yeah, the first thing I want to do right here is to quickly go over what you can expect to learn in this course. And the very first thing we of course need to learn before we can start, you know, using and building our AI trading bot is to first define, you know, what is an AI trading bot in the first place.

**[2:46]:** And very importantly, we will take a look at what an AI bot can and can't do. You know, many people when they hear about trading bots, they think they are, you know, sort of magic and that they will make you rich, you know, overnight. And while in some sense I actually think that AI is a magical thing on its on its own, I actually think it's kind of like magic, you know. The fact that you can just take up your phone, talk to it and basically get answered anything, in some sense is that that is magic. But in this course I want to try to make it as realistic as possible. It will be grounded in reality. So we will learn what an AI trading bot is. And after that we will actually learn about something you may or may not have heard about. We will talk about you know, a group of traders known as the turtle traders and their breakout rules.

**[3:40]:** And the reason we will do this is that we would use these turtle traders and their rules to, you know, later on in the course when we will actually build our AI trading bot. So that chapter is very important. Don't skip skip it. And to be honest guys, I have built this course, you know, in a step-by-step manner, so I highly recommend to watch the chapters in order. But here after the chapter about the Turtle Traders, we are finally going to take a look at how Claude, which is the AI we will use in today's video, basically can build an AI trading bot in TradingView. And very importantly, you need absolutely no coding. And this is also something that is becoming, you know, more and more true in general. You know, nowadays even, you know, developers start to code less and less and less because the AI the AI's are I would say probably better than 99.99% of coders right now.

**[4:39]:** And it's just a matter of time before they completely, you know, outsmart humans on the coding arena. So we'll take a look at how we can build a trading bot in TradingView without no code. The next chapter, super super important, we will take a look at how we can check and backtest your bot. So before we start using a bot, we want to backtest, you know, how would this bot have performed in the past. And then we can use this past data to try to figure out how the bot will perform in the future. The next step here is to to actually switch the bot on. So we'll take a look at exactly how we can do it so that you will get, you know, a signal from TradingView every time your bot finds a buying or selling opportunity. And also last but definitely not least, this is very important, we will take a look at how you can, you know, review and basically stay in control of everything your bot does.

**[5:37]:** And I can't stress enough how important this is. Yes, it's very cool and it's very, you know, amazing that we have the technology we have today so that everyone can build their own trading bot. But at the same time, it's so important to realize that the only one responsible for what your bot does is you. So you need to take full responsibility for everything that your bot does. We can't blame it on Claude, we can't blame it on anyone. So, before you deploy a bot, you need to, you know, review and make sure that everything is, you know, working as intended. But yeah, guys, now we are ready to jump into the course here, so make sure to really lock in. As I said, remove all distractions. Maybe you want to grab a coffee. And without further ado, let's jump right into it.

**[6:27]:** But all right, so the very first thing we of course need to learn about is what is an AI trading bot? And here, in very simple terms, a trading bot is simply a program that follows exact trading rules on its own. So, it's any type of program that follows trading rules on its own. And what does a bot do? Well, it watches the market. It binds signals, both, you know, buy and sell signals, and it can also place orders automatically. So, it can automatically buy and sell. And one of the biggest benefits of trading bots is that the same signal always get the same action. This is one of the main benefits of a trading bot and one of the main sort of disadvantages of human traders. I would I would say that, you know, discretionary traders or traders that trade based on, you know, their own, uh one of the hardest things about that is your trading psychology.

**[7:32]:** So, think about emotions like fear, greed, you know, FOMO and so on and so on. Uh you know, that is that is one of the hardest part of trading. And when you're using a bot, the good thing about that is that these emotions will be put away. So, you will have no emotions and no guessing. And here, an AI trading bot is a bot built and tested with AI. So, first we talked about trading bot in general, and AI trading bot is built and tested with AI. And in this course, as I said, we will use Claude. And as I said, Claude is right now, at least in my opinion, the best AI out there. And the very good thing is that you can try Claude completely for free. So here, as you can see on the image right here, it watches the market, it follows exact rules, and then it uh you know, produces buy and sell signals.

**[8:29]:** But right, so now then, before we start building our AI trading bot, it's very important to be grounded in reality and to understand what a bot can do and what a bot can't do. So let's take a little bit uh look here what it can and can't. So what an AI bot definitely can do is that it can watch, you know, many markets 24/7 and it can follows follow its own rules without emotion. So this is two big advantages of over humans. You know, we humans, we need to sleep, we need to eat, we can't watch the market 24/7, and AI trading bot can do that. The other benefit is that the bot, at least as far as I know, don't have any emotions. So this is very, you know, good things about bots. What it also can do is that it can run fully automated, which means that it can send orders straight to a broker or it can run semi-automated, which means that it doesn't buy or sell, you know, automatically.

**[9:33]:** It sends you a signal first. And this is what we will focus on on this course. And you know, it's very important, I think, at least when you are new to building trading bots, that you always have this sort of safety that, you know, the bot gives you a signal and then you approve the signal or not. I think that is very very important at least for beginners. And I have built this course, you know, from beginners to advanced traders. So we will mostly focus here on semi-automated.

**[10:01]:** What is also very important to know is what uh an AI bot can't do. And what an AI bot can't do and what many, you know, people think and you know, when you search on it on YouTube, you can get this sense that, you know, some people say that they build bots that predict the exact future. And this is something it can't do. Nothing can predict the future, at least right now, nothing can predict the future with certainty. And it can also not turn a bad strategy into a good one. You know, an AI trading uh an AI bot can help you, you know, uh you know, produce buy and sell signals, but it can't predict the exact future. And here, and this is so so important, and you need to remember this throughout the whole course, you need to remember that you are responsible for every trade your bot takes.

**[10:52]:** Okay, but now, and this is very very important, now we're going to take a look at exactly what you need to set this bot up. And it's pretty simple, but you need to pay attention, you need all of these things. The first thing you need for this workflow is that you need the TradingView desktop app. This is very important. Right now, this workflow does not work on browser, and it does not work on mobile. So make sure to get the desktop app. And you also need a plan that includes technical alerts. So you need at least the essential plan for TradingView. And here, don't worry because I do have a special link for you guys. I do have a special TradingView link, and you can use that link to try out actually uh I recommend to try out TradingView Premium for free for 30 days.

**[11:44]:** And then if you later on want to continue, for example, if your, you know, AI trading bot is performing very well and you want to continue, you will also get a $15 bonus. So make sure to use that link before this step. But yeah, after you have clicked on the link, you want to then make sure that you are on this page, tradingview.com/desktop. And then simply you go down here and download it for Windows if you are on Windows, or if you are on Mac, you click here. If you are on Linux, you click right there. But right, so now you hopefully have downloaded the TradingView desktop app. Now, the next step is that you need the Claude desktop app. And here I recommend that you have a paid plan for Claude, but the good thing about this workflow is that Claude, the free version of Claude will allow you to do certain prompts.

**[12:34]:** So you will be you will be able to test this both both out completely for free. But if you want to use this a lot, you will need to eventually, you know, get a paid Claude plan. But here to download Claude, you simply go to claud.com/download and if you want to download on Windows, you click right here. And if you have any other type of system, you find all of the systems down here. All right, so now the easy part is done. You have you hopefully have at this point in the course, you have the TradingView app, you have the Claude app. The last thing that you need is what is known as the TradingView MCP. And this right here in simple terms is the bridge. It's the free bridge that lets Claude see and control the charts. So if you look at this image right here, you can see that you currently have the TradingView desktop app, you have the Claude app, but now we need to make this connection.

**[13:30]:** This is the most important step. We need to be able to connect Claude uh to TradingView. So now make sure to really pay attention. I will show you guys my free guide on how to do this. All right, so what you want to do now is that you want to go to my website. You go to mymathmoney.com and then you want to click here on free educational guides. I actually also have some premium guides here, one that is associated with this course. Uh it is available for channel members gold and higher, but this free guide here you can find right here, free educational guides. Then you go down here to how to connect Claude to TradingView. And what I do recommend here, I do recommend that you read this article if you have the time to understand, you know, what you are downloading. I also recommend that you actually go to the official page.

**[14:22]:** So, as you can see right here, this is the official GitHub page uh for the for the MCP. So, you know, this is a very popular one. As you can see, it has like 7K stars. I have been using it. Many other traders have been using it. But I do want to mention right away that this is a common theme throughout this course is that only you know download things that you know uh you fully trust and understand. So, don't trust, you know, uh a random GitHub page without doing any uh research. Don't trust, you know, my video without doing any research. Make sure to do your research before you download anything. So, I want to recommend that you read this whole page before you do anything. But now with all of this all of this said, you fully you fully know uh you know what it is.

**[15:10]:** Then you can actually scroll down here and I have created a prompt. This prompt right here is made to make this process as easy as possible. So, what you simply do is that you want to copy this prompt and then you actually want to open up uh chat here in Claude. And to make this process as, you know, uh you know similar as possible to you guys, I'm going to first write uh or I'm going to first speak to Claude that, you know, uh hello, can you please act as if you don't have any MCP connections and that this is a completely fresh Claude account. Act as if, you know, you have no history, no memory, or anything like that.

**[15:52]:** Then I can press enter right here. The reason I said this is that my I want my Claude to look at as your Claude. So, sure from here on I have a fresh start, blah blah blah blah blah. If you want to use say so. Uh but yeah now Claude right here should be fresh. What I now do, remember I copied the previous prompt. So, now I insert the prompt right here and then I simply press enter. What should happen now and if Claude, you know, I actually already have this connection, but what should happen now is that Claude will guide guide you through the whole process. As you can see, it says happy to walk you through this. First, here's what we're building. So it explains everything you're building. It explains all the steps you need to answer if you're on Windows or Mac, blah blah blah.

**[16:35]:** And here you will basically be guided step by step how to do anything everything to get this connection going. And if you anywhere in this process, you know, stumble upon, you know, something doesn't work or anything like that, what I actually recommend is instead of Of course, you can feel free to drop comments on YouTube and ask me. I'm very happy to help. But many times it's actually, you know, it's actually easier to just ask Claude, you know. Maybe you get an error code and then you want to give the error code to Claude and and work through the problems with Claude. Another tip here is that I actually recommend to use as powerful model as possible. So here you can see we have different models. You know, what if you have, you know, maybe the max plan, you can try using Fable 5.1, but Opus here, Opus 5.5 is almost as good.

**[17:30]:** So what I recommend is actually for most people to use Opus 5.5. But if you have, you know, a plan with lots of usage, you can actually choose extra. Extra means that it will think a little bit more before, you know, giving answers. And I think that, you know, when it comes to trading and everything like that, the more intelligence we have, the better. But yeah, guys, make sure to do this whole process and it should work, you know, very well. All right. So at this point in the course, you should have Claude app, you should have TradingView, and you should also now have the bridge between Claude and TradingView. So now we're actually ready to see if this works. So as you can see, right now we are in the TradingView app and as you can see up here, we're currently looking at Bitcoin.

**[18:18]:** We are on the daily time frame right here, which means that every candlestick on this chart represents one day. And as I already mentioned earlier, if you don't have TradingView yet, you know, I do recommend at least the essential plan for this workflow or if you, you know, don't, if you don't have TradingView yet, I highly recommend you do the TradingView premium trial. But as I said, I do have a special link for that. I will make sure to link that link both in the description and the pinned comment and you can use that link to get both the 30-day free trial as well as TradingView premium. But now we want to check that this connection works. I'm going to open up Claude right here and then I'm going to simply ask, you know, hello Claude, can you tell me what chart are am I looking at right now in TradingView?

**[19:06]:** Tell me the chart and you know what the price is right now. And here we can see it was thinking for a little while, but now it says I'm looking at Bitcoin, which is correct. It's the exact correct market. It says that the price is right now at 78,000 and as you can see, the price is at 78,000. It's up 72% for the day. As you can see here, it's indeed up 72% for the day. So everything looks correct right here. So yeah, our Claude is connected to TradingView and we are now finally ready to start building our trading bot.

**[19:41]:** All right, so now before we can start building our AI trading bot, we first of all need to know about the five rules that every trading bot needs. And here the very first rule we need to decide is, you know, what market and what time frame we are going to trade. This right here is very important because different trading strategies can perform different, you know, depending on what market you are trading and what time frame. So for example, a trading strategy that works very very well on the daily time frame might not work at all if you try to, you know, scalp on say the one minute time frame or even the one second time frame. So, market and time frame is very important to decide. And in this course, we're going to use Bitcoin on the daily time frame. This is one of the most popular and one of the most universal markets.

**[20:40]:** And I think the technical analysis works very well on Bitcoin. But I do want to be clear here that you can trade basically anything. So you can trade, you know, stocks, forex, crypto, or as I said in the intro, any other financial market. The next rule here that we of course need to decide before we build our bot is our entry and our exit. And here we need, you know, exact conditions or in other words, we need exact rules to know, you know, when to buy and when to sell. And this can be anything from, you know, normal risk to reward ratios. And it can also be things like, you know, stop losses and target levels based on price action. And in this course, we're going to actually use the strategy that the turtle traders used. I really like that name. And here we actually have, you know, a mix between fixed and trailing stop losses and targets.

**[21:37]:** And you will Don't worry if you don't know what that is right now. You will learn all about it. Um and here of course super super important is the stop loss. You know, us traders, one of the most important things we can learn about is, you know, risk management. That is how do we basically how do we protect the downside? Because in order to, you know, make money on a on a consistent basis, one of the most important thing things is to protect the downside. Because for example, this principle is so important to know. But for example, if the market drops 50% right, that actually means that how much do we need to recover? Well, in order to recover a drop of 50% we actually need 100% to recover. And this one of the most important asymmetries in trading. So that is, you know, why risk management is so so important.

**[22:33]:** And in this video, we don't really have time to dive super super deep into risk management, but I do want to mention already that I do have a full risk management course right here on YouTube. I'll make sure to link that course up in the video card as well as the description. I can't stress enough how much I recommend that course. And in that course, we talk about things like stop losses, but we also talk about things like position size. This is another thing. This is another rule that your bot needs. So in other words, how much of the account should you risk on each trade? You know, it's often very smart or all pretty much always very smart that you or it's kind of, you know, says itself that you should not risk everything on one trade. You can have a trading strategy that in theory works, but if you lose everything on one trade, then you are completely out of the game.

**[23:27]:** And that is probably the most important thing we want to avoid as traders.

**[23:34]:** All right. So now, guys, the time has finally come to take a look at the turtle traders. And what on earth or who are the turtle traders? Well, let's take a quick look at this because this will be the basis of the trading strategy and trading bot we will build later on in this course. But first of all, in 1983, Richard Dennis, which you can see on the image right here, actually set out to settle a debate with another trader called William Eckhardt. So here is an image of William Eckhardt. And they basically debated if, you know, can trading actually be taught? Is this something you can teach? And of course, by having this channel, I think that trading definitely is something you can learn. I also think that trading is basically a a mix of things you can learn, but you also need experience.

**[24:33]:** You also need, you know, to put in the reps, of course. But that that was basically the debate between Richard and William. And what Dennis then did to try to demonstrate this what that was that he recruited completely beginners, so noob traders that he called the Turtles, and he trained them for only two weeks. And here the Turtles traded a trend following system. This simply means that you trade in the same direction as the trend. So if you, for example, have an uptrend, the goal here is to, you know, trade and make money as the price goes up. A very common strategy is to buy pullbacks here, but you can also buy breakouts. But yeah, so he did a trend following system and in this case he actually it was all about buying breakouts and buying specific breakouts over specific highs and then sell the price when we fell below you know recent

**[25:34]:** lows. And you know as I said with when you need when you build a trading bot you need specific rules and I will talk all about that very soon. And here in this course we are going to use a simplified version of their rules as an example bot because my goal with this course is that you know to show you guys how you can build basically build your own trading bot from scratch and you can also you know AI is so powerful so you can actually build your own trading strategies and you can back test them and you can build bots around them. but I do want to emphasize that this example I will show in this video is a it's first of all a simplified version of the strategy and it's also a you know just an example. But all right guys so now it's finally finally time to build our trading bot and as I said the trading bot we will build is the I call it the Turtle breakout 5520 and you will soon understand the

**[26:35]:** name here and you already know where turtle comes from. It comes from the turtle traders. But now let's begin here by you know stating the rules for this trading bot. So the rules here rule for this bot is as follows. The entry we enter or in other words we buy when the daily close is above the highest high of the previous 55 days. So with a daily close I mean that if we have a candlestick right here the close of the candle is where the candle stops on the daily time frame. For example this right here is the close. This right here is the open. This right here is the high. This right here is the low. In this trading strategy if we get a close that is higher than as I said the highest high of the previous 55 days. So let's say that this right here back then was the highest high and we close above this is our signal to buy.

**[27:31]:** This is our signal to enter the trade. But here and this is you know at least as important as the entry. This is our stop loss. And here what we are going to do is that we're going to place a stop loss two times the ATR which basically stands for average true range. This is a very common indicator used for stop losses but we're going to use the average true range over 20 days and ATR basically measures the size of a normal days move or that is a simply way to think of think about it but we're going to do two times the ATR below the signal days close. So we're going to do two times the ATR here below the close. So two times the ATR 2x right there. And also guys don't worry if you don't know about the ATR I highly recommend actually to understand the strategy you're using.

**[28:26]:** It's very important to understand the pieces and I do have a video on the ATR indicator. I will make sure to link it up in both the video card as well as the description below. Uh, now we have the entry, we have the stop loss, but what about the exit? Well, here we're actually going to sell when the daily close is below the lowest low of the previous 20 days. So in this case the exit of the turtle breakout strategy is actually like a trailing exit. It will not be determined on day one. It will actually follow the price. Uh, so that is very important. Last but not least here for position size, uh, this can be, you know, different depending on your your sort of risk tolerance and your overall goal. But to keep it simple, a very simple rule is to risk 1% of your account.

**[29:20]:** And once again, I'm going to do a note here that this is a simplified version of the turtles rules. Uh, you know, for example, in this case we only go long to keep it more beginner friendly, meaning that we only bet that the price will go up. We use closing prices, we do no additional trades and so on and so on. And of course, as I mentioned in the disclaimer, this is of course, you know, only an example and not financial advice.

**[29:47]:** Okay, so now the time has come to build an AI trading bot together with Claude. And we're going to use Claude and TradingView. And the process here is pretty straightforward. What we're going to do is that we're going to give Claude the three, uh, I mean the five trading rules from our trading strategy in very clear terms. You know, nowadays I would say that Claude is very good at understanding you even if you are not exact. But when you build a trading strategy, it's of course better to be as exact as possible when you formulate the trading strategy. And then when you give the prompt, Claude will write the bot as a Pine Script strategy. If you didn't know, Pine Script is simply, you know, TradingView's coding language. So it is the coding language used to, yeah, build scripts and indicators and so on and so on.

**[30:42]:** And it also adds it to your charts. And Claude is so impressive. It can actually fix its own errors until the strategy works. And here a pro tip to sort of double check it yourself. As I have been talking about throughout this course, I always recommend to you to double check everything. Yes, AI nowadays is so so powerful, but we are still in a phase where AI can make mistakes. It can hallucinate and so on and so on. So I highly recommend to actually double check the work. All right. So now we are back here in TradingView and I'm going to open up Claude here. Remember, you need to use the Claude app. And once again, just to confirm that Claude is connected to TradingView, we can start by just asking, uh, hello Claude, can you tell me what chart are we looking at right now?

**[31:35]:** Uh, and press enter right here. I also recommend to either use Fable 5.1 or to use Opus 5.5. And if you use Opus, I prefer the extra option right here. The max option is a little bit overkill. As you can see, it takes four times or more usage. So it uses lots and lots of of tokens. And, you know, I have the max plan, so I have the the the the sort of plan with the most tokens. But if you are not on the max plan, it can quickly get eaten up. So I recommend, you know, extra or if you are tight on tokens, you can even try high or medium. But if you have tokens, go for the extra right here. And as you can see, it says you're looking at Bitcoin. We are on the daily time frame. It says, you know, the last daily candle, November so far.

**[32:22]:** You know that the price was last at 78,400. Everything looks very correct right here. Uh, but what I'm now going to do is that I have actually prepared the prompt here to build the trading strategy. So as you can see, it's pretty long right here. Build this trading as a TradingView Pine Pine Script blah blah blah blah blah. Of course, for this step, you can build whatever trading strategy you want. This is just an example for this course. And what I can also mention if is that if you want this exact prompt and basically everything you need for this whole course, I have a like a study guide that you can download. It's a PDF guide. It's currently available for all, you know, our channel members gold and higher. So if you didn't know, I actually we actually have a community right here on YouTube where members, you know, get access to things like, you know, this study guide.

**[33:14]:** You get access to all the guides for my other courses as well. You get access to my own TradingView indicators and so on and so on while at the same time you support my work. So if you want to become a channel member, just click the join button next to the subscribe button and a short video will pop up where I explain the different memberships. But you know, you don't need to become a member. All you need to do here is to follow along. So now I'm going to click enter right here and now as you can see Claude will work here to build this indicator. I mean this trading strategy. This can take a little while, but as I said, I much rather it take, you know, a minute or two and that Claude actually works to build the strategy correctly rather than, you know, rushing it and getting it

**[34:04]:** wrong. So now I will just let Claude cook for a while and I will be back when the strategy is complete. Okay, so now after thinking for like two three minutes, we got this back and here what they actually wrote in the prompt is that before he will actually build the indicator, I wrote that he should explain everything in, you know, plain English. So it says, you know, what chart Bitcoin direction long only, you know, exactly when to buy, exactly stop loss, what when to sell, the size. So everything is listed here. So I actually recommend to read through your whole strategy. You see that everything is correct. You see the assumptions. You see, you know, some notes about the stop loss, position size, and so on and so on. And, you know, it says reply go or tell me what to change and I will build it.

**[34:55]:** So I didn't read through all of this, but this is just a demonstration. So I'm going to say, you know, uh uh let's let's build the bot go. And now Claude will start actually building the bot using the Pine Script coding language. I can also just mention here that it's kind of cool to let, you know, or to look at, you know, Claude working here in you know, live. So we can see here that it has already started to build the script right here. And you can see that, you know, Claude is working right now. You can see everything it has done here, how it like failed a task and then found a solution. Right now it's working. Yeah, you can see it's working really hard with different things. You know, I'm not going to say that I'm understanding anything of this, but yeah. Like sometimes, especially if you're using here incognito mode, you will need to click allow.

**[35:56]:** There are some like checks here that you need to click allow or there is usually, you know, if you don't use incognito, you can choose here to, you know, always allow Claude, you know, everything. But you might need to be able to be at the computer to allow certain tasks. But as with everything, you know, before allowing things, you need to, you know, understand what you are allowing. And now if we take a look here, we can actually start to see the trading strategy appearing here on the chart. Really cool here. We see buy signals, we see sell signals, buy, sell, buy, sell, and so on and so on. Okay, guys. So now the the bot has been built right here. So let's actually close down Claude and we can see just like that the whole trading strategy is built uh right here on TradingView.

**[36:49]:** And the script we can see down here where it says uh you can't really see because my camera is a little bit on the way, but you know Claude built all of this code right here beautifully beautifully. And what we can also see is that down here we actually have a backtest of the trading strategy. And we will talk more about this backtest later, but you can see here that this trading strategy made around 700% in profit. You can see here the max drawdown. And one interesting things you can also also already notice here is that the amount of profitable trades was actually only 45% of the time. But what this means is that you know yes we lost more than we won, but when we actually won the trades we won a lot more. So for example this trade right here you can see that we won massively.

**[37:43]:** Uh so yeah, but as I said we will talk more about the backtest later on because now I want to switch the attention and take a look at what do we need to check before we start trusting this trading strategy. But so now the time has come for step number two right here and that is to actually check the bot by hand. And the reason we want to check you know at least one trade but preferably more uh is to just you know confirm that the AI trading bot actually did what we asked it to do. Uh as I mentioned already yes today's AI are super super powerful and I would say it's better than 99.9% of coders and it's better than most people at most things, but it can still make mistakes. So it's very important to still double check your work especially when it comes to things like you know trading and so on and so on.

**[38:36]:** So here what I recommend is to check three trades on the chart. So double check you know the entry is the entry correct according to the rule we gave it. Also, make sure to check the stop loss. Is the stop loss correct according to to the rules? And also check the exit. Is the exit correct according to the rules? And in our example, what we need to look for here is first of all that the breakout compares the close with the previous 55 candles. So remember, our entry signal is when the price breaks above the highest point of the last 55 candles. The second thing we need to check here is that the stop loss is is set once only at entry. So we don't want to see our stop loss move. In our case, in our bot, the stop loss would be an orange line like this.

**[39:30]:** And if the orange line moves, we know that something is wrong. The orange line should be fixed at a certain level. The next thing you can check right here is that the position size is indeed 1% of the account divided by the distance to the stop loss. Okay, so now we're back here in TradingView and I can once again mention if you don't have TradingView yet, hopefully at this point you have TradingView Premium so you can follow along with everything. But if you don't have TradingView Premium yet, I do have a special link. It will be both in the pinned comment and description. Make sure to use that link if you haven't taken advantage of it yet. But as I said on the slide, I recommend that you check three trades. But for this course, let's just double check one trade here. The first thing we want to check is the buy signal.

**[40:20]:** So as you can see right here, we have a buy signal. And remember, the buy signal happens when we close above, you know, the highest point of the last 55 days. And this is represented by the I hope you can see the green line right here. So if we extend this green line, we should hopefully see, you know, the point we're talking about. And as you hopefully can see right here, this was the highest point of all of these candles. Uh, so that is why we we get the entry signal when the candle closes. And remember, it closes up here. So when it closes above, that is when we get the entry signal. And remember, the second thing we want to check here, which is very important, is the stop loss level, which is set two times the ATR below the candle close. So so this distance right here is two times the ATR.

**[41:15]:** And what is very important to check about this stop loss is that it doesn't move. You can see the line here is straight. Compare that to the red line. You can see the red line is constantly moving. The green line is also constantly moving, but the uh the orange line should be straight. So this is also correct. So now the entry is correct, the stop loss is correct. The last thing we need to check here is the exit. And you can see here that the sell signal came all the way up here. And the reason we sold was that the price dropped below this low right here. You can see this red line right here. If we extend it, we can see I think the low is actually from this low right here. So this was the lowest point of the last 20 candles, and that is why we automatically sell when the candle closes below right here.

**[42:03]:** So just by looking at this trade, the bot looks completely correct.

**[42:08]:** But as I said, what I recommend is to check maybe, you know, at least two or three. Uh, but that would be pretty boring in this course, but you just do the the same method. Another reason why I think it's, you know, so important to check your bot is because that is like a test if you actually understand the strategy. So the rules you have given it, it's important that you understand the rules because if you don't understand the rules, you will not really know if the bot did anything uh you know, anything wrong, if that makes sense. All right, so now the time has come to a very important step when it comes to using and trading with AI bots. And that is of course to back test the bot. And luckily, we have actually already done a back test, but it's very important to be able to understand the backtest.

**[42:53]:** So let's take a look at what a backtest is and why it's so important and what you need to basically have in mind. So in very simple terms, a backtest runs the bot on past data. So it looks at, you know, the chart and the past candles and see how the rules or how the training strategy would have performed in the past. So it says, you know, how would this strategy have performed, you know, in on the last in this case of Bitcoin, maybe the last 10 years. And to make it realistic, what we want to do is that we want to add commissions and slippage. So, you know, when you backtest something, it can often look a little bit better than what it costs in real term because every time you buy or sell something, you need to pay a little bit to the bank.

**[43:41]:** You need to pay a little bit to your broker in commissions. And another reality of market is something known as slippage. That is basically, you know, when you place a buy order, especially if the market is not very liquid, if you try to buy something, you might not get the exact price you were looking for. Uh you might have to pay a little bit more and that is also a reality of trading and something we, you know, have to account for. Another thing that is good to do with backtest is to actually compare your result with a buy and hold strategy. And this can actually be a very sort of nice aha moment, you know, especially for Bitcoin. Bitcoin has performed very very well by just holding Bitcoin. To be honest, it has probably outperformed pretty much every trading strategy. You know, if you held Bitcoin from, you know, 2013 or uh you know, from even more recent, you would have made lots and lots of money.

**[44:39]:** So it's important to, you know, compare, you know, how would I have performed by just holding the assets versus using the AI trading bot. Another thing you can do is that you can test the bot on other time frames. So for example, look at, you know, how would the trading strategy perform on the five minute chart instead of the daily or on the one hour chart instead of the weekly and so on and so on. Another thing, a quick note here is to just of course understand that all trades are simulated. So TradingView you know creates sort of simulated orders. This is not you know, but the backtest is not something that has actually happened. And in real markets, if you know, it doesn't really matter if you're a small trader, but when you start to have lots and lots of money, you can actually affect the market itself.

**[45:30]:** And that is something to have a little bit in mind, but if you trade something like Bitcoin and don't have a lot of money, you don't affect the market much, but you know, it's still something that I think is worth mentioning. All right. So now then, now let's take a look at how to read the results of a backtest and there are a few important things we need to learn about. The first thing very simple is win rate. This is the percentage of trades that made money. And as I have mentioned earlier, you don't have to win more than 50% of trades to make money. You can actually win let's say 25% of the trades to to and still make money because it all depends on your average, how much you win versus your average, how much you lose. So how big are the winners compared to the losers?

**[46:23]:** If your winners are much bigger than your losers, then you can afford to win less and still make lots of money. Another very important thing you need to learn about is what is known as max drawdown. And this is simply the biggest drop in the account from the peak. So how much did your account totally drop and check that it counts the open trades too. Once again, I do want to emphasize here and I want you guys to remember that a backtest shows the past and it's not a promise of the future. So even if you have a backtest that has performed, you know, very well in the past, it doesn' mean that it will perform very well in the future. Yes, it makes it more likely that this strategy will perform well, but it's no guarantee. You know, anything can happen. Let's say you built a trading strategy that performed very well on the stock market before, you know, the COVID crash, and then the COVID crash happens, and that is a completely new market environment where your your strategy might

**[47:25]:** get completely obliterated. Black swans happen. We need to understand that, you know, uh yes, backtesting is very good and important, but it's no promise. It's definitely no promise. All right, so now let's jump back here into TradingView, and you should be able to see your backtest should open up down here. So you just press down here, and then you drag it out. And here are some key sort of stats. First of all, you can see that our trading strategy made uh 70 uh 729% in profit, or in other words, uh $72,000. You can see here that our max drawdown was 3.29%. And this is not the max from the highest to lowest point. This is only of closed trades, so it's important to have that in mind. The other thing that is very important is that as you can see, our win rate was only 45%, but despite having 45% win rate, we still made lots of money.

**[48:25]:** And that's because we had a very good profit factor. We had a profit factor of 7.6. And a profit factor of 7.6 basically means that for every dollar the bot lost, we actually made $7.6. So so we had a very good profit factor. And of course, right here we can see, you know, the graph. You can see how the bot has performed. It's important to notice that, you know, most of the gains here or lots of the game gains come from a few very like like uh very good trades. So we have a few trades that really, really makes up most most of the profits. And then we have, you know, a few like slow and steady trades right here. Um, what can we see more? You can see here the gross profit, the gross loss, commission load. You can go down here and take a look at the distribution.

**[49:20]:** So you can see, you know, losers, winners, and how much you made on these. What is also very important, you can, if you click right here, you can see how would your trading strategy have compared with a buy and hold strategy. And if we click show right here, you can see that we get absolutely obliterated by Bitcoin. So what this means is that just holding Bitcoin would have beaten this trading strategy by a lot. So I have to be honest with that. You know, even though this is a decent return, Bitcoin completely beats that. And what I also have to say is that, you know, this is probably true for pretty much all trading strategies. It's very hard to beat the performance of Bitcoin from back in, you know, 20 2013.

**[50:09]:** That is an insane gain from Bitcoin. All right. So now the time has finally finally come to, you know, turning our AI trading bot on. And what we want to do here is that we want the bot to, you know, notify us and give us a signal every time it finds a trade. And to add a layer of security to this, this is, you know, especially important if you are new to building AI trading bots. And if you're watching this video, I assume that you are, you know, you know, pretty new to this game. The important part here is that the bot will give you a signal, but it's you who actually click buy or sell. Of course, you can automate it this completely so the bot automatically buy and sell. But I think that especially in the beginning, it's super important that it's actually you that, you know double check and click buy or sell.

**[51:05]:** So, what we're going to do here is that we are going to have it like this. Um, a strategy alert will fire every time the bot enters or exits a trade. So, we are going to have first of all, we are going to make you know we're going to have Claude create the alert and the whole alert system for you through the MCP. The MCP is simply uh the connection here between um TradingView and Claude that we have been using throughout this whole course. And here the alerts uh run on TradingView's servers and uh will can reach your phone, your email. It will uh you know reach your TradingView app and so on and so on. And it's very important that you don't need to have TradingView open. You will get these alerts from the bot uh you know if you're out and about you know you just have your phone with you and you will always get these alerts.

**[52:06]:** And it's very important here that if you make any changes to the strategy you need to you might need to recreate the alerts. So, here on this image you can see a simplified sort of explanation of what we do. First we will have Claude create the alert system here and then when we have the alerts you can have them sent to your phone, to your email. The alerts will run as I said when TradingView is closed and so on and so on. But now let's jump back into TradingView here and take a look at how we can actually create this alert system and turn the bot on. Okay, so now we're back here in TradingView and I have the you know Claude window open right here. So, now let's create the alert system and one of my favorite way to actually prompt Claude is to use you know voice.

**[52:54]:** I think that is much it's much faster and more efficient than writing. Um, so let's try to you know just talk to Claude here and create the alert system. So, all right. So, hello Claude. What I want you to do now is that I want you to create an alert system for the current trading strategy, the turtle breakout 5520 and I want you to you know, fire an alert every time the bot buys or sells. I want you to use the bot's own alert messages and I want you to send the alerts to both email and the app notifications. Make the alerts last, you know, as long as possible and don't touch my other alerts. And when you are done, I want you to tell me the settings you're use you used. So, yeah, that's it. So now, as you can see, all of the text appears right here.

**[53:57]:** I will simply press enter and let Claude do its thing. All right. So now, Claude is done working and as you can see, just as we asked, it shows all settings right here in the chat. If we take this chat down, you can also see that the alert is created right here. It should already be saved. So you don't have you should not have to click save again. But now, to find the alerts, you want to go up here to the upper right corner where it says alerts right here. And as you can see, your alert should be right here. You can double click on it and you can see here that the alert should be active. You can also see here on notifications that we asked it to send notifications to both app and email. And if you're wondering, you know, what email does it go to, I'm pretty sure it automatically goes to the email you used when you created your TradingView account.

**[54:57]:** So now, you basically have a bot that will automatically send you notifications every time you need to buy or sell. So, this right here is uh you know uh yeah, this right here is now a bot. Uh the only it's not fully automated because it's still you that are taking the final action of buying and selling, but as I mentioned earlier, I think this is a very good sort of uh safety step in this process, especially if you are new to uh trading bots.

**[55:29]:** All right, so now it's time to take a look at you know some very important things related to risk and oversight for your AI trading bot. So, let's take a quick look at the oversight rules uh oversight rules that uh basically make sure that your bot behaves well as you can see right here. And step number one, as you can see on this image, is that you are responsible. No one else you know at the end of the day, no one else is responsible for your decisions, not the bot, not the president, not me, not anyone else. At the end of the day, you are the one that decides to buy or sell, and that is why I have you know built in into this course you know the final step that you know the bot never actually buys and sells for you. You are always the one that presses uh buy or sell.

**[56:22]:** So, this is a very important like safety measure. You are responsible. The second thing that is very important is that you know you should you know Claude should never get access, direct access to your broker login, your API keys, or you know the order button order button. So, you know Claude already definitely has the you know power and capacity to be to fully automate your trading. It can place buy and sell orders while you are asleep. But as I said, if you're taking that step, you need to make it really sure that first of all that your strategy works, and secondly, as I said, you know Claude is very very is very very reliable nowadays, but it still makes mistake. So, if you are fully automating using Claude, you need to you know, have into your calculation that Claude can make, you know, a complete mistakes.

**[57:16]:** There's no guarantee that Claude doesn't make mistakes. So, I highly highly recommend to not give Claude access direct access to you know, you know, anywhere where it can actually buy or sell. So, that is the important step number two right here. The next thing is that you know, definitely make sure to you know, pause the bot if its drawdown gets bigger than the backtest worst drawdown because that is a that is a you know, indication that you know, maybe we did something wrong with the backtest or maybe you know, the you know, this strategy performed well in the past but maybe something have changed about the market. You know, maybe the market is much volatile nowadays. And that makes the strategy, you know, not really work as intended. So, I would recommend that if it gets especially if the backtest if it gets, you know, much worse than the backtest worst drawdown, that is definitely a warning sign that we should, you know, pause the bot and reassess

**[58:19]:** it. Um and another thing that you want to do is that you want to renew the alerts before they expire. So, on standard plans after around two month months the alerts expire. So, make sure to review them. And as I said, to make this workflow, you know, work as well as possible, I do recommend you know, trading the premium or even higher. Uh and as I said, I do have a special link for trading the premium. It will be in the description as well as the pinned comment. But all right guys. So, this course is actually, as you can see, it's getting pretty long but we have covered everything. If you made it all the way till the end here, I first of all want to you know, thank you all so much for watching. By now, you actually know, which is you know, pretty impressive.

**[59:14]:** You know how to build a trading bot from start to finish. No coding. You know how to build a trading bot. I hope that is amazing. If you are you know happy with the course and feel like you learned anything new, the absolutely best way to you know support me, support the channel and show your appreciation is to drop a like. Another thing I want to mention is that you know as I think I mentioned earlier in the course, I have made a complete study guide with all the prompts from this course so you can follow along exactly and lots of bonus material and so on and so on. I have made that study guide. It's a PDF file. It's available for all our YouTube channel members, gold and higher. If you didn't know, we have an amazing community right here on YouTube where I share you know bonus material like that guide.

**[1:00:09]:** I also have things like you know my own created TradingView indicators. I have exclusive videos and much much more. So if you did enjoy this video and want to get more and support the channel at the same time, please consider becoming a channel member by clicking join down below. After clicking join, I have a little video where I explain the membership. So if you want to do that, that would be awesome. And also guys, if you yeah if you made it all the way here, please comment down below and write full course. That is a good way for me to understand that okay this is someone that actually watched the full course. I'm very I'm much more likely to answer comments from you guys. And it's also a good way to kind of confuse the rest of the audience a little bit. They tend to you know be a little bit confused when there's so many full course comments.

**[1:00:58]:** So that is awesome. And of course, if you have any questions or you know feedback, let me know down in the comments below. But yeah guys, I hope you enjoyed this course and for now take care. All right, so now when you know how to build an AI trading bot, you might be interested in how you can use this cloud and TradingView connection to do other kinds of technical analysis. To do that, I highly recommend to watch my full course on how to use TradingView and cloud together.
