how to actually build an ai trading bot (full guide)

Kurze Zusammenfassung

In diesem Video zeigt Miles Deutscher, wie man einen funktionierenden Handelsbot für Krypto oder Aktien erstellt. Er spricht über die Potenziale und Herausforderungen beim Einsatz von KI-Trading-Bots und gibt praktische Schritte, um einen solchen Bot von Grund auf zu bauen.

  • Die richtigen Erwartungen an AI-Trading-Bots kennen
  • Gründe, warum viele Bots scheitern
  • Schrittweise Anleitung zum Aufbau eines erfolgreichen Bots

Einführung

Miles stellt das Thema vor und erklärt, dass im Video gezeigt wird, wie man einen funktionierenden Handelsbot für Krypto oder Aktien von Grund auf erstellt. Er weist darauf hin, dass die Realität oft von den Vorstellungen abweicht, die Menschen über Handelsbots haben. Er hat sowohl profitable Strategien entwickelt als auch Misserfolge erlebt, aus denen er gelernt hat. Es wird betont, dass kein Programmierwissen erforderlich ist und die Schritte einfach erklärt werden.

Was ist ein KI-Handelsbot?

Ein KI-Handelsbot automatisiert die Handelsstrategie und führt Trades besser aus als ein Mensch. Der Nutzen eines Bots liegt in der raschen Ausführung geplanter Strategien, ohne emotionale Einflüsse. Bots lernen aus ihren Fehlern, was ihre Leistung verbessert. Miles erklärt die grundlegenden Funktionen eines Handelsbots und hebt hervor, dass die Nutzung von Bots zunehmen wird, da immer mehr Händler und Institutionen diese Technologien übernehmen.

Warum scheitern die meisten Bots?

Miles nennt vier Hauptgründe, warum Handelsbots Geld verlieren: fehlende Gedächtnisfunktionen, unklare Ziele, mangelnde Berücksichtigung zukünftiger Marktbedingungen und weit verbreitete Nutzung von vorgefertigten Bots. Er betont, dass erfolgreiche Bots in der Lage sein müssen, zu lernen und sich anzupassen. Ein Bot ohne Gedächtnis kann nicht aus vorherigen Fehlern lernen, was zu wiederholten Verlusten führt.

Ihre Optionen & Aufbau eines Bots

Es werden drei Optionen vorgestellt, um Handelsbots zu nutzen: den Kauf fertiger Bots, die Verwendung von No-Code-Plattformen und das Erstellen eines eigenen Bots. Fertige Bots bieten wenig anpassbare Kontrolle, während No-Code-Plattformen etwas Anpassung ermöglichen, aber schnell an ihre Grenzen stoßen können. Der Aufbau eines eigenen Bots gibt vollständige Kontrolle über Gedächtnis und Daten, was in der heutigen Zeit relativ schnell machbar ist.

Schritt 1

Der erste Schritt ist die Wahl des Handelsplatzes, wobei die Entscheidung zwischen Aktien und Krypto wichtig ist. Miles empfiehlt spezifische Plattformen und erklärt, wie man API-Schlüssel erlangt, um einen Bot zu verbinden. Er hebt die Bedeutung des Testens durch Paper-Trading hervor, bevor man mit echtem Geld handelt, um Risiken zu minimieren.

Schritt 2

Im zweiten Schritt geht es darum, eine Handelsstrategie zu wählen und den Feedback-Mechanismus zu definieren. Die Strategie sollte zu Beginn einfach sein, um sich mit den Grundlagen der Bot-Ausführung vertraut zu machen. Miles empfiehlt, die Strategie zuvor mit Backtesting zu überprüfen und ein Dokument zu erstellen, das den AI-Bot über die individuellen Handelsziele informiert.

Schritt 3

Im dritten Schritt wird erläutert, wie der Bot ein echtes Gedächtnis erhält, um sich im Laufe der Zeit zu verbessern. Es wird ein System mit zwei Dateien vorgestellt: einem Protokoll über alle Trades und einer Datei für Lernergebnisse, die den Bot darauf hinweist, was in der Vergangenheit funktioniert hat oder nicht. Dieses Gedächtnis ermöglicht es dem Bot, aus seinen Erfahrungen zu lernen und seine Handelsentscheidungen zu verbessern.

Gedächtnis ist der Schlüssel

Ein Bot, der sich an frühere Trades erinnert, kann bessere Entscheidungen treffen und bestimmte risikoreiche Trades meiden. Miles hebt hervor, dass ein Gedächtnissystem entscheidend für den langfristigen Erfolg eines Handelsbots ist.

Ihre Hausaufgaben

Miles fordert die Zuschauer auf, anhand der in dem Video gegebenen Informationen ihren eigenen Handelsbot zu erstellen und zunächst mit Paper-Trading zu üben. Er ermutigt dazu, erst mit echtem Geld zu traden, wenn man sich sicher fühlt.

Outro

Im Outro fasst Miles die wichtigsten Punkte zusammen und betont, dass der Einsatz von Trading-Bots in der Zukunft zunehmen wird. Er lädt die Zuschauer ein, den Kanal zu abonnieren, um über weitere Entwicklungen und zukünftige Videos informiert zu bleiben.

Fasse jedes YouTube-Video in Sekunden zusammen

Hol dir Zusammenfassungen wie diese für jedes Video, in deiner Sprache, mit der kostenlosen Summ-App.

Laden im App Store
Jetzt bei Google Play

Transkript

Vollständiges Transkript von „how to actually build an ai trading bot (full guide)“. Klicke auf einen Zeitstempel, um das Video an dieser Stelle zu öffnen. Du brauchst ein anderes Video? Nutze den YouTube-Transkript-Generator.

0:00 I'm going to show you how to build a trading bot that actually works, whether you trade crypto or stocks. I'm going to run you through how to build one from scratch and what they're actually good for because it's not what most people think. You've probably seen the promises that AI trading bots are like these magic money printers, but the reality is different. They can be highly profitable. I've personally built strategies which have made me over $8,000 a week in pure profit, but I've also had trading bots, especially towards the beginning of my journey a few years ago, which went horribly wrong and cost me tens of thousands of dollars. But, I learned from those mistakes and learned how to set up trading bots the right way, bots that automatically get smarter over time and bots that don't fail. The best part is you don't have to be a coder for any of this. It's actually quite simple. You

0:45 just might need to get your hands a little dirty, but I'm going to walk you through step-by-step so you don't get lost. And by the end, you'll know how to actually build a trading bot that works. And you'll also know the one mistake that kills people's trading bots so you don't make it. All right, firstly, let's talk about what an automated AI trading bot actually is. A bot essentially does two things. It automates repetitive strategy and it executes better than a human. I used to find in my trading, I'd have the right ideas, but I'd have an execution problem. I'd have a setup, but I wouldn't be at the desk to execute the trade. I wouldn't be able to manage the trade once it's open or I would simply forget to manage the trade and that would result in me losing money. The real value add of a trading bot is that it can execute based on a predetermined strategy that you've given it. And the

1:31 really important thing which we're going to discuss today is that these bots actually learn over time and they get smarter over time. They learn from their mistakes probably even better than a human because it's coded into the AI. Whereas as a human, you need to go through a lot of psychological reflection to work out why maybe you're not succeeding as a trader. So, ultimately, I view trading bots as a way to get razor sharp execution and I do think over time more and more people are going to be using trading bots and in a few years pretty much everyone will be using one whether they know it or not because the big funds and the quant firms, they are already doing this. Retail just isn't fully up to scratch yet. The best part about a bot is that it doesn't flinch, it doesn't get scared, it can execute without emotions and that's what actually catches most traders out. So if your problem was ever execution as it is for most people, then

2:17 building a trading bot should really help you. And the loop of a trading bot is actually quite simple. You set up the parameters, it executes based on those parameters, it learns from those parameters and then it goes again. And this loop can automate around the clock 24/7 even while you're sleeping. And some of my bots where I've made over $8,000 in a week, these have actually executed some of my best trades when I wasn't awake. Especially if you're not available all day or not on US hours, I think that's one of the biggest value props of automating your trading. But I want to make it clear this isn't a magic fix. I do think this stuff is getting better and better and being at the cutting edge of it like I'm trying to is a big advantage, but this isn't a full replacement for discretionary trading. I view trading bots as a great attachment. So you can have discretionary ideas, ideas that you think will help you get an edge in the market and then you use a

3:04 trading bot for the execution piece. That's pretty much how I use them in my day-to-day life. And then over time, you can start to knowledge compress. So take strategies from yourself and from others that you want to implement and train the AI to do so automatically. So before we get into how to build a winning trading bot, let's firstly discuss why most trading bots lose. They're usually four reasons why trading bots lose money. The first one is they don't have memory. So basically it'll open a trade or it'll execute something based on its preset parameters, but then it doesn't learn, improve, and iterate over time. I'll be showing you a memory system in today's video which pretty much makes that mistake irrelevant. Secondly, people set up trading bots with no goals or no objectives. So they'll set a test, but they won't define the parameters for that test. So then you're basically

3:49 trading blindly. The bot isn't getting smarter, the bot isn't necessarily optimizing, it's just running on its own accord. So, without a goal and an objective and without actually implementing that data, it's basically just winging it. The third reason bots fail is because they don't take into account future conditions. Bots are trained on past data. So, you need a good system to forecast data and some of that is discretionary. Some of that can't be automated, but you can obviously build good market scraping systems to plug into the bot to give it more informed information. Human traders can be very good because they adapt to the market very quickly and humans have like this creativity element that bots don't have. We can actually forecast data. Whereas AI models in general, they're all trained on past data. So,

4:35 you actually need to manufacture things and you can use that to your advantage, but you have to set things up properly so the AI can actually execute based on future expectations. And fourthly, the reason why a lot of trading bots fail is because a lot of the pre-packaged bots simply too many people are using. So, they actually lose their edge in the market. So, if you just go out and buy a popular bot that hasn't been backtested, that doesn't have an edge, you're probably going to be competing against other traders running the same strategy. So, it's important to work out your own strategy or use a bot that millions of people aren't using. In my opinion, to summarize what makes a good bot, it remembers, it gets smarter over time and it's actually yours. So, it's configurable based on your beliefs and based on the data that it accrues. So, now you know why most trading bots fail and you know what constitutes a good

5:21 trading bot in my opinion. Now, let's move on to your options. What is currently available in the market right now for you to use? Now, there are a few and they all make sense for different people and different skill levels. So, let's run through them. Firstly, you can buy a ready-made AI bot. These are maybe some of the bots you've seen advertised on some platforms or built into an exchange with pre-configured parameters. These aren't necessarily bad. In fact, they don't require any effort, so that is a good thing from a setup and time perspective, but ultimately you don't have your own edge because it's a black box. You don't know exactly how they're trained, and even if their algorithm is public, you have no ability to influence that algorithm. So, you're at the behest of the platform that you are using. Good option for people just trying to dip their toes in the water and maybe use a trading bot on an exchange, but maybe not so good for people that want proper

6:07 customization, which I do believe is very important because the way that you run your portfolio or your trading is going to be different from how I run my portfolio or my trading. So, we need our bots to reflect the very unique differences in both of our goals, and the only way to do that is through customization, which brings me on to point two. You can use a no-code platform. So, this is a platform that gives you some customization, but isn't a full black box. So, you've got Composer for stocks. You've even got Robinhood now who launched their agents. You don't have full control, and they don't make it open source for you to necessarily connect an API and do things yourself on their exchange. Maybe they'll add it in the future, but for now, you're limited to the options that they're giving you. These are definitely better than the previous option, but I do feel like you're going to hit your ceiling fast, and it's going to limit

6:53 your ability to progress over time. But, I'm definitely still experimenting with some of these, and I think for some traders it makes sense. Like, setting up a grid bot, setting up DCA bots, setting up basic portfolio management based on preset parameters. It makes sense for some people, but for people that want a fully autonomous strategy, you're going to cap out with these types of systems. And thirdly, this is something that previously used to take months to do, but now you can do relatively quickly, as I'm about to show you, you can build your own trading bot where you actually own the memory system, own the data, and own the configurability. It's actually pretty wild to think that you can now have like an AI quant in your pocket, essentially, that can trade on your behalf 24/7. When, you know, previously this stuff was only reserved for the elite, and that's what these new frontier models like Claude and GPT have

7:40 now unlocked. And many exchanges and brokerages have actually embraced this cuz they understand users are using these products. So, we're actually going to create MCPs, which are the bridges between Claude and the exchange to enable you to automate your trading. And this has only really happened in the last couple of months. Like I've been using trading bots for 3 years, but it was only really this year that you could fully customize a bot. So, you're actually really early to this. If you're watching the video right now, make sure you subscribe to the channel cuz I'm going to keep updating you as things evolve because I think in the next couple of years things are just going to get better and better and better. So, I'm pouring a lot of time and resources into making sure I can get an edge with this kind of stuff. And I want you guys to come on this journey with me as well because I have a clear thesis that this is where the world is heading. I think

8:25 in the future we're heading towards a world where people don't just go into the computer or grab their phone and place a trade manually. I think people will be voice prompting agents. I think agents will be managing portfolios on their behalf. And I think the way you interact with exchanges and trading will be very, very different. want to be at the forefront of that. So, now I'm going to give you the three-step approach to actually build your own trading bot. And if somehow you get lost at any point, don't worry. In the description below for free, I'm going to have the full framework from today's video that you can actually just take and paste into an LLM like Claude or ChatGPT, and it will actually help you execute on your behalf. So, all you need to do is go down below, enter your email, become a part of the newsletter, and then you will unlock the WhatsApp community where in the pinned link you will be able to find the prompt from today's video. All

9:12 right, so let's get into the three steps. So, step one, picking your venue. Firstly, you want to determine what you're trying to trade. Is it stocks or is it crypto? And crypto now obviously has access to tokenized stocks and gold and these sorts of things as well, even perps trading. So, a lot of people that are trading stocks are now doing it through hyperliquid or through X tokenized stocks, but obviously that comes with its own trade-off. So, first and foremost, you want to pick which lane you're most interested in. So, here's the broader architecture for a trading bot, no matter if it's stocks or crypto. The brain is going to be your LLM. So, in this case, Claude. You can also use GPT. So, you're either using Claude code on the newest model, or you're using GPT's CodeX on the newest model. That brain is responsible for holding and executing your strategy. The hands, what actually delivers the

9:59 information to the exchange that's executing the trades, or you can think of it as a bridge, is the MCP server. That's the piece that actually enables Claude to place real orders on an exchange or a brokerage. And not every single brokerage has a connection, but there are a couple really good ones that I'll tell you today. For stocks, I personally use Alpaca, because they have an MCP server, which makes this easy. And this video's not sponsored by anyone, by the way. These are just the best solutions that I've personally found. It's free, it has paper trading, which is amazing, because you want to test this stuff out if you're learning on fake money. You don't want to go and, you know, blow real money and mess up a configuration. The best way to actually get started with trading bots is to do paper trading. Once you're comfortable, and once your strategy's working, then you move on to a bit of real money, and then you keep leveling up. But

10:44 essentially, you sign up for an Alpaca account, you grab your API keys, you give Claude the API, and then it uses their inbuilt MCP. It might sound complex, but honestly, it's easier than it sounds. The prompt that I'll give you will make this super easy, and Claude will just guide you through the whole process. And that's the benefit of using a platform that has an inbuilt MCP, so you don't have to build your own. You're not actually coding a connection, you're just plugging it in. This gives Claude the capability to pull live prices from the exchange and execute trades based on your strategy. For crypto, it's the exact same concept. You want to go straight to a crypto exchange. There are so many. Binance, Blofin, Bybit, Pionex. Pionex and a lot of other exchanges now, for example, have an inbuilt MCP that you can use, just like Alpaca, so you can connect the MCP to Claude. If you go

11:30 into to websites, they're usually available. If not, you can just ask Claude to help you connect the exchanges. Then you need to go into the exchange, take the API key, put it into Claude, and usually after 10 to 15 minutes, you'll be able to connect the two, even if the exchange doesn't have an inbuilt solution, which does make things quicker and more secure, but you can still use an exchange without an MCP if you work around it on Claude code. You can also use GPT for this. I think both are good. There's arguments that GPT is smarter or more reliable for coding now. So, I personally use a mixture of both, but I found Claude to be pretty good as long as you give it the right parameters, which we'll also discuss, cuz that's obviously the secret to creating a really good trading bot. One thing on safety, you want to make sure your funds, especially if you're connecting it through an MCP using an

12:15 API, in case your keys are exposed, in case you lose your device or something, that you actually create a sub account that only has a certain amount of funds that you're willing to give the bot access to. And a lot of exchanges actually have paper trading just like Alpaca, so you can actually just paper trade and test out your strategies, make sure they work, harden security over time before you move on to real capital. I think humans just learn the best by doing. So, if you're able to set this up yourself with paper trading, that's ultimately going to be the best tuition, and I think it's definitely worth the time. Step two, you want to actually pick your strategy and define the feedback loop. So, before any prompt, like open this trade for me, open trade under these parameters, you need to actually define the strategy. Because remember, the bot is only as good as the parameters that it runs under. Now, this

13:01 is a rabbit hole in itself, and I'm going to do future videos on back testing strategies, the best strategies. This is an entire concept for another time, but in the beginning, you want to start with a pretty simple strategy just to get used to the mechanics of running a trading bot. The best part is that you can actually just back test strategies now, especially now that Claude and TradingView actually have an MCP connection. You no longer have to do it manually on Pine Script. You can just connect Claude to TradingView. I did a video on it, go and watch it that actually shows you how to set this up and then you can just start back testing any strategy. Hey, what if the RSI hit this level and momentum did this? Hey, what if price spikes X% in a day, what happened if you opened a trade every time over the past 3 months? It'll tell you how much you would have made. So, I'd recommend back testing first, taking

13:47 a strategy which looks to be reliable and then using that strategy to start your trading bot experiment. And of course, you can just go back and forth with the AI about your trading style, your investment philosophy, what strategy you want to follow. Like I recommend before people even set up a trading bot, they do a bit of a back and forth to create a one-page document that they put in the instructions folder of GPT or Claude so the AI actually knows about you, your financial situation, and your goals. I think it's also okay to run a completely separate AI test, but if in the future you do want to make these strategies as I guess we're all aspiring to do, work within the broader context of your goals and your portfolio, then obviously you're going to need to create the documentation for that so the AI can tweak the strategy

14:32 based on that. For this video, I'll show you a very simple build that I'm using. It's essentially a moving average crossover. So, if we see a fast average crossing above the slower average, that indicates that momentum is increasing. That is our signal to buy. If it crosses back below, we're going to sell. Obviously, over time, you want to create parameters across what time frames, adding in other conditions, and the AI will learn over time, but I'm just showing this to you as an example. This is simple on purpose because this video's about the system. In future videos, make sure you subscribe, we'll dive deeper into the best strategies, but I want to make sure you have a full understanding today of what trading bots are. Of course, we'll just swap in a better strategy later. So, now that you have the idea, you can prompt Claude or GPT to build it. It'll define every interval. The bot will read its memory

15:17 and check the market through the MCP, and it will apply your rule to open trades, and obviously place paper trades in this example if it fires. So, a bot essentially has three jobs. It sees the market, but it decides whether it wants to execute, and then of course, if the parameters hit, it executes. You can see with this bot, it actually fired on the signal, but the trade loses. And then the same signal shows up again, and then it did the same trade again, but it loses again. This is because, and this is a common issue with bots, it has no memory. So, it never kept score of what's working, or critically reflected on why it's not working. So, this right here is an example of a bot that doesn't remember its own trades. So, it keeps repeating the same mistake. Every single time that parameter hits, it'll just execute because you've told it to execute. What I'll show you now, step three, is going

16:03 to give your bot real memory, so it self-improves over time. This is the step that really matters, and we create this through a two-file system. File one is going to be your ledger. It's going to log every single trade. It's going to show you what happened, when it happened, why it fired, and how it ended. And you'll actually be able to prompt and reflect on this data. The second file is going to be the learnings file. So, when a trade closes, the bot writes itself one plain English lesson. So, it lost on this setup, don't take it again without confirmation of XYZ. This really matters because every single time it trades, it's going to read the ledger and the learnings file, and then if it makes a mistake again, it's going to add to it. So, this is essentially giving the bot a brain that learns over time, just like a human does. So, if you're a trader, you'll know you get these intuitions, like, "Oh, I think the

16:48 market's going to crash. I think the market's probably going to go up." You might not be aware of it, but that's your mental algorithm based on past data that you've analyzed coming into account. You we're just engineering the exact same thing for the AI, but the best thing is, the AI will never make a mistake. Once you train it and set hard rules, it'll stick to those rules. Now, obviously, I've got to make it clear, sometimes AIs do hallucinate. Sometimes it'll break its rules, because these things aren't perfect, but having an understanding of how to set this up now is extremely beneficial, because in the future months and future years, these things will get near perfect. We know we're heading towards a world where AIs are smarter than us, more accurate than us, even though they might make some mistakes now. I mean, just look at how far they've come since I started using trading bots a few years ago. Like, they are already so much better and they'll keep getting better. So, if there are issues, just persist. It can be

17:34 frustrating, but that's actually how you learn and create better bots over time. Now, for the more advanced people, two files is okay to start. That is a workable memory system, but you may want to consider building a cloud memory system on something like Superbase or Supermemory or Firebase where your memory is actually stored on the cloud. So, it's the exact same idea, but it's actually a database instead of just files, so it can hold thousands of trades and a much bigger ledger that will be less intensive for the bot to review. Especially if you're a high-frequency trader, you're probably going to need to upgrade from the true file system after a few weeks of trading cuz you'll have so much data and it will actually slow your AI down. So, this time I'm doing a test where I gave the bot some memory. I set up this system

18:20 and if you actually run it again, the losing signal shows up, but this time the AI actually checks its own record. It sees it already lost on a similar setup to this, so it decides to skip it. This is the key. It's not just being cautious, it still takes good setups, but it skips the one that it loses from in the past. So, if you look at the two side by side, the bot with no memory just keeps bleeding on the same trade, but the one that remembers stops the bleeding and keeps the winning trades. Now, imagine this iterating over thousands of trades, it just gets smarter over time. So, that's the same strategy, but memory is the key differentiator there. But now, let's talk about the honest reality. Before you run a bot with real money, before you just copy a random strategy, make sure that you test something with paper money first. I'm going to give you some

19:06 homework. Go away, take the prompt from today's video available in the description below, build your own trading bot whether it's for crypto or stocks, and paper trade for a week, and learn to refine your memory system. Once you're confident, then start with a little bit of money, maybe 1, 2, 3% of your max risk tolerance, and then scale up over time. The majority of your losses are going to come in the early days as you're still figuring things out and as the bot is figuring things out, and things only become reliable as things develop over time. I'm going to be backtesting a lot of strategies on this channel. If you would like to subscribe, because I'm also in the process of trying to work out what the best strategy is. I found some which are amazing and have been highly profitable, but I think we can always get better by testing more data, and that's what I want to do here on the channel. The goal of today's video was to help you

19:52 understand what a trading bot is and how to actually set one up the right way, and then in future videos, we'll go in depth on very specific builds and strategies, and do lots of live tests because I'm just still experimenting all the time. I'm even doing a test right now where I've put Claude and GPT and other models up against each other to see which one is the best. So, that is how to build a real trading bot. I'll leave the prompt available below. It's in the WhatsApp community on the pinned link. And of course, if you want to keep leveling up your own trading and investing, subscribe to the channel as I'll be bringing you the AI strategies that can help you stay at the forefront and [music] the edge of the market. I'll see you in the next video. Have a lovely rest of your day. Peace out.

Share

Weitere Video-Zusammenfassungen