I Re-Created A Quant Trading Strategy With Claude Code (Insanely Cool) — Transcript
Full transcript
- 0:00I've realized something about trading.
- 0:02Average people who are trying to do day
- 0:03trading, even all the way up to
- 0:04professionals doing trading, they do it
- 0:07completely different than how hedge
- 0:09funds do it. Now, I want to tell you
- 0:11something that I've learned recently
- 0:13that completely shattered my view of
- 0:14trading. And that is that quants are not
- 0:18using trend lines and indicators on a
- 0:21chart to make their decisions. And you
- 0:23might be thinking, well, how on earth do
- 0:25you do it then? Well, that's exactly
- 0:26what I'm going to show you in this
- 0:28video. In the depths of trading Twitter,
- 0:30I found a thread by a person called
- 0:32Rowan. He is a quant. He makes tons of
- 0:35money as a quant. And he's laid out on
- 0:37the table all of the secrets that these
- 0:39hedge fund quants use that get them the
- 0:42results that they do, which outperforms
- 0:44your normal trader and is far more
- 0:45consistent, but significantly more
- 0:48complex. I've gone through all of his
- 0:50work on what's called the hedge fund
- 0:52method, and I've simplified it into a
- 0:54single video, and that's what you're
- 0:56watching today.
- 0:58So, in this video, I'm going to give you
- 0:59a few things. Number one, I'm going to
- 1:01share exactly what the hedge fund method
- 1:03is. Number two, I'm going to convert all
- 1:06of that hedge fund method into a format
- 1:08that is understood by AI. And then
- 1:10third, I'm going to give you an exact
- 1:12copy and paste prompt that you can put
- 1:14into your Claude code or any LLM right
- 1:17now and have this whole method installed
- 1:19into your own trading strategies. And if
- 1:22you're using Claude code, you can use
- 1:24this prompt as a skill in your AI. So,
- 1:27anytime you have a new strategy, it will
- 1:29automatically apply this method on top
- 1:31of it. And by the end of the video,
- 1:33you'll have all the tools necessary to
- 1:35operate like a hedge fund quant. And
- 1:37right after you subscribe, let's get
- 1:39into it.
- 1:49In this video, we're going to go over
- 1:50the 10 elements that make up the hedge
- 1:53fund method. And after all of that has
- 1:55been explained, I'm going to give you a
- 1:57couple of prompts. One is going to be to
- 1:59install this onto your Claude code or
- 2:01any LLM that you use, and the other one
- 2:03will be a visualization that you can put
- 2:05onto your TradingView chart using Pine
- 2:07Script. I want you to know that these
- 2:09prompts are entirely free for you to
- 2:12copy and paste and take. I don't even
- 2:13want your email. You can find those
- 2:15prompts on my GitHub link in the top
- 2:17line of the description.
- 2:20The first thing to understand is that
- 2:22these hedge funds and the quants are not
- 2:24operating using the same data that you
- 2:26and I are. I think for the most part,
- 2:28you and I go on vibes. Kind of like
- 2:30feeling our way around the investing
- 2:32that I've got a good feeling about
- 2:34Bitcoin or I've got a good feeling about
- 2:36Palantir, and it's all about feelings.
- 2:38Quants and hedge funds do their absolute
- 2:40best to quantify these feelings,
- 2:43actually put numerical values to them.
- 2:45It's a bit like going outside and
- 2:47saying, "Oh, it's windy today. I'm going
- 2:48to make this decision as a result."
- 2:50Whereas if a quant or a hedge fund went
- 2:52out there, they want a numerical value.
- 2:54How strong is the wind? What direction
- 2:56is it pointing? And then with those
- 2:57numbers, they can make decisions. So, I
- 2:59want to introduce to you something
- 3:01called states. Every hedge fund and
- 3:03quant will operate with these states.
- 3:05There are only three states. There is a
- 3:07bull state, a sideways state, and a bear
- 3:09state. Now, a bull state is defined as
- 3:12the last 20 days, when you add up all of
- 3:15the returns of the last 20 days, are
- 3:17they at 5% or more return? For example,
- 3:20if you had a 1% gain every single day
- 3:23for 20 days, that would represent a 20%
- 3:26gain and obviously would be in a bull
- 3:28state. If you had 15 of the days as a 1%
- 3:30increase, but five of the days were a 1%
- 3:33decrease, then overall you would have a
- 3:3610% gain over that 20-day period, which
- 3:38would again match the criteria for a
- 3:41bull state. Now, if the last 20 days
- 3:43were a -5%
- 3:45or greater, meaning -5, -6, so on and so
- 3:49forth, then And would be classified as a
- 3:51bear state. And anything in between is a
- 3:53sideways state. I know this sounds very
- 3:55elementary, but wait until you see how
- 3:57they use this information. And so, the
- 3:59next step of the process is obvious. We
- 4:01need to figure out what the state is
- 4:03currently. What is today's state? And
- 4:06so, what they do is they go back over
- 4:08the course of the entire asset history.
- 4:10Let's say it's Bitcoin. And they
- 4:12actually run an algorithm for every
- 4:13single day of the history of Bitcoin and
- 4:16label each day with its state. So, if
- 4:18you can imagine now, you've got the
- 4:19entire price history of Bitcoin or any
- 4:21asset, and every single day starting
- 4:23from the 20th day, cuz that's the first
- 4:26time you actually have a 20-day looking
- 4:28back period, all the way through to
- 4:30today has a label. And each day is a
- 4:33specific state. And this brings us to
- 4:35the third rule that they use as part of
- 4:37this hedge fund method. And it's
- 4:38something called the Markov property.
- 4:41And it's this whole idea that the market
- 4:42only moves to the next place as a result
- 4:46of where it is today. And it goes
- 4:48completely against the way that traders
- 4:50view things. They kind of look back
- 4:52throughout history and try to determine
- 4:54what's going to happen tomorrow. But the
- 4:57Markov property focuses solely on today.
- 5:00So, let me give you a bit of an analogy.
- 5:02Let's say you're driving from Little
- 5:03Rock, Arkansas, all the way up to New
- 5:05York City. The route you take to get to
- 5:08New York City will entirely depend on
- 5:10the starting location. This might sound
- 5:12very obvious, but let me make it even
- 5:13clearer. The way you get to New York
- 5:15City from Little Rock, Arkansas, is not
- 5:17the same way you get there from
- 5:19Nebraska. And it goes without saying
- 5:21that as you make your way on that
- 5:22journey, let's say you get to Ohio, for
- 5:24example, the journey to get to New York
- 5:26City from Ohio is also different. The
- 5:29journey to New York from Ohio is
- 5:32entirely unique. It doesn't matter at
- 5:34all that you started in Little Rock if
- 5:36you're in Ohio trying to get to New
- 5:38York. I hope I've made that quite clear.
- 5:40To summarize, the past doesn't really
- 5:42indicate where the future is going to
- 5:44go. And you might be thinking, "Well,
- 5:45Lewis, didn't we just do like the 20-day
- 5:48thing back in history throughout the
- 5:49whole history of Bitcoin? Why would we
- 5:51do that if the past was irrelevant? And
- 5:53maybe I was a bit extreme there, but the
- 5:55Markov principle really is looking at
- 5:58today. Today has the most weight, and it
- 6:01brings us to this thing called the hedge
- 6:03fund matrix, which before this video, I
- 6:05had no idea this thing exists, and it
- 6:07makes all the sense in the world. And it
- 6:10brings everything we've talked about
- 6:11already together. Now, with all that
- 6:13data that we've got from the entire
- 6:15history of Bitcoin, there are moments in
- 6:17time where the state shifts. So, we
- 6:20might go from a sideways market to a
- 6:23bull market, or a bull state. And we
- 6:25might go from a bull state to a bear
- 6:26state. And each one of those transitions
- 6:29is counted and logged. So, what they do
- 6:32is is that they look back in time at
- 6:34every time that transition took place
- 6:36between a bull and a sideways market,
- 6:38for example. And they tally them all
- 6:40down. So, we have now a complete record
- 6:44of the transitions that have occurred
- 6:46and how many times they occurred. So,
- 6:48the amount of times we went from bear to
- 6:51bull, bull to bear, from sideways to
- 6:53bull, sideways to bear, bear to
- 6:56sideways, bull to sideways. Every single
- 6:58combination, we've now tallied them all
- 7:00down, and we can put a numerical value
- 7:02on the amount of times that it happened.
- 7:04Now that we've got those counts and that
- 7:06tally, we can turn them into
- 7:08percentages. And that brings us to this
- 7:10very simple 3x3 grid. And it's kind of
- 7:13difficult to explain, so I'm going to
- 7:14show you on screen right here. What
- 7:16you're seeing on screen are three rows
- 7:19that represent today's state. The three
- 7:21columns represent tomorrow's state. And
- 7:25every row has to add up to 100% because
- 7:28something does have to happen tomorrow
- 7:30with 100% certainty. The market does
- 7:33have to end up in one of those buckets.
- 7:35And so, you'll notice that there is a
- 7:37most probable outcome for tomorrow's
- 7:40price. And this is where we get the
- 7:42whole concept of the trend is your
- 7:44friend. If you're in a bear state, the
- 7:46most likely outcome for the next day is
- 7:49also going to be a a bear state, but
- 7:51it's not 100% certain. There are other
- 7:53outcomes that can take place, but the
- 7:55hedge funds and the quants are
- 7:57specifically using probabilities to
- 8:00determine what the next day's moves are,
- 8:02and that's moving and progressing every
- 8:04single day as it looks back at all those
- 8:06transitions, all the tallies, and all
- 8:07the probabilities that they can see what
- 8:09the outcome of the following day is most
- 8:12likely to be. So, you'll see on the
- 8:13screen right now that we have a diagonal
- 8:16line of cells running from the top left
- 8:18to the bottom right. And these three
- 8:20cells represent the market staying
- 8:21exactly the same. That would be like
- 8:24bull state into bull state, bear state
- 8:26into bear state, sideways into sideways.
- 8:28And the reason I highlight this diagonal
- 8:30is because it shows something called
- 8:32persistence, and that persistence brings
- 8:34about a word called stickiness. And
- 8:37every state has a stickiness score,
- 8:39essentially. How sticky is a bull
- 8:42market? Well, if we are in a bull state
- 8:44today, accounting for the last 20 days,
- 8:47it's more likely for it to be another
- 8:49bull state tomorrow than it is any of
- 8:52the other states. Bull states tend to be
- 8:54quite sticky states, and also bear
- 8:56markets do as well. And so, at all
- 8:58times, there's a live matrix scoreboard
- 9:00determining the likelihood of the
- 9:02outcome of tomorrow. And this is what
- 9:04the quants and the hedge funds use to
- 9:06determine where to place their bets
- 9:08today. So, if you know that the
- 9:09stickiness score of a bull state is 80%
- 9:13for example, well, then you can quite
- 9:14easily hedge your bets on tomorrow also
- 9:16being a bull state, and as a result,
- 9:19going long. They're not saying tomorrow
- 9:20will be a bull state. They're saying
- 9:23there's an 80% chance. There's an 80%
- 9:25probability that it will be a bull state
- 9:27tomorrow as well. And just to make this
- 9:29super cool and amazing for you, I've
- 9:31actually created a Pine Script for an
- 9:33indicator that shows the matrix on a
- 9:36chart that you can use right now. So,
- 9:38when we get to the tutorial element of
- 9:39this video where I explain how to do it,
- 9:41I'm going to show you exactly how to
- 9:42install this Pine Script into your
- 9:43TradingView, and you can see this 3 by 3
- 9:46matrix on your chart for any asset you
- 9:50want. How cool is that? I think it's
- 9:51about time to subscribe, don't you? So,
- 9:53to summarize what we've covered so far,
- 9:56we've talked about what is a state, so
- 9:58we know what the states are. We've also
- 10:00decided today's state, that's the
- 10:02calculation that the hedge funds do to
- 10:04determine where we are today based on
- 10:06the last 20 days of movement. We've
- 10:07talked about the Markov property, that
- 10:09was number three. Number four, we talked
- 10:11about this transition matrix here that
- 10:13the hedge fund is using by that 3 by 3
- 10:15grid. And number five, we talked about
- 10:16this persistence, the diagonal line that
- 10:18I showed you there, the stickiness score
- 10:21of the asset. But number six is kind of
- 10:23an interesting move, which I never
- 10:24expected. And it is, what if we don't
- 10:27just want a one-day forecast? What if we
- 10:30want to look further in the future? How
- 10:32do we use all this mathematics and all
- 10:34the and all the information we've
- 10:35gathered so far to determine a more
- 10:38far-reaching prediction of the future?
- 10:40Well, there actually is a calculation
- 10:41for that, and I'm going to show you. And
- 10:43it's something called squaring the
- 10:44matrix. The great thing is is that you
- 10:46don't need any new mathematics. You've
- 10:48already got it already. So, all you have
- 10:50to do is simply multiply the matrix by
- 10:53itself. So, if you want a two-day
- 10:55matrix, you square the matrix by itself.
- 10:58If you want a three-day forecast, you
- 11:00cube it against itself. And don't worry,
- 11:03I'm going to show you an example of this
- 11:04with real numbers. But it goes on and on
- 11:06and on depending on how far away you
- 11:08want that prediction. And of course, as
- 11:10you keep squaring and cubing against
- 11:12yourself, the number ultimately of
- 11:14percentage, the probability percentage,
- 11:16is going down over time. So, let's do a
- 11:18three example, and I think by the end of
- 11:20this, you'll understand it. So, path
- 11:21number one would be like going from bull
- 11:23to bull. So, from the example we used
- 11:25earlier, there's an 80% chance that if
- 11:27we are in a bull state now, it would be
- 11:29a bull state tomorrow. But the chance of
- 11:32that bull state remaining for the the
- 11:34following day is essentially 0.8
- 11:37representing 80% times by 0.8. We're
- 11:41timesing it by itself, which leaves us
- 11:43with 0.64, which is 64%. So, we've got
- 11:47our 2-day forecast predicting suggesting
- 11:49that there's a 64% probability that in 2
- 11:52days time we will still be in a bull
- 11:54state. And so, by doing that calculation
- 11:56for all the different combinations, you
- 11:58end up with the ability and a basically
- 12:01a way to kind of show on a huge matrix
- 12:03with percentage probabilities all
- 12:05perfectly laid out what the chances are
- 12:08that that asset will be in a specific
- 12:10state in a specific amount of days. You
- 12:12can see how different this is from doing
- 12:14trend lines and stuff, right? This is
- 12:16mathematical and equation-based, and
- 12:18this is what quants are doing. This is
- 12:19how the people who understand this as
- 12:22college kids end up landing jobs that
- 12:24are $650,000
- 12:26a year out of college. And that's true,
- 12:28and I am making a video about that. But
- 12:30if you extrapolate this idea out quite a
- 12:32bit, instead of looking two or three
- 12:33days ahead where we're doing nice cute
- 12:35little squaring and then cubing these
- 12:37numbers, and let's say you wanted to do
- 12:39a 28-day
- 12:41forecast. Well, now we're getting into
- 12:43something where we're now multiplying
- 12:44the matrix by the 28th power. And these
- 12:47numbers start to get mind-boggling. And
- 12:50actually, if you look at it on a chart
- 12:52to see the kind of distribution of
- 12:53percentages, you'll see that it all
- 12:55basically converges into a single
- 12:57sliver. And that sliver represents how
- 13:01the probability of any of these outcomes
- 13:03is so small that there's no meaningful
- 13:05signal that you're getting from it. You
- 13:07know, for example, it might say, you
- 13:08know, in 28 days time there's a 0.2%
- 13:11chance of this outcome, there's a 0.2%
- 13:13chance of this outcome, this outcome,
- 13:15this outcome, this outcome. They're all
- 13:16going to be uniform, like 0.2%, but
- 13:19there's going to be so many outcomes and
- 13:20so many ways to get there that there's
- 13:22not really any point in using that
- 13:24projection down the line. And that is
- 13:26number seven, the stationary
- 13:28distribution. And so, how do you
- 13:29actually extract signals from all of
- 13:32this to actually make some trades? Well,
- 13:34it requires a process called signal
- 13:36generation, and that's number eight.
- 13:38Because when I'm thinking about this,
- 13:39I'm like, "Okay, all this math is good,
- 13:40but what do I do with that information?"
- 13:42Well, despite all of the calculations
- 13:44and all the equations that have come to
- 13:46this point, the calculation is
- 13:49incredibly easy. And that's what I found
- 13:51with the way the quants operate. They do
- 13:53lots of complex things in the background
- 13:55only to simplify it with that
- 13:57foundation. So, what they do is is one
- 13:59simple calculation of this thing minus
- 14:02this thing. And so, let's talk about it.
- 14:04Basically, they're looking at tomorrow,
- 14:06the probability of tomorrow being a bull
- 14:08state. And what they do is is that they
- 14:10subtract the likelihood of it being a
- 14:12bear market tomorrow from the bull
- 14:15market probability. And here's the
- 14:16genius part. The larger the number that
- 14:19you get as a result, the more money you
- 14:21will put into that trade. So, the
- 14:24differential between the bull and the
- 14:25bear in this case determines how big
- 14:28that trade is going to be. So, you're
- 14:29managing risk that way as well. So, let
- 14:31me give you a concrete example. So,
- 14:33let's say the chance of a bull state
- 14:35tomorrow is 65%, and the chance of a
- 14:37bear state tomorrow is 20%. And of
- 14:40course, because we have to add up to
- 14:41100, there's a 15% chance that we're
- 14:43going to be in a sideways state
- 14:45tomorrow. So, to extract your trading
- 14:47signal from this, all you do is take
- 14:4965%, which is the bull probability
- 14:52tomorrow, minus 20%, which is the bear
- 14:56probability for tomorrow, and you're
- 14:58left with 45%. So, we've got the
- 15:00direction because it's plus 45%. So, we
- 15:03know that the idea is that we're going
- 15:05to go long. So, each quant and hedge
- 15:07fund will have their own calculation
- 15:08for, you know, how strong is 45% and how
- 15:11much will they put on that trade. I'd
- 15:13imagine that every hedge fund is going
- 15:15to be slightly different in that way.
- 15:16You know, some people might look at a
- 15:18plus 45% as a really strong signal and
- 15:20put lots more into that trade, and
- 15:22others might look at that as a little
- 15:23bit weaker and put less in. But, the
- 15:25point is it's giving you the direction.
- 15:27And you might be wondering, well, how
- 15:29could that ever be negative? Well,
- 15:31you're doing the same calculation.
- 15:32You're taking the bear percentage away
- 15:34from the bull percentage. So, if the
- 15:35bear percentage is a larger number than
- 15:37the bull percentage, then you're going
- 15:39to end up with a negative number. And
- 15:41so, the signal is to go short, and the
- 15:42degree to which that outcome
- 15:45uh is revealed is the degree to which
- 15:46you enter that trade. And so, this is
- 15:48far from the idea of like Bitcoin feels
- 15:51bullish today. It feels good today. This
- 15:53is like far away from that. This is
- 15:55calculations to say, you know, this is
- 15:57how bullish I am or this is how bearish
- 15:59I am, and this is how much money goes in
- 16:01as a result of that. It's calculated.
- 16:03It's simple, but complex. It's truly
- 16:06amazing. So, now as we move into step
- 16:09number nine of the 10 that we're going
- 16:11to go over in this video before we get
- 16:12into the tutorial. The tutorial's
- 16:14relatively quick. I've just got a copy
- 16:15and paste prompt for you. So cool. In
- 16:17step nine, we're going to do something
- 16:18called walk-forward backtesting. Now,
- 16:21this walk-forward backtesting has taken
- 16:23me a lot of time to try and comprehend,
- 16:26and I'm not entirely sure I still do,
- 16:27but I'm going to explain what I do
- 16:29understand, and hopefully it'll make
- 16:30sense. Now, when you're trading, often
- 16:32times we'll create a strategy, and we'll
- 16:34do a backtest on it. That backtest
- 16:37basically takes all of the data that has
- 16:39happened in the past and applies the
- 16:41strategy to all of that history. So, the
- 16:43issue is, and this is where people come
- 16:45into a problem, especially as retail
- 16:47traders, is that you take that strategy
- 16:50with all the information it's learned
- 16:52from all of the all of the data, right?
- 16:55And you take that strategy and implement
- 16:57it into, let's say, 2020. Now, it's not
- 17:00a good backtest because the data from
- 17:032020 has already been baked in to the
- 17:05entire backtest, and you're applying it
- 17:08back in time. This is really complex,
- 17:10but it's not a good backtest because
- 17:13it's already learned from the future. If
- 17:15If placing the strategy into 2020, for
- 17:17example, it already has the future
- 17:19outcomes baked into the strategy. And
- 17:21so, it doesn't make any sense. If we've
- 17:23got all the data right now, as of today,
- 17:26that means it's learned from 2020. It's
- 17:28learned from 2021 already. And so, this
- 17:30walk-forward backtesting thing is a
- 17:33mitigation against that. Now, it's
- 17:35massively computationally heavy, or at
- 17:37least it was before AI, hint hint, but
- 17:40every single day has to be entirely
- 17:43recalculated. So, the whole matrix has
- 17:45to be entirely redone. So, we never have
- 17:47that issue of having a strategy that's
- 17:50learned from all the data applied to the
- 17:52past, and it just doesn't work. From my
- 17:54understanding, that's how it works. And
- 17:56if you don't understand, you kind of
- 17:58don't need to, because it's going to be
- 17:59in the AI to do this for you.
- 18:01Now, we're at number 10, and things are
- 18:03about to get mind-blowing, okay? And so,
- 18:05prepare. Earlier on, we talked about
- 18:08defining a state. Like, what are the
- 18:10numbers that define a state? We said,
- 18:12you know, 5% and up means a bull, -5%
- 18:15and down means a bear, and anything in
- 18:17between is sideways. But, that's
- 18:19subjective. Like, who decided that? We
- 18:21decided that. Humans decided that.
- 18:23That's a subjective interpretation of
- 18:25what a bull and bear means. And
- 18:27obviously, then we come into this
- 18:29natural flaw of the system. Doesn't work
- 18:32now, does it? How can we have these
- 18:34subjective opinions, and everything else
- 18:36is kind of calculated and mathematical?
- 18:38But, we're still left with the weakest
- 18:40link, which is our subjective view. And
- 18:43so, step number 10 closes all of that
- 18:45out, and solves that problem. Solves
- 18:47that subjective behavior. That
- 18:49ultimately allows us to really determine
- 18:51what bull means, what bear means, and
- 18:53what sideways means. And this is called
- 18:55the hidden Markov model. And this is a
- 18:57part of the process that looks back over
- 19:00all of the price history of the asset
- 19:02we're looking at. All of the
- 19:03transitions, but all of the states and
- 19:05the labels that we attach to them
- 19:07earlier have been removed. So, it's not
- 19:09learning from the labeling of states
- 19:12anymore. It's actually doing a whole
- 19:13pass through the strategy of pattern
- 19:16recognition itself. It's looking at
- 19:18details like the continuation of the
- 19:20price going up or the price going down.
- 19:21It's looking at a whole load of
- 19:22different data points without the
- 19:25labels. And so, to make this like super
- 19:27simple to understand, it's almost like a
- 19:29babysitter. They come into the house and
- 19:31there's a whole bunch of children in
- 19:33there. They don't immediately know, you
- 19:35know, this child has ADHD, this child
- 19:38sleeps all the time, this child is crazy
- 19:40and violent. You know, they don't know
- 19:41any of that stuff. And so, a few days
- 19:43later though, once they've sat there and
- 19:45they've observed the children and the
- 19:47way they act and the way they interact
- 19:49with each other, you can determine a
- 19:50whole bunch of things about each child
- 19:52and assign or prescribe a personality to
- 19:55each child. But, it takes time to kind
- 19:56of analyze and sit back and watch. And
- 19:59that's what this hidden Markov model is
- 20:00doing. And after all of that, now let's
- 20:02determine the personalities of the
- 20:04children. It'll actually put a label on
- 20:06the children, like ADHD, violent,
- 20:10sleepy.
- 20:11It will do that across all of them and
- 20:13it's doing the same thing across the
- 20:14data of the chart. So, it's now actually
- 20:17prescribing a bull state, a bear state,
- 20:21and a sideways state without any labels
- 20:23existing previously. And so, when you
- 20:25overlap the two of those where you've
- 20:27got the, you know, the 5% is a bull, -5%
- 20:30and below is a bear, the the subjective
- 20:33labels that we gave and also the hidden
- 20:35Markov method labels that were
- 20:37generated, you can overlap them and see
- 20:41where they are confirming each other.
- 20:43And when they confirm each other, that
- 20:45gives you the green light to move ahead.
- 20:47Right. And now that we've understood all
- 20:49of that, and I hope you have, that was
- 20:50all 10 of the elements that make up this
- 20:52hedge fund method, but it's all kind of
- 20:54useless to you as just information. We
- 20:57need a real way to apply this into our
- 20:59own trading strategies and specifically
- 21:01using AI, get this onto our computers
- 21:04and running for us. So, you're going to
- 21:05get a couple of things here. The first
- 21:07thing you're going to get is a Claude
- 21:09Code skill. This skill you can install
- 21:12into your computer, especially if you're
- 21:14using Claude Code. If you're not using
- 21:16Claude Code and any other LLM, you can
- 21:18actually take the one-shot prompt and it
- 21:19will just learn it on your system,
- 21:21regardless of whether it's Claude Code
- 21:23or not. But, this skill, this system,
- 21:25will be applied to any trading strategy
- 21:28that you ask it to apply it to. So, if
- 21:30I've got my strategy for BitTensor and
- 21:33all the subnets like I actually do in
- 21:35real life, I can copy and paste this
- 21:37prompt into my Claude Code, it can learn
- 21:40it, and determine what needs to change
- 21:42about my strategy to go in accordance to
- 21:45this hedge fund method. That'll be a
- 21:46copy and paste prompt that will take you
- 21:48through from beginning to end very
- 21:50simply, regardless of how much
- 21:51experience you have with AI or with
- 21:53trading. And then, as a little bonus,
- 21:55I've created a Pine Script as I
- 21:56mentioned earlier. This is a way to
- 21:58visualize the 3x3 grid of probabilities
- 22:02on your chart inside TradingView. This
- 22:04will be a separate copy and paste that
- 22:05you can go straight into your Pine
- 22:07Script editor on TradingView and paste
- 22:09it in. So, with that, let's get into the
- 22:11tutorial.
- 22:14All right. So, first things first is
- 22:15you're going to go to the first line in
- 22:17the description of the video, and you'll
- 22:20be brought to a GitHub page. The GitHub
- 22:22page is going to give you all the code
- 22:23of everything I've worked on so far.
- 22:25It's going to give you the Pine Script,
- 22:26the one-shot prompt for you to install
- 22:28on your Claude Code or any LLM for that
- 22:30matter. And I'm going to walk you
- 22:32through how to do that. So, you've come
- 22:34over to the GitHub right now, and you
- 22:36can see a series of things.
- 22:38Uh if you just kind of come down and
- 22:40see, you can see the two elements of
- 22:42this, the on-camera build that we're
- 22:44doing right now. This is the Markov
- 22:46hedge fund method. If you click that, it
- 22:49will open up a link in another tab. And
- 22:52we're also going to click the Pine
- 22:53Script bonus as well if you're going to
- 22:55use this for TradingView. So, here is
- 22:57the hedge fund method skill that you're
- 22:59going to install into your AI.
- 23:02So, you're going to copy it from this
- 23:04moment onwards all the way down. It's
- 23:06going to This is all the information
- 23:08that I've kind of put together so that
- 23:10you can uh create this skill in your
- 23:13system. So, I've copied it. You're going
- 23:15to come over here. You're going to click
- 23:16paste and click enter. There's then
- 23:18going to be an onboarding process that
- 23:20you'll go through where it's just going
- 23:22to install this whole thing into your
- 23:24computer.
- 23:26If you're on Cloud Code, it's going to
- 23:27create a skill. So, anytime you have a
- 23:29trading strategy, you can just say,
- 23:30"Hey, can you go the Markov Run the
- 23:32Markov skill here?" And it'll go through
- 23:34the whole process to make sure that the
- 23:36strategy is, you know, beefed up.
- 23:38So, it said, "I'm going to install the
- 23:39Markov Hedge Fund Method skill into
- 23:41these this file, about 90 seconds on Mac
- 23:44and Linux and up to 2 to 3 minutes on
- 23:46Windows. You don't need any keys or
- 23:48accounts or admin passwords. Great."
- 23:50This is Rowan's framework on Rowan
- 23:52chain, an observable Markov regime model
- 23:55that builds a bear a bull bear sideways
- 23:57transition matrix from any ticker.
- 24:00Great. So, if you're ready, you just
- 24:01type go and it will start the process.
- 24:05And it's basically done with the process
- 24:07now. We've been about 2 minutes and 21
- 24:09into this. And you can see that phase
- 24:11four of this whole process of the
- 24:12onboarding, it says it's going to run a
- 24:15um a Markov regime basically on the SPY
- 24:1910-year chart. And this is just a demo
- 24:22to show that it does in fact work. You
- 24:24could also then after this just say,
- 24:26"Hey, run it on Bitcoin. Run it on
- 24:27Ethereum." Whatever you want to do, and
- 24:29it will apply the Markov regime,
- 24:31everything we've talked about today, to
- 24:33that asset. And it really can be an any
- 24:35asset. And just like that, the whole
- 24:37Markov Hedge Fund Method skill has been
- 24:39installed. So, whenever you want to use
- 24:41it on a strategy, you just type forward
- 24:43slash Markov and you can see Hedge Fund
- 24:47Method. You type that there and then
- 24:49talk about your strategy or whatever.
- 24:51And that's how it works.
- 24:53Next, we're going to just talk about how
- 24:54we can apply the Pine Script into our
- 24:58uh TradingView. And all you do is come
- 24:59over to the Pine Script page that we
- 25:01talked about earlier. Click copy raw
- 25:03file right up here. Then you can go over
- 25:05to your TradingView. I've already got
- 25:07mine installed, but I'm going to delete
- 25:08it so you can see it all work. On the
- 25:11right-hand side, this is on the desktop
- 25:13app, by the way,
- 25:14we've got a mountain-looking icon. That
- 25:17is the Pine Script icon. You can click
- 25:19that. And sometimes it helps just to
- 25:21bring this out a little bit further.
- 25:23Uh we can do control A or command A to
- 25:27select everything and we want to delete
- 25:28that. Then we're going to click command
- 25:30V, which is paste. This is the Pine
- 25:32Script right here. And all we want to do
- 25:34is click the play button here, which is
- 25:36to add to chart. We can now close this
- 25:38and we wait for it to populate on the
- 25:40chart. And remember this is the Bitcoin
- 25:42chart and there we go. The Markov regime
- 25:44has been uh laid on here. This will work
- 25:47for any asset because it's just doing
- 25:49the calculations automatically. And the
- 25:51one to look at, obviously, we've
- 25:52explained the nine
- 25:54the nine kind of card uh view, but the
- 25:58long run mix is the the one that I like
- 26:00to look for. So, if we look at the bull
- 26:02percentage for tomorrow, it's 29% chance
- 26:07of tomorrow being a bull run. Tomorrow
- 26:09being a bear market is 42% chance and
- 26:1229% chance of it going sideways. And so
- 26:15that that bear market being the highest
- 26:16percentage, the highest likelihood, is
- 26:18because we have bear behavior um uh
- 26:22recently, right? It's just it's a sticky
- 26:24state, as we talked about. So, that's
- 26:26how it works. It all works here. I'll
- 26:28actually go and change the the chart.
- 26:30Maybe we do, let's say, XRP, for
- 26:33example.
- 26:34And again, it applies the numbers for
- 26:36XRP as well. And you can do really
- 26:38anything here. Um I don't know what else
- 26:40I can kind of show. Stocks, Tesla.
- 26:43There it is. The Markov regime works for
- 26:44that, as well.
- 26:46All right. So, I hope you've got
- 26:47tremendous use from this. This is one
- 26:49part of a potential series on the topic
- 26:52of quant strategies that we can use AI
- 26:54to implement. If at any point you're
- 26:56doing this process and you hit a
- 26:58roadblock, you can always uh get in
- 27:00touch with me on 01 systems. It's the
- 27:03second link in the description. That's
- 27:05the only place really where I can
- 27:06provide feedback and help people with
- 27:08issues and bugs that they have along the
- 27:10way. So, check that out if you're
- 27:12interested and I'll see you in the next
- 27:13one.
About this transcript
This page contains the full transcript of I Re-Created A Quant Trading Strategy With Claude Code (Insanely Cool) by Lewis Jackson Investing, generated from the public captions YouTube serves with the video. The transcript has 5,478 words across 770 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.
What you can do with it
Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to translate the transcript into 100+ languages.
Free YouTube transcript tool
YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, translation to 100+ languages, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.