YouTube2Text

I Re-Created A Quant Trading Strategy With Claude Code (Insanely Cool) — Transcript

by Lewis Jackson Investing · 5,478 words · 770 segments · language en · Watch on YouTube

Full transcript

  1. 0:00I've realized something about trading.
  2. 0:02Average people who are trying to do day
  3. 0:03trading, even all the way up to
  4. 0:04professionals doing trading, they do it
  5. 0:07completely different than how hedge
  6. 0:09funds do it. Now, I want to tell you
  7. 0:11something that I've learned recently
  8. 0:13that completely shattered my view of
  9. 0:14trading. And that is that quants are not
  10. 0:18using trend lines and indicators on a
  11. 0:21chart to make their decisions. And you
  12. 0:23might be thinking, well, how on earth do
  13. 0:25you do it then? Well, that's exactly
  14. 0:26what I'm going to show you in this
  15. 0:28video. In the depths of trading Twitter,
  16. 0:30I found a thread by a person called
  17. 0:32Rowan. He is a quant. He makes tons of
  18. 0:35money as a quant. And he's laid out on
  19. 0:37the table all of the secrets that these
  20. 0:39hedge fund quants use that get them the
  21. 0:42results that they do, which outperforms
  22. 0:44your normal trader and is far more
  23. 0:45consistent, but significantly more
  24. 0:48complex. I've gone through all of his
  25. 0:50work on what's called the hedge fund
  26. 0:52method, and I've simplified it into a
  27. 0:54single video, and that's what you're
  28. 0:56watching today.
  29. 0:58So, in this video, I'm going to give you
  30. 0:59a few things. Number one, I'm going to
  31. 1:01share exactly what the hedge fund method
  32. 1:03is. Number two, I'm going to convert all
  33. 1:06of that hedge fund method into a format
  34. 1:08that is understood by AI. And then
  35. 1:10third, I'm going to give you an exact
  36. 1:12copy and paste prompt that you can put
  37. 1:14into your Claude code or any LLM right
  38. 1:17now and have this whole method installed
  39. 1:19into your own trading strategies. And if
  40. 1:22you're using Claude code, you can use
  41. 1:24this prompt as a skill in your AI. So,
  42. 1:27anytime you have a new strategy, it will
  43. 1:29automatically apply this method on top
  44. 1:31of it. And by the end of the video,
  45. 1:33you'll have all the tools necessary to
  46. 1:35operate like a hedge fund quant. And
  47. 1:37right after you subscribe, let's get
  48. 1:39into it.
  49. 1:49In this video, we're going to go over
  50. 1:50the 10 elements that make up the hedge
  51. 1:53fund method. And after all of that has
  52. 1:55been explained, I'm going to give you a
  53. 1:57couple of prompts. One is going to be to
  54. 1:59install this onto your Claude code or
  55. 2:01any LLM that you use, and the other one
  56. 2:03will be a visualization that you can put
  57. 2:05onto your TradingView chart using Pine
  58. 2:07Script. I want you to know that these
  59. 2:09prompts are entirely free for you to
  60. 2:12copy and paste and take. I don't even
  61. 2:13want your email. You can find those
  62. 2:15prompts on my GitHub link in the top
  63. 2:17line of the description.
  64. 2:20The first thing to understand is that
  65. 2:22these hedge funds and the quants are not
  66. 2:24operating using the same data that you
  67. 2:26and I are. I think for the most part,
  68. 2:28you and I go on vibes. Kind of like
  69. 2:30feeling our way around the investing
  70. 2:32that I've got a good feeling about
  71. 2:34Bitcoin or I've got a good feeling about
  72. 2:36Palantir, and it's all about feelings.
  73. 2:38Quants and hedge funds do their absolute
  74. 2:40best to quantify these feelings,
  75. 2:43actually put numerical values to them.
  76. 2:45It's a bit like going outside and
  77. 2:47saying, "Oh, it's windy today. I'm going
  78. 2:48to make this decision as a result."
  79. 2:50Whereas if a quant or a hedge fund went
  80. 2:52out there, they want a numerical value.
  81. 2:54How strong is the wind? What direction
  82. 2:56is it pointing? And then with those
  83. 2:57numbers, they can make decisions. So, I
  84. 2:59want to introduce to you something
  85. 3:01called states. Every hedge fund and
  86. 3:03quant will operate with these states.
  87. 3:05There are only three states. There is a
  88. 3:07bull state, a sideways state, and a bear
  89. 3:09state. Now, a bull state is defined as
  90. 3:12the last 20 days, when you add up all of
  91. 3:15the returns of the last 20 days, are
  92. 3:17they at 5% or more return? For example,
  93. 3:20if you had a 1% gain every single day
  94. 3:23for 20 days, that would represent a 20%
  95. 3:26gain and obviously would be in a bull
  96. 3:28state. If you had 15 of the days as a 1%
  97. 3:30increase, but five of the days were a 1%
  98. 3:33decrease, then overall you would have a
  99. 3:3610% gain over that 20-day period, which
  100. 3:38would again match the criteria for a
  101. 3:41bull state. Now, if the last 20 days
  102. 3:43were a -5%
  103. 3:45or greater, meaning -5, -6, so on and so
  104. 3:49forth, then And would be classified as a
  105. 3:51bear state. And anything in between is a
  106. 3:53sideways state. I know this sounds very
  107. 3:55elementary, but wait until you see how
  108. 3:57they use this information. And so, the
  109. 3:59next step of the process is obvious. We
  110. 4:01need to figure out what the state is
  111. 4:03currently. What is today's state? And
  112. 4:06so, what they do is they go back over
  113. 4:08the course of the entire asset history.
  114. 4:10Let's say it's Bitcoin. And they
  115. 4:12actually run an algorithm for every
  116. 4:13single day of the history of Bitcoin and
  117. 4:16label each day with its state. So, if
  118. 4:18you can imagine now, you've got the
  119. 4:19entire price history of Bitcoin or any
  120. 4:21asset, and every single day starting
  121. 4:23from the 20th day, cuz that's the first
  122. 4:26time you actually have a 20-day looking
  123. 4:28back period, all the way through to
  124. 4:30today has a label. And each day is a
  125. 4:33specific state. And this brings us to
  126. 4:35the third rule that they use as part of
  127. 4:37this hedge fund method. And it's
  128. 4:38something called the Markov property.
  129. 4:41And it's this whole idea that the market
  130. 4:42only moves to the next place as a result
  131. 4:46of where it is today. And it goes
  132. 4:48completely against the way that traders
  133. 4:50view things. They kind of look back
  134. 4:52throughout history and try to determine
  135. 4:54what's going to happen tomorrow. But the
  136. 4:57Markov property focuses solely on today.
  137. 5:00So, let me give you a bit of an analogy.
  138. 5:02Let's say you're driving from Little
  139. 5:03Rock, Arkansas, all the way up to New
  140. 5:05York City. The route you take to get to
  141. 5:08New York City will entirely depend on
  142. 5:10the starting location. This might sound
  143. 5:12very obvious, but let me make it even
  144. 5:13clearer. The way you get to New York
  145. 5:15City from Little Rock, Arkansas, is not
  146. 5:17the same way you get there from
  147. 5:19Nebraska. And it goes without saying
  148. 5:21that as you make your way on that
  149. 5:22journey, let's say you get to Ohio, for
  150. 5:24example, the journey to get to New York
  151. 5:26City from Ohio is also different. The
  152. 5:29journey to New York from Ohio is
  153. 5:32entirely unique. It doesn't matter at
  154. 5:34all that you started in Little Rock if
  155. 5:36you're in Ohio trying to get to New
  156. 5:38York. I hope I've made that quite clear.
  157. 5:40To summarize, the past doesn't really
  158. 5:42indicate where the future is going to
  159. 5:44go. And you might be thinking, "Well,
  160. 5:45Lewis, didn't we just do like the 20-day
  161. 5:48thing back in history throughout the
  162. 5:49whole history of Bitcoin? Why would we
  163. 5:51do that if the past was irrelevant? And
  164. 5:53maybe I was a bit extreme there, but the
  165. 5:55Markov principle really is looking at
  166. 5:58today. Today has the most weight, and it
  167. 6:01brings us to this thing called the hedge
  168. 6:03fund matrix, which before this video, I
  169. 6:05had no idea this thing exists, and it
  170. 6:07makes all the sense in the world. And it
  171. 6:10brings everything we've talked about
  172. 6:11already together. Now, with all that
  173. 6:13data that we've got from the entire
  174. 6:15history of Bitcoin, there are moments in
  175. 6:17time where the state shifts. So, we
  176. 6:20might go from a sideways market to a
  177. 6:23bull market, or a bull state. And we
  178. 6:25might go from a bull state to a bear
  179. 6:26state. And each one of those transitions
  180. 6:29is counted and logged. So, what they do
  181. 6:32is is that they look back in time at
  182. 6:34every time that transition took place
  183. 6:36between a bull and a sideways market,
  184. 6:38for example. And they tally them all
  185. 6:40down. So, we have now a complete record
  186. 6:44of the transitions that have occurred
  187. 6:46and how many times they occurred. So,
  188. 6:48the amount of times we went from bear to
  189. 6:51bull, bull to bear, from sideways to
  190. 6:53bull, sideways to bear, bear to
  191. 6:56sideways, bull to sideways. Every single
  192. 6:58combination, we've now tallied them all
  193. 7:00down, and we can put a numerical value
  194. 7:02on the amount of times that it happened.
  195. 7:04Now that we've got those counts and that
  196. 7:06tally, we can turn them into
  197. 7:08percentages. And that brings us to this
  198. 7:10very simple 3x3 grid. And it's kind of
  199. 7:13difficult to explain, so I'm going to
  200. 7:14show you on screen right here. What
  201. 7:16you're seeing on screen are three rows
  202. 7:19that represent today's state. The three
  203. 7:21columns represent tomorrow's state. And
  204. 7:25every row has to add up to 100% because
  205. 7:28something does have to happen tomorrow
  206. 7:30with 100% certainty. The market does
  207. 7:33have to end up in one of those buckets.
  208. 7:35And so, you'll notice that there is a
  209. 7:37most probable outcome for tomorrow's
  210. 7:40price. And this is where we get the
  211. 7:42whole concept of the trend is your
  212. 7:44friend. If you're in a bear state, the
  213. 7:46most likely outcome for the next day is
  214. 7:49also going to be a a bear state, but
  215. 7:51it's not 100% certain. There are other
  216. 7:53outcomes that can take place, but the
  217. 7:55hedge funds and the quants are
  218. 7:57specifically using probabilities to
  219. 8:00determine what the next day's moves are,
  220. 8:02and that's moving and progressing every
  221. 8:04single day as it looks back at all those
  222. 8:06transitions, all the tallies, and all
  223. 8:07the probabilities that they can see what
  224. 8:09the outcome of the following day is most
  225. 8:12likely to be. So, you'll see on the
  226. 8:13screen right now that we have a diagonal
  227. 8:16line of cells running from the top left
  228. 8:18to the bottom right. And these three
  229. 8:20cells represent the market staying
  230. 8:21exactly the same. That would be like
  231. 8:24bull state into bull state, bear state
  232. 8:26into bear state, sideways into sideways.
  233. 8:28And the reason I highlight this diagonal
  234. 8:30is because it shows something called
  235. 8:32persistence, and that persistence brings
  236. 8:34about a word called stickiness. And
  237. 8:37every state has a stickiness score,
  238. 8:39essentially. How sticky is a bull
  239. 8:42market? Well, if we are in a bull state
  240. 8:44today, accounting for the last 20 days,
  241. 8:47it's more likely for it to be another
  242. 8:49bull state tomorrow than it is any of
  243. 8:52the other states. Bull states tend to be
  244. 8:54quite sticky states, and also bear
  245. 8:56markets do as well. And so, at all
  246. 8:58times, there's a live matrix scoreboard
  247. 9:00determining the likelihood of the
  248. 9:02outcome of tomorrow. And this is what
  249. 9:04the quants and the hedge funds use to
  250. 9:06determine where to place their bets
  251. 9:08today. So, if you know that the
  252. 9:09stickiness score of a bull state is 80%
  253. 9:13for example, well, then you can quite
  254. 9:14easily hedge your bets on tomorrow also
  255. 9:16being a bull state, and as a result,
  256. 9:19going long. They're not saying tomorrow
  257. 9:20will be a bull state. They're saying
  258. 9:23there's an 80% chance. There's an 80%
  259. 9:25probability that it will be a bull state
  260. 9:27tomorrow as well. And just to make this
  261. 9:29super cool and amazing for you, I've
  262. 9:31actually created a Pine Script for an
  263. 9:33indicator that shows the matrix on a
  264. 9:36chart that you can use right now. So,
  265. 9:38when we get to the tutorial element of
  266. 9:39this video where I explain how to do it,
  267. 9:41I'm going to show you exactly how to
  268. 9:42install this Pine Script into your
  269. 9:43TradingView, and you can see this 3 by 3
  270. 9:46matrix on your chart for any asset you
  271. 9:50want. How cool is that? I think it's
  272. 9:51about time to subscribe, don't you? So,
  273. 9:53to summarize what we've covered so far,
  274. 9:56we've talked about what is a state, so
  275. 9:58we know what the states are. We've also
  276. 10:00decided today's state, that's the
  277. 10:02calculation that the hedge funds do to
  278. 10:04determine where we are today based on
  279. 10:06the last 20 days of movement. We've
  280. 10:07talked about the Markov property, that
  281. 10:09was number three. Number four, we talked
  282. 10:11about this transition matrix here that
  283. 10:13the hedge fund is using by that 3 by 3
  284. 10:15grid. And number five, we talked about
  285. 10:16this persistence, the diagonal line that
  286. 10:18I showed you there, the stickiness score
  287. 10:21of the asset. But number six is kind of
  288. 10:23an interesting move, which I never
  289. 10:24expected. And it is, what if we don't
  290. 10:27just want a one-day forecast? What if we
  291. 10:30want to look further in the future? How
  292. 10:32do we use all this mathematics and all
  293. 10:34the and all the information we've
  294. 10:35gathered so far to determine a more
  295. 10:38far-reaching prediction of the future?
  296. 10:40Well, there actually is a calculation
  297. 10:41for that, and I'm going to show you. And
  298. 10:43it's something called squaring the
  299. 10:44matrix. The great thing is is that you
  300. 10:46don't need any new mathematics. You've
  301. 10:48already got it already. So, all you have
  302. 10:50to do is simply multiply the matrix by
  303. 10:53itself. So, if you want a two-day
  304. 10:55matrix, you square the matrix by itself.
  305. 10:58If you want a three-day forecast, you
  306. 11:00cube it against itself. And don't worry,
  307. 11:03I'm going to show you an example of this
  308. 11:04with real numbers. But it goes on and on
  309. 11:06and on depending on how far away you
  310. 11:08want that prediction. And of course, as
  311. 11:10you keep squaring and cubing against
  312. 11:12yourself, the number ultimately of
  313. 11:14percentage, the probability percentage,
  314. 11:16is going down over time. So, let's do a
  315. 11:18three example, and I think by the end of
  316. 11:20this, you'll understand it. So, path
  317. 11:21number one would be like going from bull
  318. 11:23to bull. So, from the example we used
  319. 11:25earlier, there's an 80% chance that if
  320. 11:27we are in a bull state now, it would be
  321. 11:29a bull state tomorrow. But the chance of
  322. 11:32that bull state remaining for the the
  323. 11:34following day is essentially 0.8
  324. 11:37representing 80% times by 0.8. We're
  325. 11:41timesing it by itself, which leaves us
  326. 11:43with 0.64, which is 64%. So, we've got
  327. 11:47our 2-day forecast predicting suggesting
  328. 11:49that there's a 64% probability that in 2
  329. 11:52days time we will still be in a bull
  330. 11:54state. And so, by doing that calculation
  331. 11:56for all the different combinations, you
  332. 11:58end up with the ability and a basically
  333. 12:01a way to kind of show on a huge matrix
  334. 12:03with percentage probabilities all
  335. 12:05perfectly laid out what the chances are
  336. 12:08that that asset will be in a specific
  337. 12:10state in a specific amount of days. You
  338. 12:12can see how different this is from doing
  339. 12:14trend lines and stuff, right? This is
  340. 12:16mathematical and equation-based, and
  341. 12:18this is what quants are doing. This is
  342. 12:19how the people who understand this as
  343. 12:22college kids end up landing jobs that
  344. 12:24are $650,000
  345. 12:26a year out of college. And that's true,
  346. 12:28and I am making a video about that. But
  347. 12:30if you extrapolate this idea out quite a
  348. 12:32bit, instead of looking two or three
  349. 12:33days ahead where we're doing nice cute
  350. 12:35little squaring and then cubing these
  351. 12:37numbers, and let's say you wanted to do
  352. 12:39a 28-day
  353. 12:41forecast. Well, now we're getting into
  354. 12:43something where we're now multiplying
  355. 12:44the matrix by the 28th power. And these
  356. 12:47numbers start to get mind-boggling. And
  357. 12:50actually, if you look at it on a chart
  358. 12:52to see the kind of distribution of
  359. 12:53percentages, you'll see that it all
  360. 12:55basically converges into a single
  361. 12:57sliver. And that sliver represents how
  362. 13:01the probability of any of these outcomes
  363. 13:03is so small that there's no meaningful
  364. 13:05signal that you're getting from it. You
  365. 13:07know, for example, it might say, you
  366. 13:08know, in 28 days time there's a 0.2%
  367. 13:11chance of this outcome, there's a 0.2%
  368. 13:13chance of this outcome, this outcome,
  369. 13:15this outcome, this outcome. They're all
  370. 13:16going to be uniform, like 0.2%, but
  371. 13:19there's going to be so many outcomes and
  372. 13:20so many ways to get there that there's
  373. 13:22not really any point in using that
  374. 13:24projection down the line. And that is
  375. 13:26number seven, the stationary
  376. 13:28distribution. And so, how do you
  377. 13:29actually extract signals from all of
  378. 13:32this to actually make some trades? Well,
  379. 13:34it requires a process called signal
  380. 13:36generation, and that's number eight.
  381. 13:38Because when I'm thinking about this,
  382. 13:39I'm like, "Okay, all this math is good,
  383. 13:40but what do I do with that information?"
  384. 13:42Well, despite all of the calculations
  385. 13:44and all the equations that have come to
  386. 13:46this point, the calculation is
  387. 13:49incredibly easy. And that's what I found
  388. 13:51with the way the quants operate. They do
  389. 13:53lots of complex things in the background
  390. 13:55only to simplify it with that
  391. 13:57foundation. So, what they do is is one
  392. 13:59simple calculation of this thing minus
  393. 14:02this thing. And so, let's talk about it.
  394. 14:04Basically, they're looking at tomorrow,
  395. 14:06the probability of tomorrow being a bull
  396. 14:08state. And what they do is is that they
  397. 14:10subtract the likelihood of it being a
  398. 14:12bear market tomorrow from the bull
  399. 14:15market probability. And here's the
  400. 14:16genius part. The larger the number that
  401. 14:19you get as a result, the more money you
  402. 14:21will put into that trade. So, the
  403. 14:24differential between the bull and the
  404. 14:25bear in this case determines how big
  405. 14:28that trade is going to be. So, you're
  406. 14:29managing risk that way as well. So, let
  407. 14:31me give you a concrete example. So,
  408. 14:33let's say the chance of a bull state
  409. 14:35tomorrow is 65%, and the chance of a
  410. 14:37bear state tomorrow is 20%. And of
  411. 14:40course, because we have to add up to
  412. 14:41100, there's a 15% chance that we're
  413. 14:43going to be in a sideways state
  414. 14:45tomorrow. So, to extract your trading
  415. 14:47signal from this, all you do is take
  416. 14:4965%, which is the bull probability
  417. 14:52tomorrow, minus 20%, which is the bear
  418. 14:56probability for tomorrow, and you're
  419. 14:58left with 45%. So, we've got the
  420. 15:00direction because it's plus 45%. So, we
  421. 15:03know that the idea is that we're going
  422. 15:05to go long. So, each quant and hedge
  423. 15:07fund will have their own calculation
  424. 15:08for, you know, how strong is 45% and how
  425. 15:11much will they put on that trade. I'd
  426. 15:13imagine that every hedge fund is going
  427. 15:15to be slightly different in that way.
  428. 15:16You know, some people might look at a
  429. 15:18plus 45% as a really strong signal and
  430. 15:20put lots more into that trade, and
  431. 15:22others might look at that as a little
  432. 15:23bit weaker and put less in. But, the
  433. 15:25point is it's giving you the direction.
  434. 15:27And you might be wondering, well, how
  435. 15:29could that ever be negative? Well,
  436. 15:31you're doing the same calculation.
  437. 15:32You're taking the bear percentage away
  438. 15:34from the bull percentage. So, if the
  439. 15:35bear percentage is a larger number than
  440. 15:37the bull percentage, then you're going
  441. 15:39to end up with a negative number. And
  442. 15:41so, the signal is to go short, and the
  443. 15:42degree to which that outcome
  444. 15:45uh is revealed is the degree to which
  445. 15:46you enter that trade. And so, this is
  446. 15:48far from the idea of like Bitcoin feels
  447. 15:51bullish today. It feels good today. This
  448. 15:53is like far away from that. This is
  449. 15:55calculations to say, you know, this is
  450. 15:57how bullish I am or this is how bearish
  451. 15:59I am, and this is how much money goes in
  452. 16:01as a result of that. It's calculated.
  453. 16:03It's simple, but complex. It's truly
  454. 16:06amazing. So, now as we move into step
  455. 16:09number nine of the 10 that we're going
  456. 16:11to go over in this video before we get
  457. 16:12into the tutorial. The tutorial's
  458. 16:14relatively quick. I've just got a copy
  459. 16:15and paste prompt for you. So cool. In
  460. 16:17step nine, we're going to do something
  461. 16:18called walk-forward backtesting. Now,
  462. 16:21this walk-forward backtesting has taken
  463. 16:23me a lot of time to try and comprehend,
  464. 16:26and I'm not entirely sure I still do,
  465. 16:27but I'm going to explain what I do
  466. 16:29understand, and hopefully it'll make
  467. 16:30sense. Now, when you're trading, often
  468. 16:32times we'll create a strategy, and we'll
  469. 16:34do a backtest on it. That backtest
  470. 16:37basically takes all of the data that has
  471. 16:39happened in the past and applies the
  472. 16:41strategy to all of that history. So, the
  473. 16:43issue is, and this is where people come
  474. 16:45into a problem, especially as retail
  475. 16:47traders, is that you take that strategy
  476. 16:50with all the information it's learned
  477. 16:52from all of the all of the data, right?
  478. 16:55And you take that strategy and implement
  479. 16:57it into, let's say, 2020. Now, it's not
  480. 17:00a good backtest because the data from
  481. 17:032020 has already been baked in to the
  482. 17:05entire backtest, and you're applying it
  483. 17:08back in time. This is really complex,
  484. 17:10but it's not a good backtest because
  485. 17:13it's already learned from the future. If
  486. 17:15If placing the strategy into 2020, for
  487. 17:17example, it already has the future
  488. 17:19outcomes baked into the strategy. And
  489. 17:21so, it doesn't make any sense. If we've
  490. 17:23got all the data right now, as of today,
  491. 17:26that means it's learned from 2020. It's
  492. 17:28learned from 2021 already. And so, this
  493. 17:30walk-forward backtesting thing is a
  494. 17:33mitigation against that. Now, it's
  495. 17:35massively computationally heavy, or at
  496. 17:37least it was before AI, hint hint, but
  497. 17:40every single day has to be entirely
  498. 17:43recalculated. So, the whole matrix has
  499. 17:45to be entirely redone. So, we never have
  500. 17:47that issue of having a strategy that's
  501. 17:50learned from all the data applied to the
  502. 17:52past, and it just doesn't work. From my
  503. 17:54understanding, that's how it works. And
  504. 17:56if you don't understand, you kind of
  505. 17:58don't need to, because it's going to be
  506. 17:59in the AI to do this for you.
  507. 18:01Now, we're at number 10, and things are
  508. 18:03about to get mind-blowing, okay? And so,
  509. 18:05prepare. Earlier on, we talked about
  510. 18:08defining a state. Like, what are the
  511. 18:10numbers that define a state? We said,
  512. 18:12you know, 5% and up means a bull, -5%
  513. 18:15and down means a bear, and anything in
  514. 18:17between is sideways. But, that's
  515. 18:19subjective. Like, who decided that? We
  516. 18:21decided that. Humans decided that.
  517. 18:23That's a subjective interpretation of
  518. 18:25what a bull and bear means. And
  519. 18:27obviously, then we come into this
  520. 18:29natural flaw of the system. Doesn't work
  521. 18:32now, does it? How can we have these
  522. 18:34subjective opinions, and everything else
  523. 18:36is kind of calculated and mathematical?
  524. 18:38But, we're still left with the weakest
  525. 18:40link, which is our subjective view. And
  526. 18:43so, step number 10 closes all of that
  527. 18:45out, and solves that problem. Solves
  528. 18:47that subjective behavior. That
  529. 18:49ultimately allows us to really determine
  530. 18:51what bull means, what bear means, and
  531. 18:53what sideways means. And this is called
  532. 18:55the hidden Markov model. And this is a
  533. 18:57part of the process that looks back over
  534. 19:00all of the price history of the asset
  535. 19:02we're looking at. All of the
  536. 19:03transitions, but all of the states and
  537. 19:05the labels that we attach to them
  538. 19:07earlier have been removed. So, it's not
  539. 19:09learning from the labeling of states
  540. 19:12anymore. It's actually doing a whole
  541. 19:13pass through the strategy of pattern
  542. 19:16recognition itself. It's looking at
  543. 19:18details like the continuation of the
  544. 19:20price going up or the price going down.
  545. 19:21It's looking at a whole load of
  546. 19:22different data points without the
  547. 19:25labels. And so, to make this like super
  548. 19:27simple to understand, it's almost like a
  549. 19:29babysitter. They come into the house and
  550. 19:31there's a whole bunch of children in
  551. 19:33there. They don't immediately know, you
  552. 19:35know, this child has ADHD, this child
  553. 19:38sleeps all the time, this child is crazy
  554. 19:40and violent. You know, they don't know
  555. 19:41any of that stuff. And so, a few days
  556. 19:43later though, once they've sat there and
  557. 19:45they've observed the children and the
  558. 19:47way they act and the way they interact
  559. 19:49with each other, you can determine a
  560. 19:50whole bunch of things about each child
  561. 19:52and assign or prescribe a personality to
  562. 19:55each child. But, it takes time to kind
  563. 19:56of analyze and sit back and watch. And
  564. 19:59that's what this hidden Markov model is
  565. 20:00doing. And after all of that, now let's
  566. 20:02determine the personalities of the
  567. 20:04children. It'll actually put a label on
  568. 20:06the children, like ADHD, violent,
  569. 20:10sleepy.
  570. 20:11It will do that across all of them and
  571. 20:13it's doing the same thing across the
  572. 20:14data of the chart. So, it's now actually
  573. 20:17prescribing a bull state, a bear state,
  574. 20:21and a sideways state without any labels
  575. 20:23existing previously. And so, when you
  576. 20:25overlap the two of those where you've
  577. 20:27got the, you know, the 5% is a bull, -5%
  578. 20:30and below is a bear, the the subjective
  579. 20:33labels that we gave and also the hidden
  580. 20:35Markov method labels that were
  581. 20:37generated, you can overlap them and see
  582. 20:41where they are confirming each other.
  583. 20:43And when they confirm each other, that
  584. 20:45gives you the green light to move ahead.
  585. 20:47Right. And now that we've understood all
  586. 20:49of that, and I hope you have, that was
  587. 20:50all 10 of the elements that make up this
  588. 20:52hedge fund method, but it's all kind of
  589. 20:54useless to you as just information. We
  590. 20:57need a real way to apply this into our
  591. 20:59own trading strategies and specifically
  592. 21:01using AI, get this onto our computers
  593. 21:04and running for us. So, you're going to
  594. 21:05get a couple of things here. The first
  595. 21:07thing you're going to get is a Claude
  596. 21:09Code skill. This skill you can install
  597. 21:12into your computer, especially if you're
  598. 21:14using Claude Code. If you're not using
  599. 21:16Claude Code and any other LLM, you can
  600. 21:18actually take the one-shot prompt and it
  601. 21:19will just learn it on your system,
  602. 21:21regardless of whether it's Claude Code
  603. 21:23or not. But, this skill, this system,
  604. 21:25will be applied to any trading strategy
  605. 21:28that you ask it to apply it to. So, if
  606. 21:30I've got my strategy for BitTensor and
  607. 21:33all the subnets like I actually do in
  608. 21:35real life, I can copy and paste this
  609. 21:37prompt into my Claude Code, it can learn
  610. 21:40it, and determine what needs to change
  611. 21:42about my strategy to go in accordance to
  612. 21:45this hedge fund method. That'll be a
  613. 21:46copy and paste prompt that will take you
  614. 21:48through from beginning to end very
  615. 21:50simply, regardless of how much
  616. 21:51experience you have with AI or with
  617. 21:53trading. And then, as a little bonus,
  618. 21:55I've created a Pine Script as I
  619. 21:56mentioned earlier. This is a way to
  620. 21:58visualize the 3x3 grid of probabilities
  621. 22:02on your chart inside TradingView. This
  622. 22:04will be a separate copy and paste that
  623. 22:05you can go straight into your Pine
  624. 22:07Script editor on TradingView and paste
  625. 22:09it in. So, with that, let's get into the
  626. 22:11tutorial.
  627. 22:14All right. So, first things first is
  628. 22:15you're going to go to the first line in
  629. 22:17the description of the video, and you'll
  630. 22:20be brought to a GitHub page. The GitHub
  631. 22:22page is going to give you all the code
  632. 22:23of everything I've worked on so far.
  633. 22:25It's going to give you the Pine Script,
  634. 22:26the one-shot prompt for you to install
  635. 22:28on your Claude Code or any LLM for that
  636. 22:30matter. And I'm going to walk you
  637. 22:32through how to do that. So, you've come
  638. 22:34over to the GitHub right now, and you
  639. 22:36can see a series of things.
  640. 22:38Uh if you just kind of come down and
  641. 22:40see, you can see the two elements of
  642. 22:42this, the on-camera build that we're
  643. 22:44doing right now. This is the Markov
  644. 22:46hedge fund method. If you click that, it
  645. 22:49will open up a link in another tab. And
  646. 22:52we're also going to click the Pine
  647. 22:53Script bonus as well if you're going to
  648. 22:55use this for TradingView. So, here is
  649. 22:57the hedge fund method skill that you're
  650. 22:59going to install into your AI.
  651. 23:02So, you're going to copy it from this
  652. 23:04moment onwards all the way down. It's
  653. 23:06going to This is all the information
  654. 23:08that I've kind of put together so that
  655. 23:10you can uh create this skill in your
  656. 23:13system. So, I've copied it. You're going
  657. 23:15to come over here. You're going to click
  658. 23:16paste and click enter. There's then
  659. 23:18going to be an onboarding process that
  660. 23:20you'll go through where it's just going
  661. 23:22to install this whole thing into your
  662. 23:24computer.
  663. 23:26If you're on Cloud Code, it's going to
  664. 23:27create a skill. So, anytime you have a
  665. 23:29trading strategy, you can just say,
  666. 23:30"Hey, can you go the Markov Run the
  667. 23:32Markov skill here?" And it'll go through
  668. 23:34the whole process to make sure that the
  669. 23:36strategy is, you know, beefed up.
  670. 23:38So, it said, "I'm going to install the
  671. 23:39Markov Hedge Fund Method skill into
  672. 23:41these this file, about 90 seconds on Mac
  673. 23:44and Linux and up to 2 to 3 minutes on
  674. 23:46Windows. You don't need any keys or
  675. 23:48accounts or admin passwords. Great."
  676. 23:50This is Rowan's framework on Rowan
  677. 23:52chain, an observable Markov regime model
  678. 23:55that builds a bear a bull bear sideways
  679. 23:57transition matrix from any ticker.
  680. 24:00Great. So, if you're ready, you just
  681. 24:01type go and it will start the process.
  682. 24:05And it's basically done with the process
  683. 24:07now. We've been about 2 minutes and 21
  684. 24:09into this. And you can see that phase
  685. 24:11four of this whole process of the
  686. 24:12onboarding, it says it's going to run a
  687. 24:15um a Markov regime basically on the SPY
  688. 24:1910-year chart. And this is just a demo
  689. 24:22to show that it does in fact work. You
  690. 24:24could also then after this just say,
  691. 24:26"Hey, run it on Bitcoin. Run it on
  692. 24:27Ethereum." Whatever you want to do, and
  693. 24:29it will apply the Markov regime,
  694. 24:31everything we've talked about today, to
  695. 24:33that asset. And it really can be an any
  696. 24:35asset. And just like that, the whole
  697. 24:37Markov Hedge Fund Method skill has been
  698. 24:39installed. So, whenever you want to use
  699. 24:41it on a strategy, you just type forward
  700. 24:43slash Markov and you can see Hedge Fund
  701. 24:47Method. You type that there and then
  702. 24:49talk about your strategy or whatever.
  703. 24:51And that's how it works.
  704. 24:53Next, we're going to just talk about how
  705. 24:54we can apply the Pine Script into our
  706. 24:58uh TradingView. And all you do is come
  707. 24:59over to the Pine Script page that we
  708. 25:01talked about earlier. Click copy raw
  709. 25:03file right up here. Then you can go over
  710. 25:05to your TradingView. I've already got
  711. 25:07mine installed, but I'm going to delete
  712. 25:08it so you can see it all work. On the
  713. 25:11right-hand side, this is on the desktop
  714. 25:13app, by the way,
  715. 25:14we've got a mountain-looking icon. That
  716. 25:17is the Pine Script icon. You can click
  717. 25:19that. And sometimes it helps just to
  718. 25:21bring this out a little bit further.
  719. 25:23Uh we can do control A or command A to
  720. 25:27select everything and we want to delete
  721. 25:28that. Then we're going to click command
  722. 25:30V, which is paste. This is the Pine
  723. 25:32Script right here. And all we want to do
  724. 25:34is click the play button here, which is
  725. 25:36to add to chart. We can now close this
  726. 25:38and we wait for it to populate on the
  727. 25:40chart. And remember this is the Bitcoin
  728. 25:42chart and there we go. The Markov regime
  729. 25:44has been uh laid on here. This will work
  730. 25:47for any asset because it's just doing
  731. 25:49the calculations automatically. And the
  732. 25:51one to look at, obviously, we've
  733. 25:52explained the nine
  734. 25:54the nine kind of card uh view, but the
  735. 25:58long run mix is the the one that I like
  736. 26:00to look for. So, if we look at the bull
  737. 26:02percentage for tomorrow, it's 29% chance
  738. 26:07of tomorrow being a bull run. Tomorrow
  739. 26:09being a bear market is 42% chance and
  740. 26:1229% chance of it going sideways. And so
  741. 26:15that that bear market being the highest
  742. 26:16percentage, the highest likelihood, is
  743. 26:18because we have bear behavior um uh
  744. 26:22recently, right? It's just it's a sticky
  745. 26:24state, as we talked about. So, that's
  746. 26:26how it works. It all works here. I'll
  747. 26:28actually go and change the the chart.
  748. 26:30Maybe we do, let's say, XRP, for
  749. 26:33example.
  750. 26:34And again, it applies the numbers for
  751. 26:36XRP as well. And you can do really
  752. 26:38anything here. Um I don't know what else
  753. 26:40I can kind of show. Stocks, Tesla.
  754. 26:43There it is. The Markov regime works for
  755. 26:44that, as well.
  756. 26:46All right. So, I hope you've got
  757. 26:47tremendous use from this. This is one
  758. 26:49part of a potential series on the topic
  759. 26:52of quant strategies that we can use AI
  760. 26:54to implement. If at any point you're
  761. 26:56doing this process and you hit a
  762. 26:58roadblock, you can always uh get in
  763. 27:00touch with me on 01 systems. It's the
  764. 27:03second link in the description. That's
  765. 27:05the only place really where I can
  766. 27:06provide feedback and help people with
  767. 27:08issues and bugs that they have along the
  768. 27:10way. So, check that out if you're
  769. 27:12interested and I'll see you in the next
  770. 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.