Fable 5 + Claude Code + MCP = King of Algo Trading! — Transcript
Full transcript
- 0:00Antropic just released Fable 5 model.
- 0:03There was a huge amount of hype behind
- 0:05this model and supposedly it's even
- 0:08dangerous to run because it can like
- 0:10hack so many websites or do crazy things
- 0:13like that. However, in this channel, we
- 0:15are interested in the performance of the
- 0:17model for algo trading. So, I'm going to
- 0:19take it for a test drive. I want to see
- 0:21how good of a strategy it can write for
- 0:23me and whether or not it is good at you
- 0:25know doing research in a loop in order
- 0:27to run back tests run optimizations to
- 0:31improve the result of the strategy and
- 0:33whether or not it can run Monte Carlo
- 0:35simulations in order to pick the
- 0:37candidates that are not overfit because
- 0:39we don't want to just see some good
- 0:40results on a back right we want to
- 0:42ensure that it isn't overfit and before
- 0:44I continue I got to say I am not a
- 0:45financial adviser and this video is for
- 0:47educational only so with that out of the
- 0:50way Let's get right into it. So, this
- 0:53model was just released and we heard a
- 0:56lot of hype behind the claw mythus model
- 0:58which was originally the name of it and
- 1:00now they have made one version out of
- 1:02this one and are calling it fabel 5.
- 1:04However, there's one bad news and that
- 1:06is the cloth code is going to just
- 1:07include this new model until June 2020
- 1:11and after that we're going to have to
- 1:12pay through the API in order to access
- 1:14it. And the other thing is that if you
- 1:16use the pro plan of Antropic, you're not
- 1:19going to be able to use this model. Like
- 1:21it might be open, but you're going to
- 1:23hit your limit like very soon, like
- 1:25right away. So you do need a max
- 1:27subscription. Either the $100 or $200 is
- 1:30fine. And as always, for the algo
- 1:32trading side of things, I'm using Jesse
- 1:33framework. So if you haven't installed
- 1:35it already, check out the documentation
- 1:37or my previous videos on how to do that
- 1:39for different operating systems. Once
- 1:41you do set up JC, when you run it, it
- 1:43will give you some sort of MCP like
- 1:44this. And inside the terminal that you
- 1:46are running your JC project, you just
- 1:48want to run the command cloud MCP and
- 1:51then this. So you give it the transport
- 1:53as HTTP. You name it, and then you pass
- 1:56that address here. And that's it. Again,
- 1:58you can find this in the documentation
- 2:00or my previous videos if you haven't
- 2:02watched them already. All right. Next
- 2:03time you update your cloud code, you're
- 2:05going to see a message like this, which
- 2:07is telling us that the Fable 5 model is
- 2:10out. And to switch to it, we're going to
- 2:12say /model.
- 2:14And then I'm going to pick the Fable 5.
- 2:16Now, we got to be careful because the
- 2:18usage of this model is actually double
- 2:20the Opus 4.8. Next, you see I'm getting
- 2:23this issue. It means that my MCB server
- 2:25is down. So, let's take a quick look at
- 2:27that. All right. So, I can see that I'm
- 2:29not even running this project. So let's
- 2:31run Jess run. And now
- 2:35everything is up and running. I can see
- 2:37the URL for the dashboard and the URL
- 2:39for the MCP. So I'm going to go back to
- 2:41my IDE. And just in case I'm going to
- 2:44reload it
- 2:46and run cloud code one more time and we
- 2:49are good to go. And we can see the
- 2:51selected model is also fable 5. And that
- 2:53MCP error is also gone. All right. Now
- 2:56is the time to give the task to the
- 2:57model to accomplish. And of course, as
- 2:59always, we just want the strategy. So, I
- 3:01need you to do research for a trend
- 3:03following strategy for ETHUSDT on the 30
- 3:06minutes time frame. Firstly, I need you
- 3:08to validate the inter rule of each
- 3:10strategy that you write before
- 3:12continuing with back testing. If you
- 3:13find a good candidate and if it looks
- 3:15promising, then feel free to run
- 3:17optimization on it. If you did run the
- 3:19optimization on it and found good
- 3:21results, then proceed to Monte Carlo
- 3:23simulation on the best 10 or 20
- 3:26candidates, finding those less likely to
- 3:28be overfit. Continue until you get it
- 3:30right and find such a strategy unless I
- 3:33stop you. What I consider a good
- 3:35strategy is one with a sharp ratio of
- 3:371.2 in the last two years.
- 3:40So there we go. It has everything. I
- 3:42asked it to not only write the strategy
- 3:45and execute back test. I also asked it
- 3:47to run rule test to make sure the inter
- 3:50rule of the strategy has some
- 3:51statistical significance and I also
- 3:54asked it to run optimization but we
- 3:56don't want it to overfitit the strategy.
- 3:58So that's why I am also asking it to run
- 4:00Monte Carlo simulations on it. So this
- 4:02is basically a complete cycle for
- 4:04developing a strategy. And of course the
- 4:06time frame that I gave to it for these
- 4:08back test and research is the last two
- 4:10years. So, let's hit enter and see what
- 4:12it does.
- 4:18Now, while that's going, I want to
- 4:19quickly remind you guys about our
- 4:21Telegram. It's the fastest way to get
- 4:22notified about my future work, whether
- 4:24it's a new tutorial or a tool that I
- 4:26create. Also, don't forget to check out
- 4:28our free Discord where more than 5,000
- 4:30members like you and I are hanging out
- 4:32there and helping out each other with
- 4:33algo trading, so we can all succeed
- 4:35together. The links for both are down in
- 4:37the description. Right, the task is done
- 4:39and I burnt nearly 2% of my weekly limit
- 4:43for this use case. So no, I don't think
- 4:46this is burning like a crazy amount of
- 4:48tokens. Now let's get to the results and
- 4:50see what it did. So you see it generated
- 4:52three strategies and it also generated
- 4:55significance rule test for them to
- 4:57ensure that the inter rules of the
- 4:59strategy are not pure noise or luck and
- 5:02they indeed have some statistical
- 5:04significance. It also checked for the
- 5:06candles and it's saying that there's no
- 5:08missing candle. So if there was some
- 5:10candles missing, it would have imported
- 5:12them by itself for me. So I didn't have
- 5:14to do it myself anymore. So that's
- 5:16pretty cool. And then you can see that
- 5:17it is running these tests in the
- 5:19background. I'm hoping simultaneously,
- 5:21which is really great. So yeah, it says
- 5:23while that runs, I'll save the drafts
- 5:25for the other two candidates so they're
- 5:28ready to fire sequentially. So this is
- 5:30awesome because it is generating
- 5:31strategies and doing research
- 5:33simultaneously for multiple strategies.
- 5:36So that will save me a lot of time. Next
- 5:38we can see that it keeps waiting for the
- 5:41back test and optimization runs to
- 5:43finish and then it says those are done.
- 5:45All right. So let's just scroll down
- 5:46until we see some actual results. All
- 5:49right. So here we can see that it says
- 5:50done. The full pipeline complete. Final
- 5:53result is this strategy last two years
- 5:56sharp ratio of 1.24 24 and the target
- 5:59was more than 1.2 two as I just
- 6:01explained to the model that that should
- 6:03be its goal and it says that there's
- 6:05also one honest cab okay so here's also
- 6:07a report file which we can find here so
- 6:11reports all right so there is this
- 6:13markdown format so we can also read this
- 6:15one but I would like to continue reading
- 6:17the chat because I want to see the exact
- 6:20steps that the model took so first it
- 6:22checked the inter rules of all three
- 6:24strategies and it is saying that like
- 6:26all of them are beating a random
- 6:28simulation basically so that means So
- 6:30that all three strategies actually had
- 6:31some statistical significance and here
- 6:33it's also giving me the URL. So let's
- 6:36open this one in the dashboard. So as
- 6:38you can see this is a curve bill for the
- 6:40simulations and this is the actual
- 6:42return of the strategy. So it is beating
- 6:44it by huge margin. So there's no way
- 6:46this is going to be chance. And here we
- 6:48can also see that it's telling me it is
- 6:50highly significant. So that's awesome.
- 6:52Next it's telling me that the baseline
- 6:54strategy that he wrote actually had a
- 6:55sharp ratio of 0.44 44 and it was being
- 6:58killed by the fees because it was
- 7:00executing $1,048 trades which is
- 7:02obviously a lot and we were paying
- 7:04$9.4,000
- 7:06in trading fees on an account which is
- 7:08sorted from 10K. So of course this needs
- 7:10to come down. So this was promising
- 7:12signal but wrong frequency. So that's
- 7:14when I decided to run optimization on
- 7:16it. And then for the optimization it's
- 7:18telling me that it had 400 trials. This
- 7:21was a training period and this was a
- 7:23testing period. most of the top 20
- 7:25results were actually overfitit. So this
- 7:27is really important because if you only
- 7:29run optimization without running any
- 7:32Monte Carlo test, you will find some
- 7:34results that look good on the back test,
- 7:35but in reality they're not going to
- 7:37perform well because the strategies are
- 7:40going to be overfit. However, the agent
- 7:42now knows how to do that. So it's going
- 7:44to run Monte Carlo simulations to
- 7:47prevent this. So on the fourth step, it
- 7:49did actually run the Monte Carlo
- 7:50simulations on all the best candidates
- 7:53which were the result of the
- 7:54optimization mode. Next, it's actually
- 7:56telling me how exactly it did analyze
- 7:58the results in order to see which ones
- 8:00were overfit and which ones weren't. And
- 8:02then finally, it is giving me the
- 8:03winner. So it's telling me the candidate
- 8:05number seven had these results and it
- 8:08wasn't also overfit. We also have number
- 8:10five which has a sharp ratio of 1.34
- 8:13which seems even better. So let's open
- 8:15both of them in the dashboard. So this
- 8:18one is candidate number seven and this
- 8:20one is candidate number five. So number
- 8:23five is definitely looking better in its
- 8:25equity curve. This one looks better. It
- 8:28has a P&L of 130%. This is how much
- 8:31trading fees we paid. The max is minus
- 8:3320%. The annual return is 51. The win
- 8:36rate is 7. The win rate is 37% with an
- 8:39average win to loss ratio of 2.11. The
- 8:42average holding time of each position is
- 8:449 hours. The sharp ratio again is 1.34
- 8:48and the calmmore is 2.5. And the average
- 8:50number of trades per month is 17 which
- 8:52is a pretty good number. Now it is also
- 8:54giving us a warning telling us that the
- 8:56results that we just run did not include
- 8:59any out of sample and that when it did
- 9:01the results weren't as good. Now here's
- 9:03the thing. This is true. We also do need
- 9:06to run out of sample before going into
- 9:08production with any strategy. However,
- 9:11we do also have access to Monte Carlo
- 9:13simulations and I personally believe in
- 9:15that one for preventing overfitting more
- 9:17than anything else. Especially because
- 9:19if we do not have access to enough
- 9:21candle history, there's no way for us to
- 9:24maybe run an out of sample back test,
- 9:27but we always have access to Monte
- 9:28Carlo. But that being said, in this
- 9:30case, because this is simply easy, of
- 9:33course, we have access to more data. So
- 9:35you do want to run out of sample back
- 9:37test before going live with any of the
- 9:39strategies that the model is finding for
- 9:41you. Next I asked the model please also
- 9:43give me the URLs for the Monte Carlo of
- 9:45the result not just the back test. So I
- 9:47did this because I wanted to open the
- 9:49Monte Carlo results in the dashboard. So
- 9:52all right so here's for number seven and
- 9:54here's for number five.
- 9:57All right. So as you can see this yellow
- 9:59line here is the original back test and
- 10:02its results is not in the top 5% or like
- 10:06the best simulations. It is almost in
- 10:08the middle which is always a good sign.
- 10:10And if you also read this table you can
- 10:12see the sharp ratio of the original back
- 10:14test was 1.04
- 10:17while the median of the simulations was
- 10:190.75 and the best 5% it was 1.99. So
- 10:24this number is closer to the median
- 10:26number which is a really good sign in
- 10:28order to say that the results that we
- 10:30got weren't just luck or an overfit
- 10:33strategy. So again this is a good sign
- 10:34because usually I want the result of the
- 10:36original back test to be less than the
- 10:38best 5% but not only that I also wanted
- 10:40to be as close to the median number as
- 10:42possible and in this case we are getting
- 10:44exactly that. And if you take a look at
- 10:46the results for the candidate number
- 10:48five, we can see that again the original
- 10:51back test results is almost in the
- 10:53middle and the shop ratio of it for the
- 10:56original is 1.12. For the median it is
- 10:590.69 and for the best 5% it is 1.93. So
- 11:03again this number is closer to the
- 11:05median which is a good sign that the
- 11:07strategy is not like super overfit. Now
- 11:10the candidate number five was the best
- 11:12result that it found for us. So let's
- 11:14take a look at its code. So in my code
- 11:17editor I can find it under strategies e
- 11:20trendb and then this is the strategies
- 11:23file. Now here we can see the
- 11:24hyperparameters that it defined for the
- 11:26strategy. Usually we put this method at
- 11:29the end of the strategy but apparently
- 11:31the agent decided to put it here. So we
- 11:33can see it defined the ballinger band
- 11:35period, the deviation of ballinger band,
- 11:38the EMA period and the stop-loss
- 11:40multiplier. Now here's how it defined
- 11:42the ballinger band. So it's a simple
- 11:44property. It says return TA. Ballinger
- 11:47bands and then it is passing the current
- 11:48candles. The period is what we had in
- 11:51the hyperparameter and so was the
- 11:53deviation number. And for the trend EMA,
- 11:55it is simply saying return TA. EMA and
- 11:59then the current candles and the period
- 12:01of it. Now the default value for this
- 12:03was 195. And by the way, if you want to
- 12:05see like what was the result of this
- 12:07period, for example, for the ending back
- 12:10test, we can go back to the dashboard
- 12:11and scroll down here. So under
- 12:14hyperparameters table, you can see the
- 12:16BB period is 23. The BB deviation is
- 12:192.96. The EMA period was again
- 12:24194. So it was just slightly less than
- 12:27this default value here. And then the
- 12:29ATR, TATR. So you see Jesse's syntax for
- 12:34using indicators is like super simple.
- 12:36And then for the inte rules of the
- 12:38strategy in the should long method, it's
- 12:40simply saying that if the current
- 12:42closing number is bigger than the
- 12:44current Ballinger band's upper band and
- 12:46the current closing number is bigger
- 12:48than the trend EMA. So basically this is
- 12:51a breakout strategy. We want to ensure
- 12:53whenever we close above the upper band
- 12:55of the Ballinger band, we want to go
- 12:57long. And we also have this filter here
- 13:00which I'm guessing it defined in order
- 13:02for the strategy to take less number of
- 13:04trades. So we can pay less trading fees
- 13:07because that's the problem that was
- 13:09killing the strategy or the baseline
- 13:11version that it wrote for us. And for a
- 13:13short version is doing exactly the
- 13:14opposite. And for the Golang function
- 13:16which is where we define the position
- 13:18sizing of the strategy. The entry price
- 13:20is the current price which means it's
- 13:22going to be a market order and the stop
- 13:24loss is going to be the current entry
- 13:26minus this multiplier which we define as
- 13:28a hyperparameter mult multiplied by the
- 13:31current ATR value. So in this case the
- 13:34stop was 3.19. So almost three times the
- 13:37current ATR below the entry is going to
- 13:40be the stop loss of the strategy. And
- 13:42then it defined 3% risk using the risk
- 13:45to quantity utility function of Jessie
- 13:47for the size of the position. But it
- 13:49also defined this value because it wants
- 13:51to ensure that the size of the position
- 13:53doesn't go above 95% of the current
- 13:56available margin. So this is basically
- 13:59ensuring that we do not really use
- 14:01leverage in the strategy. I usually
- 14:03don't do this myself because for example
- 14:05if 3% risk is what I want per each trade
- 14:09then I have no problem if the strategy
- 14:11ends up using leverage. Especially if
- 14:14I'm trading futures we have access to
- 14:16that amount of leverage. So why not do
- 14:19it? But the strategy is being more
- 14:21cautious and it is using less risk or at
- 14:24least it is limiting it to ensure it
- 14:25doesn't go above that value. And then
- 14:27finally it is submitting the current buy
- 14:29order using this syntax. So first the
- 14:31quantity and then the price and that's
- 14:34it. Again super simple in the JC
- 14:35framework. And for a short position it's
- 14:38doing the exact opposite. And then we're
- 14:40saying once the position opens using the
- 14:42unopen position method, we're saying
- 14:44that if it's a long position, the stop
- 14:46is going to be the current quantity of
- 14:48the current position and the price of it
- 14:50is going to be the current positions
- 14:52entry price minus the sub multiplier
- 14:55multiplied by ATR. So basically exactly
- 14:57what we had here. It's just defining it
- 14:59here. Now, by the way, it could have
- 15:00submitted the stop loss right within
- 15:02this function. Especially if you are
- 15:04trading futures, that totally works in
- 15:06Jesse. It did not have to define it here
- 15:09but this is all also fine. And then in
- 15:11the update position method which is
- 15:13basically assume that you have an open
- 15:15position whenever another candle closes
- 15:19that's when this method is being called
- 15:21and we want to ensure okay should we
- 15:22just keep trading or or should we close
- 15:24the current open position and it's
- 15:26saying that if it's a long position and
- 15:28the current closing price is below the
- 15:32middle band of the Ballinger bands
- 15:33indicator we want to liquidate the
- 15:35current position. So this is a helper
- 15:37function of Jesse. Basically you just
- 15:39call it and it closes everything. So you
- 15:41do not have to worry about like what
- 15:44should be the price of the order to
- 15:46close it or anything like that. And it's
- 15:48doing again the opposite for a short
- 15:50position. And it also defined this which
- 15:52is optional really. You don't have to do
- 15:54it. If your position is being opened
- 15:56using a market order, you don't need it.
- 15:59But if you are using a limit order or a
- 16:00stop loss order in order to open the
- 16:03position, that's when you need this
- 16:04method in J. So for now, if you don't
- 16:06know what it is, just ignore it. In this
- 16:08example, this is not needed at all. So
- 16:10that's it guys. Like the code of the
- 16:12strategy is super simple. It just
- 16:14defined a couple of hyperparameters. It
- 16:17ran optimization on it and then it ran
- 16:19Monte Carlo to ensure that we only
- 16:21picked the results that are less likely
- 16:23to be overfit. So that's it. Like you
- 16:26hear this saying that you know the
- 16:28strategies needs to be simple in order
- 16:30to work. Well, here it is. your strategy
- 16:32that it found for us is indeed simple.
- 16:35Next, let's go back to the results and
- 16:37take a look at the trades that it
- 16:39actually took. So, here we have access
- 16:41to this chart and I can just click on
- 16:44any number that I like. So, for example,
- 16:45this one seems interesting. It's for a
- 16:47winning trade. So, here it open a short
- 16:50position at the closing price of this
- 16:52candle and here is where it closed that
- 16:56same trade. Next here I can see this is
- 16:59where it went long and this is where it
- 17:02closed the position. But if we pay
- 17:05attention you see this is a losing trade
- 17:07and the reason is because we went long
- 17:09not here but at the closing price which
- 17:11was here and we didn't close it here we
- 17:14closed it here. So that's why this was a
- 17:18losing trade. So this is really
- 17:19interesting because on the first glance
- 17:21this looks like a winning trade but it's
- 17:23not. So let's take a look at another
- 17:26winning trade. So if I click here, so
- 17:28it's opened it here and closed it again
- 17:31here. So this is good. If you take a
- 17:33look at this one for example, it went
- 17:36short here but closed it here. So the
- 17:39reason the strategy is making money even
- 17:41though its win rate is low is because
- 17:43the winning trades are making us more
- 17:45money comparing to the losing ones. So
- 17:48that's another key lesson which is your
- 17:50strategy doesn't have to win all the
- 17:52time for you to be profitable. just
- 17:54needs to win big enough and it also
- 17:58needs to have a good win to loss ratio
- 18:01which is the case with this strategy.
- 18:03Now if you wanted to we could also
- 18:05define some extra charts to for example
- 18:07see the Ballinger bands here which can
- 18:09be pretty helpful if you wanted to do
- 18:11some debugging in this strategy. Now I
- 18:14am going to add this strategy to our
- 18:16strategies page. So if you want to check
- 18:17out its results for others periods or
- 18:20symbols or time frames just feel free to
- 18:22do so. You can also check out this page
- 18:24for other strategies that I've made in
- 18:26the past or to see how they are
- 18:28performing now. So before I leave you, I
- 18:30want to answer two questions. Should you
- 18:32trade this strategy or not? Because I
- 18:34get this question a lot whenever I make
- 18:36a video like this. And the answer is no.
- 18:38At least not yet. You need to continue.
- 18:41You need to run some back test like out
- 18:42of sample or maybe do some further
- 18:44research because this was like a super
- 18:47simple example and I just gave the model
- 18:50literally one prompt only. So of course
- 18:52you want to play around with it, see if
- 18:54you can improve it or not. But at the
- 18:55end of the day, the point of the video
- 18:57was not to give you one strategy. It was
- 19:00to show you how you can use these models
- 19:02to do research for yourself to save you
- 19:05countless hours. And the second question
- 19:07is should you use Fable 5 model for
- 19:10doing this type of work? Now this is my
- 19:12two cents and that is no, you shouldn't.
- 19:15And the reason is because other models
- 19:16from Antropic such as Opus or even Cloud
- 19:20Sonnet could easily do the same thing.
- 19:22Sure, maybe the strategy the right for
- 19:24you is not going to be as good on the
- 19:26first try, but if they keep iterating,
- 19:29which I showed you how to put it inside
- 19:31the loop, right? So, if you do that, I'm
- 19:34sure that it's going to find you a good
- 19:35enough strategy as the time goes. But
- 19:38the Fable 5 model is But the Fable 5
- 19:40model is more expensive. you are going
- 19:43to need a max subscription for it. But
- 19:45even that is only going to be enough for
- 19:47a few days because very soon Antropic is
- 19:50removing the Fable 5 model from the
- 19:52subscription model. And in order to use
- 19:54it, you're going to have to pay through
- 19:55the API which is going to cost you a
- 19:58kidney. So that's the main reason why I
- 20:00wouldn't use it because it's just too
- 20:01expensive. And yes, it seems like really
- 20:05awesome in some benchmarks, but I don't
- 20:07believe for our type of work, we need to
- 20:09pay that much in order to do research.
- 20:12We can do it with a lot cheaper models
- 20:15than this one. Now, before I leave you,
- 20:17please give this video a like and
- 20:18subscribe to the channel if you haven't
- 20:20already. I record tutorials like this
- 20:22all the time and also share many trading
- 20:24strategies. So, if that's something that
- 20:26you are into, again, be sure to
- 20:27subscribe and hit the bell button. Thank
- 20:29you so much for watching. I'll see you
- 20:30in the next one.
About this transcript
This page contains the full transcript of Fable 5 + Claude Code + MCP = King of Algo Trading! by Algo-trading with Saleh, generated from the public captions YouTube serves with the video. The transcript has 4,109 words across 553 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.