How To Actually Find A Profitable Strategy With Claude

Kurze Zusammenfassung

In diesem Video wird erklärt, wie man mit Claude profitable Handelsstrategien findet und diese in einen automatisierten Trading-Bot umsetzt. Der gesamte Prozess wird Schritt für Schritt dargestellt, einschließlich der Auswahl der Strategien, der Testmethoden und der Ergebnisse.

  • Finden von profitablen Handelsstrategien
  • Umsetzung der Strategien in einen Trading-Bot

Überblick

Das Video beginnt mit einer Vorstellung des Moderators Brendan, der über seine Erfahrung in Mathe und Wirtschaft an der UCLA sowie in der Investmentbanking-Branche spricht. Er erklärt, dass das Ziel des Videos darin besteht, profitable Handelsstrategien zu finden und schließlich einen Trading-Bot dafür zu erstellen. Es wird darauf hingewiesen, dass das Finden von strategischen Tipps einfach ist, aber die bedeutende Herausforderung darin besteht, diese Tipps im realen Handel rentabel zu machen.

Strategien finden

In diesem Kapitel geht es darum, wie man Claude nutzt, um Handelsstrategien zu finden. Brendan hebt hervor, dass es wichtig ist, zwei Hauptfaktoren zu berücksichtigen: die Überwindung einer Passivstrategie wie dem Kauf und Halten des SPY und die Fähigkeit, über verschiedene Marktbedingungen hinweg konsistent zu sein. Der Fokus liegt auf der Entwicklung eines Portfolios aus unkorrelierten Strategien, um die Gesamtperformance zu steigern.

Strategien testen

Hier zeigt Brendan, wie man Sicherheitsprüfungen für die gefundenen Strategien durchführt. Es wird erläutert, wie wichtig qualitativ hochwertige Daten für das Testen der Strategien sind. Brendan gibt Beispiele für verschiedene Datenquellen, die man verwenden kann, und betont die Notwendigkeit, in guter Qualität zu investieren, insbesondere bei schnellen Handelsstrategien, die Tick-Daten benötigen.

Strategieergebnisse

In diesem Abschnitt werden die Ergebnisse der getesteten Handelsstrategien präsentiert. Brendan spricht über die Erfolgsraten der Strategien und erklärt, dass nur eine geringe Anzahl von ihnen in den finalen Auswahlprozess übergeht. Er erläutert die Gründe für das Scheitern diverser Strategien und zeigt, welche Strategien sich als robust und wertvoll erweisen.

Handelsbot erstellen

Abschließend erklärt Brendan, wie man einen automatisierten Handelsbot basierend auf den zuvor getesteten Strategien erstellt. Er empfiehlt den Einsatz von APIs wie Alpaca für den automatischen Handel und beschreibt die erforderlichen Schritte zur Einrichtung des Bots. Zudem wird betont, dass eine Risikokontrolle und tägliche Überprüfungen wichtig sind, um die Effektivität des Trading-Bots aufrechtzuerhalten.

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 Find A Profitable Strategy With Claude“. Klicke auf einen Zeitstempel, um das Video an dieser Stelle zu öffnen. Du brauchst ein anderes Video? Nutze den YouTube-Transkript-Generator.

0:00 In today's video, I'm going to show you how to actually find profitable trading strategies with Claude. I'll go over the entire methodology step by step so you'll know what to trade, where to get the data, and how to test properly. And make sure to stick until the end of the video as I'll take that same exact strategy and show you how to turn it into your own automated trading bot with Claude so that the whole thing runs completely on its own. I'll run this entire process step by step. So you'll see my actual results, what failed, what succeeded, and then the final strategy portfolio that this turned into. Now, if it's your first time on the channel, my name is Brendan. I studied math and econ at UCLA, spent three years in investment banking, and have been building out these custom AI trading systems for my clients for the past 2 years. And as always, this isn't financial advice, and I'm not guaranteeing any profits in this

0:46 video. Just showing you the data and methodology here. Now, before you find profitable strategies with Claude, I want to cover three main points. The first is that finding a strategy that looks profitable isn't the hard part. Claude can literally hand you 10 profitable back tests in an hour. But the hard part is finding ones that are worth running. Now, this comes down to two things that I've written here. First is beating what you can do with zero effort at all, which is buying and holding spy. And then the second is doing this consistently over a long period of time through completely different types of markets. So the entire methodology and process in this video is built around these two components. Now the next thing to know is that the number of trades in a strategy isn't the most important thing. Some of the best strategies only fire a few times a year and they survive real testing. And secondly, but more

1:31 importantly, why this doesn't matter is because our ultimate goal here is a portfolio of all uncorrelated strategies. So even if we had for example a strategy that fires a few times a year, we would combine that with strategies that do trade more often perhaps every single day or intraday. So that way the whole portfolio combination does have a healthy mix. So here on the end goal, it's a portfolio, not just one single strategy. This is where beating the market actually comes from. And later on in the video, you'll see why this is so important to combine strategies. So moving on, before we even touch any strategies or data, we need to figure out one, what we actually want to trade, and then two, what time frame we want to trade it at. Now, this choice here matters because at the end of the video, if you are interested in automating your strategy and turning it

2:17 into a trading bot, a daily system here is going to be the most simple, right? It's going to wake up once every day after close, check the signals, place orders for you if your strategies hit, and then go back to sleep until the next open. Basically, almost nothing can break inside this daily trading bot. But once we run into intraday, there's a lot more moving components. It has to run live all day, every day. It needs a live data feed coming in. It needs a server that never sleeps. So, you can either host this directly on your local computer or use a VPS, which I've covered in my previous videos as well. Both are doable, but I'd recommend daily if it is your first time building a trading bot since there's less things that could theoretically break. Now the last thing we need to consider before finding strategies with Claude here is data. Now data is probably the most important backbone for not only testing

3:03 strategies but also running automated strategies as well. Claude by itself can't generate data for you. You need to connect to an external service like Yahoo. If you're using free data or any of the paid data providers like Massive and Data Bento. So if your data is bad, you're not going to be able to reliably test the strategies that Claude gives you. So if you were to for example test like a daily swing strategy on big ETFs the data is completely free. And then for crypto specifically if you need just daily data or data throughout the day. So intraday data it's all free and that's just because exchanges basically give it away. Now if we go to intraday data whether you want minute level data or hourle data futures is paid only but paid just means like a few dollars from a professional vendor. As you'll see later in the video, one of the surviving strategies that Claude gives us that

3:49 we're actually running is running on NQ features data that literally just cost me a few dollars. And then for the most expensive data, we have this bottommost scalping. And this is where we'll need tick data, which is a record of every single trade in quote. And it has to be high quality. So at this speed, whether you make money is mostly about fees, whether you can get filled at the price you think. Now, if you want to use the same highquality data sources that I have for free, I have all these resources plus step-by-step guides on building trading bots and strategies across any asset class in my community. I currently run the largest AI focused trading community on school where we have hundreds of members all building out their own trading bots and systems ranging from stocks, crypto, options, and even futures. So, make sure to click the link in the description if you're interested. Now that we know the time

4:34 frames and the type of data that we need for our potential strategies, this next step is where we're going to ask Claude to actually find candidates for us. So, the idea here is that we're going to have Claude go through three checks that I'll show you the exact prompt for, where it's going to take into account the type of things you want to trade, where your goals are. So, the first check that's going to be built into the prompt is to make sure that the strategy candidates are old, simple, and published. This video is meant to be accessible for people at every level. So, we're starting from tried and trueue strategies as the baseline. Everyone knows them. There's decades of research attached to them as well. But if you do want to get into more advanced strategies, the exact same process that I'm doing here and the prompts I'll show you can be tweaked or adjusted so that you have more variations to test with. So, you can think of the candidates that we're finding right now as the baseline and then you can layer on any more

5:20 advanced properties like machine learning on top if you need to. Now, the second check that's going to be built into the prompt is just to make sure that the strategy makes sense. There's a reason it pays. We don't want to just find random patterns. And then finally, but most importantly, is that it fits the asset. So all assets pretty much trade differently. Gold trends, it barely mean reverts. Whereas if you were to trade like SPY, an ETF index, you're going to see mean reversion across a few days. This diagram goes into a bit more detail about how SPY, QQQ, gold, NQ or MNQ futures, single stocks, or sector ETFs trade. And because these underlying assets all trade differently, the strategies that you're going to run on top of it is going to be different as well. So that's why you need to first figure out the market. So which market you want to focus on and then the time frames, which I talked about earlier.

6:06 Now, this is the prompt that connects everything we talked about together. You can just run this on the web. So claw.ai. And then what we're going to do is propose 10 trading candidates. And you can up this number. It's 2000 if you want to on and then your market. So this is where you decide if you want to find strategies on gold combination of gold and like QQQ if you want to focus on futures and then on top of the market we'll also need to know the time frame and then these just build in all the checks that I just talked about. So what we're doing here is kind of nudging claw in the right direction and making sure it gives us a pretty well thought out and reasonable list of candidates based on more tailored information like the markets time frames. And this way you'll get a much better output than just what are some potential trading strategies. And just to show you how simple yet effective this can be. Uh by the end of

6:53 the video I have a portfolio of five separate strategies. So this is only example of the simplest one there that Claude found for us as a candidate. So the rule here is simple. If QQQ is above its 200 day moving average, you would just hold QQQ. And then if it's below, you would just hold gold. This only trades about five times a year. super low volume but highly effective at around 153% returns and beat buy and hold QQQ significantly through all of our robust testing and then obviously with just five trades a year we had to go through more robust testing so we went through the past 50 years of history not just five to make sure that there were enough trades to validate this specific subset of strategies. So the whole goal of this step is just to find five to 10 testable concrete trading strategy candidates and you

7:38 don't know yet which of them will survive. So this is obviously the final filtered version. But if you were to run that prompt and found 10, 20 or even 50 strategies, you would then use the next steps to actually test and validate those before getting to your final portfolio. So after you run that first prompt through Claude on the web, you get your list of candidates, whether it's 10, 20, or 50. We'll take those candidates, build a whole testing system around them, find out which ones are worth running, and then creating a portfolio at the end. Now, this is going to be a bit more complex than just using Claude on the web. Since we're going to have it create this entire system for us, what you'll first need to do is start up Claude Code. The easiest way to do that is just with VS Code. It's an IDE. You would just add Cloud Code as an extension. So from the beginning of the video, if you find out that you do want to go for intraday data or paid data,

8:25 this is where you would drop the data into your project folder. So with the first two steps done, you already have your project created. You already have the data dropped in before we're using cloud code to do anything. And then after this, this is where we're going to start actually building the project. So we're going to set rules, create the testing engine to find out which strategies we should include in the portfolio, find the run and results, and then finally automate everything with the trading bot. Now that we have our cloud code project created, we can begin building our system. So this is the very first prompt that you'll run inside your Claude code project. And it's probably the highest value prompt in this whole entire video. All it's saying is that before any testing happens, Claude writes down what you're about to test. So the idea, the exact rules, the settings, and what counts as a pass. And then Claude's going to keep all these files automatically so you don't have to

9:11 manage anything yourself. This gets super helpful once you start testing tens to hundreds of different parameters of your strategies. So here in this prompt you can see we have brackets where we actually paste in all the list of candidates that we got from the last step. So from that first prompt where we got our list of either 10, 20 or 50 trading candidate strategies, this is where you're going to paste it in. And then at the end we're going to indicate what data sources you were using. So for all of my trading strategy candidates that I got from Claude, these were all on daily time bars. So we're just going to use Yahoo Finance as the free data source. But if you do want to use Intraday premium data sources, just drag in all the data and then you're just going to say at the end of the prompt what data source you're using so they're able to pull the right data for you. Now that we inputed our candidates to the Cloud Code project and then set the initial rules, we can now have Claude Code build a testing engine. Now, this

9:58 is going to take one prompt, which I'll show, but before I show you that, I want to go over the rules for the actual testing engine. Now, the first rule for testing is called splitting your data, and that just means that Cloud splits all history into two chunks. So the idea here is that there's an older chunk, in my case 2010 through 2022, and that's where all the building and picking of strategies happen. And then there's a newer chunk of 2023 up to today. And this is basically completely sealed off until the very end, and it's only used for scoring. Now, the reason for this is because any strategy can look perfect on data it's already seen before, but what we need to do is test on data that it's never seen before. This is basically called out of sample testing where the data the strategy builds on is called in sample and then you test it out of sample with sealed data. So basically you build on old data and then you test

10:44 on new data. Now the second rule here is that costs are always on. So this includes transaction fees, financing and dividends. So like a couple basis points per side on ETFs, few dollars round trip on futures and financing costs whenever there's leverage. And then this is also where we're going to be modeling slippage as well. Now, this might not be as relevant if you're trading daily bars, but if you're scalping or you're using a more intraday data, then costs basically scale with volume. So, if you have a strategy that's trading like 250 times a year, you need to model all those costs, which is what we're doing here. And then finally, the third rule is no seeing the future. So, this strategy only uses information that would have had at the time. So, it decides on yesterday's close and then trades at the next open to eliminate any look ahead bias. And it's important to explicitly state all these three rules

11:30 inside your prompt because if you don't, Claude can show you tens to hundreds of successful back tests that if you take to the live market, they wouldn't actually be profitable because one, you're not doing out of sample testing, so it's already seen the data before, or two, you're not modeling any costs associated with making those transactions, and then three, it's actually peeking ahead to data that it shouldn't have seen yet. So this is the next prompt you would copy and paste into your cloud code project right after the one you pasted before. Now that we've built the back testing engine, we can now start actually running the strategies to see what survives. And this is the fun part. We already have all the rules written down. So the prompt here is super simple. All we want to do is run every single idea logged inside the ideas file that Claude created for us. And then we want to add every variant tested to the running count. We want to report the tables.

12:16 This way it'll give you a whole rundown of all the strategies, variants, and how they performed. Now here you can see the dashboard it created. So, my search ended up being around 155 ideas, running everything through the sealed test windows that we created, pretty much removed almost all of them. And then after we added in extra filters, which I'll show you in the next step, we only have around five strategies left standing. And then these five strategies here is what got combined into the final portfolio. Now, our survival rate here is pretty low, 3%, which is good since we do want to filter out all of the potential candidates that Claude gave us to find the ones that are actually profitable and worth running. So, if you were to scroll down, we can actually see the survivor rates by strategy family. So, out of intraday, there was only one strategy that survived, and that's a

13:02 strategy on NQ, which I mentioned we'd have to pay a few dollars in data for. Claude also gave us some single name momentum strategies that really only worked on one. We have two trend and momentum strategies, two mean reversion strategies, and then one crypto strategy as well. So this is what basically all got combined into our portfolio. If you scroll down more, we can even see what caused most of these strategies to fail. So out of the trend and momentum family, almost all of them failed except for two. And because of all the rules we set, it's nice that we can have a reason as to why we shouldn't run these strategies. This way we can see the individual issues with each of these strategies. If you go to mean version, same thing. Only two out of the around 12 did work. And then we also covered intraday calendar events as well as

13:48 pairs. So futures, cross assets, crypto, and overlays. Now, like I mentioned, we added additional filters. So just surviving the test window wasn't enough. We wanted to make sure that the winner of the search was pretty much wellverified and validated. So put plainly here, we have another prompt that adds three additional filters. The first is stress testing on a different era. basically finding the worst decade you can. For us, that was 2000 to 2009. This included the dotcom crash plus the financial crisis. And that decade pretty much removed almost all the strategies that looked fine recently. From our initial claw trading candidates, there was actually a leveraged QQ idea that pretty much drew down 85% here. The second is family consistency. We want to make sure that the whole neighborhood of settings work and not just one lucky

14:33 combination. And then finally, we have a plateau test here. And this is how you tune parameters without it turning into curve fitting. So the idea here is that you only trust an optimized setting if the performance is smooth across the nearby settings. And then the ranking on training data roughly matches the ranking on test data. So this is the exact prompt that you would again run inside your cloud code project right after the last one. This is how you're going to run those same three exact checks that we just talked about. So if we were to scroll through our filters, we can see that after the first filter, which was 2000 to 2009, it pretty much removed almost all strategies except for these. And then if we scroll down, we also have this plateau test here. Now, here are the five final strategies that survived. All of them again, old, published, and simple. So the first is

15:19 the exact strategy I showed you back in step three, which is the trend core. So QQQ above the 200 day, hold QQQ, below it, hold gold on the test window 33.8% 8% a year at a sharp of 1.66. Now, the second strategy here is momentum rotation. So, once a month, you hold the five ETFs out of a universe of 50 that are closest to their 52- week highs and then you go to cash when SPY is below its 200 day average. Then, we have a dip buyer on SPY. So, when the close lands in the bottom 10% of the day range and the index is still above its 200 day average, you buy and then you exit on a strong close or after 3 days. And then next, we have this NQ opening range breakout. So you trade the break of the first 30 minutes is range. And then this final strategy here is actually more so a sizing layer. The idea is that you

16:06 would scale positions so that the portfolio runs around 20% volatility. Now this last prompt here is where we take all of our survivors and then combine them into a portfolio. So when you have strategies, there's obviously stretches of times where it wins and stretches of times where it either does nothing or loses. So from our portfolio five, the trends strategy struggles basically when the market is choppy. Uh the choppy markets are when the dip buyer probably does the best. The futures NQ strategy is pretty isolated from what stocks are doing. So this step here is basically going to blend them together, figure out the correlations. Then we want to weight certain strategies to get either less money or more money to have a more balanced and wellperforming portfolio. So the idea here is that we're not really adding anything new. There's no new signals or tuning. All we're doing is taking

16:51 strategies that win and lose at different times and then smoothing them out with one another. And then more importantly too is obviously as you add more strategies to your portfolio, you would essentially repeat this combining step forever. So each time you add a new strategy and it makes it through to this final process, whether it's a simple one or something more advanced, you would essentially just run this again to figure out first what the correlations are with your current strategies. And this way it can just be another leg inside the portfolio. So here in our dashboard, you can see the leg correlations. And then if we scroll down, we can see how our leveraged version of the three-legged blend actually beats buying and holding QQQ and Spy. Now, to finish rounding out our portfolio of strategies, we need to figure out risk management and position sizing. So, first we want to find out how much we want to risk per individual

17:37 trade. Second, we want to look at the portfolio as a whole if we have like a target volatility like 20%. And then third, we have leverage. So, we need to figure out the ceiling and floor of leverage in the portfolio. So here we're utilizing more of Claude's general intelligence more rather than telling it exactly what to do. So first we're hard coding the individual trade, but then we're going to have it then build a levered version of our portfolio and then give us an honest read on when the leverage helps or when it hurts. And then for the very very last part of this whole entire process is something called strategy decay. So all this means is that strategies stop working over time. Whenever you find successful strategies, they get crowded out and then arbited away. This just means that once enough people are trading the same edge, that edge goes away. So the best way to think

18:22 about this is that any specific strategies that you get from Claude are temporary. But the more important thing is this whole entire process that we went through in this video because this way you can just continue to find new edges and continually test. Once the strategies start performing, if it's worse than random or the draw down start increasing, you would then repeat this whole exact process again with finding new strategies from Claude. So this is the final prompt. It essentially just writes shut off rules before the system goes live. So, it halts new entries and alerts if rolling performance drops below either what random entries would produce or if the draw down just goes past the worst back tested draw down. And then the idea here is that you would run this daily check every single day. Now that we finished building out our strategy portfolio, this last part, if you're interested, is probably the most value ad since most people don't want to

19:08 be staring at a screen all day. And this is where you can actually automate the strategies and build a trading bot with Claude around the strategies you just created. So the good news is you already did most of the hard work. This is literally the easiest step. All you need to do now is connect to a broker that actually allows for automatic trades via API. And the top two I'd recommend are either Alpaca or IBKR interactive brokers. Alpaca is the easier one to get started for beginners since it's free and it covers stocks, ETFs, and crypto. So, all you would really need to do is head over to Alpaca's website, sign up for a free account, get your API keys, and then come back here, and then run this final prompt. With this prompt, Claude will essentially wire everything up, and then store all your information inside a settings file in the project. And then finally, you would just paste

19:53 your API key directly inside the project file. That way, Claw doesn't actually read your own API keys, and you can get hooked up right away. So once this is connected, if you have a daily bot, just make sure your local machine or your computer is turned on every single day. It's going to wake up after the close, check signals, submit orders for the next open, log everything, and then go back to sleep. So you don't have to touch anything. The only thing you have to make sure is that Claude is in hard limit. So that's why we had the risk and sizing. Want to make sure there's a cap on position size, a cap on how many positions can be open at once, and then a kill switch if something looks wrong. Ideally, you'd want to paper trade for at least a month or two to make sure your strategy is working in the live markets before you ever connect it to a live account. Now, if you found this video helpful, make sure to like, comment, and subscribe as I cover everything regarding trading with AI,

20:40 whether you're trading stocks, options, crypto, and futures. And like I mentioned in the beginning of the video, if you are interested in diving a bit deeper and getting full in-depth guides for building out these trading systems and bots, make sure to click my link in the description for my AI trading community.

Share

Weitere Video-Zusammenfassungen