YouTube2Text

Qwen3 Coder tested: Is it good for algo trading strategies? — Transcript

by Algo-trading with Saleh · 4,932 words · 695 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Hey guys, it's S. In this video, we're
  2. 0:02going to review the Quen Tree Coder
  3. 0:04model. It's the latest open source model
  4. 0:06and according to their creator Alibaba,
  5. 0:09it is on par with the Clawson Sonnet
  6. 0:12model. And considering the cost of this
  7. 0:13model is significantly lower. If that's
  8. 0:15true, then it's an amazing choice for
  9. 0:17us. But as always, what we care about as
  10. 0:19algo traders is the performance of these
  11. 0:21models for tasks such as writing algo
  12. 0:24trading strategies from scratch,
  13. 0:25improving our existing strategies,
  14. 0:27debugging them, and whether or not the
  15. 0:29model has some trading knowledge. So in
  16. 0:31this video, we're going to test the
  17. 0:32model to see how it compares to the
  18. 0:34previous models that we have tested. If
  19. 0:36that all sounds good, let's get right
  20. 0:37into it. Now, this is the blog post
  21. 0:40released by the Alibaba. And as you can
  22. 0:42see, it is either beating all the
  23. 0:43previously released models or it is on
  24. 0:45par with them. And by the way, they're
  25. 0:47also comparing it to Kimik K2 model,
  26. 0:50which just before this model was
  27. 0:52claiming to beat all the other models.
  28. 0:53And in fact, I already made a video
  29. 0:55about it. It's still being edited by my
  30. 0:57editor. But this video, I'm going to
  31. 0:59edit myself. So I have no idea which one
  32. 1:02you're going to see first. But in either
  33. 1:03way, with this type of testing that
  34. 1:05we're going to do today and give the
  35. 1:07model some ranking, you'll be able to
  36. 1:09compare the two very fast. They're also
  37. 1:11showing this beautiful chart here which
  38. 1:13we can see very quickly which model has
  39. 1:16good performance based on their size. So
  40. 1:20basically the lower the size of the
  41. 1:21models so such as these as you can see
  42. 1:24are even smaller than Kimik 2 it means
  43. 1:26they'll be cheaper or faster. Although
  44. 1:28to be honest in this case the coin 3
  45. 1:31isn't cheaper than Kim K2 but it may be
  46. 1:35faster but comparing to other models
  47. 1:37such as Gemini 2.5 Pro or Cloud Sonnet.
  48. 1:40Yes, it's definitely cheaper. Now, even
  49. 1:43though this model is open source, it
  50. 1:44doesn't really mean that you can host it
  51. 1:46on your own local machine cuz taking a
  52. 1:49look at the size of the model, it has
  53. 1:51480 billion parameters. That means
  54. 1:54forget about hosting it on any single
  55. 1:56GPU or a MacBook machine like mine. So,
  56. 1:58the only thing that you can do is to run
  57. 2:00it on a cluster. So unless you are a
  58. 2:02business and you have a cluster of GPUs
  59. 2:05in your hands, then the only option that
  60. 2:07you can use this model is by using their
  61. 2:09API with services such as open router or
  62. 2:12you can also use Jesse GPT which is our
  63. 2:14cloud-based service. Now in this video
  64. 2:16I'm going to use Jesse GPT as always.
  65. 2:18But if you guys have some privacy
  66. 2:19concerns or you don't want to pay us
  67. 2:21anything and you want to self host
  68. 2:23everything by yourself, then go ahead
  69. 2:25and watch this video of mine from before
  70. 2:27where I show you how you can use open
  71. 2:29router and JAN AI to self-host these
  72. 2:32things on your machine. Now when I say
  73. 2:33self-host, I don't mean actually running
  74. 2:35the model. You will still be using some
  75. 2:37API from another service. So with that
  76. 2:39in mind, let's get to the first
  77. 2:41question. Write a golden cross strategy
  78. 2:43that uses the 50 and 100 moving
  79. 2:45averages. close the position when the
  80. 2:46entry rule is no longer valid. And by
  81. 2:48the way, I've chosen quantry model here,
  82. 2:50but as you can see, we also have other
  83. 2:52models such as Kim Kate 2, DeepS chat,
  84. 2:55cloud sonet 4, Grog four and three, and
  85. 2:59basically all the cutting edge models.
  86. 3:01Now, it gave us the strategy and it also
  87. 3:03explained it pretty well. Okay, so let's
  88. 3:05copy this, go to Jesse, and I'm going to
  89. 3:09make a new strategy. I will call it test
  90. 3:13quantry
  91. 3:15coder
  92. 3:17and paste the whole thing here. Let's go
  93. 3:19to back test
  94. 3:22coder. Set the time frame to hourly. The
  95. 3:26BTC USDT is fine. Exchange is Binance
  96. 3:28perpetual futures. And for the duration,
  97. 3:32let's select the first 6 months of 2024.
  98. 3:38The fast mode is enabled. and so is the
  99. 3:40benchmark feature. Now before I run it,
  100. 3:42let's take a look at the code. So it
  101. 3:44defined one property for the moving
  102. 3:47average of 50. It is simply returning
  103. 3:49TAS SMA which is the correct syntax in
  104. 3:52JC for using the SMA indicator. It's
  105. 3:55passing the current candles and then the
  106. 3:57period which is 50. It's doing the same
  107. 3:59thing with 100. Our entry rule is if the
  108. 4:02moving average of 50 is bigger than 100,
  109. 4:04go long. Do the opposite for short
  110. 4:07positions. And for position sizing is
  111. 4:09passing the entire balance, the current
  112. 4:12price and setting the fees of the
  113. 4:15current exchange. Then it's submitting
  114. 4:17the current buy order to open a long
  115. 4:18position using first this quantity and
  116. 4:21then the current price. So this means
  117. 4:23it's going to use a market order to
  118. 4:25enter the position. It's doing the
  119. 4:27opposite for a short position and then
  120. 4:30it's saying assuming we already have an
  121. 4:32open position and we want to update it
  122. 4:34once a new candle closes. If it's a long
  123. 4:36position and the moving average of 50 is
  124. 4:39below 100, which is the opposite of our
  125. 4:42integer rule, we want to liquidate the
  126. 4:44position. And then we do the opposite
  127. 4:46for short positions. And it is returning
  128. 4:48this as false, but it's not really
  129. 4:50necessary. We we could even delete it
  130. 4:52because we're using a market order to
  131. 4:54enter the position. But that function is
  132. 4:57only used when we are using either a
  133. 4:58limit or a suborder to open our
  134. 5:00positions. But I'm going to leave it as
  135. 5:02it is. So, let's go back and run our
  136. 5:05first back test. And it went true. So,
  137. 5:09this purple line is our portfolio's
  138. 5:12equity curve. And the orange one is BTC.
  139. 5:15It's even beating the market. That's
  140. 5:17good. It made 61% in P&L. The maxon is
  141. 5:21-7%.
  142. 5:23The V rate is 42 and the sharp is 2.12.
  143. 5:27So, this is really good and it
  144. 5:29definitely deserves a perfect 10 score.
  145. 5:32All right. Next, convert this pine
  146. 5:33script strategy into Python code. Now,
  147. 5:35we're going to need a pine script code
  148. 5:37to feed the model. And for that, I'm
  149. 5:39going to look up trading view for super
  150. 5:43trend strategy. It is this one.
  151. 5:47And if I click
  152. 5:51here, I'll be able to get the source
  153. 5:54code of it. And then we can go back and
  154. 5:57paste it here.
  155. 6:00All right. So it gave us the whole
  156. 6:01strategy. Let's copy it. All right. So
  157. 6:04it defined super trend by using the
  158. 6:08correct syntax of super trend indicator
  159. 6:10on Jesse. It is TA. Super trend pass the
  160. 6:13current candles and the period
  161. 6:15which it defined here
  162. 6:19and also the factor again here. Now it
  163. 6:23didn't really need to define it here I
  164. 6:25believe but it is fine. Now sometimes
  165. 6:27because the pine script code is doing it
  166. 6:30that way the model thinks that in Jesse
  167. 6:32it's also better to follow the same
  168. 6:34structure. So it's not necessarily wrong
  169. 6:37but usually in Jessie the syntax for
  170. 6:40strategies is significantly simpler. So
  171. 6:42you don't have to do it exactly the
  172. 6:44trading view way. Now for entry it's
  173. 6:46saying if the current trend is one and
  174. 6:50the previous trend was minus one. So it
  175. 6:52is trying to see if a crossover has just
  176. 6:56happened. Now this seems fine but it's
  177. 7:00not going to work because in just a
  178. 7:02syntax if you want to not receive just
  179. 7:04one value if you want to receive an
  180. 7:06array of values like all the previous
  181. 7:08values of that indicator you need to
  182. 7:10pass the sequential
  183. 7:14parameter
  184. 7:16and set it to true because by default it
  185. 7:18is set to false and it didn't do that so
  186. 7:22I know this is going to fail and besides
  187. 7:24that with super trend this isn't how we
  188. 7:27check if the trend is one or not because
  189. 7:30if I come here and
  190. 7:33open super trend. So basically that
  191. 7:36indicator value will give us this line
  192. 7:38here or here and if the current price is
  193. 7:40above it it means in uptrend or it
  194. 7:43should return one for the trend and if
  195. 7:45the current price is below it the trend
  196. 7:47is downward. So simply saying if its
  197. 7:51trend is one or minus one is not going
  198. 7:53to work. So overall I think this is a
  199. 7:55fail. It did do some fun stuff like it
  200. 7:58even tried to plot it on the chart with
  201. 8:00just it correct syntax. So I like how
  202. 8:03this model is thinking but this is a
  203. 8:05complete fail now because I like how it
  204. 8:09defined this correct syntax here and it
  205. 8:13also even did this. I'm going to give it
  206. 8:15one and that's a complete zero. All
  207. 8:18right next develop a mean diver strategy
  208. 8:20using the Ballinger bands and the RSI
  209. 8:22with a seven period. Let's copy this.
  210. 8:26Change the code. Paste it here. All
  211. 8:28right. So, it named it Fibonacci
  212. 8:30strategy. Define fib levels as these are
  213. 8:33the highs. The look back period is 50.
  214. 8:38And then it is passing the current highs
  215. 8:40by selecting the tree as the index. It's
  216. 8:42also fetching the recent lows.
  217. 8:45It is finding the recent swing high and
  218. 8:47low using this syntax.
  219. 8:51And the price range is highest high
  220. 8:53minus lowest low. Then it is calculating
  221. 8:55the Fibonacci retracement levels
  222. 8:59with this syntax and these magical
  223. 9:01Fibonacci numbers. Then it is passing it
  224. 9:03like this. So this is very beautiful,
  225. 9:06simple and elegant. Then it define a
  226. 9:08trend like this using two moving
  227. 9:10averages and it's saying return one if
  228. 9:13the EMA 50 is above EMA 200 otherwise
  229. 9:16minus one for a downtrend. In Schudlang
  230. 9:18first it's checking the trend. It's
  231. 9:20saying if it's minus one or if it's not
  232. 9:23one return we return false and if this
  233. 9:25passes then we want to say if the price
  234. 9:28is near or below a key Fibonacci level
  235. 9:30we want to go long again this is really
  236. 9:33beautiful like I remember previous coin
  237. 9:35models and I never like them but this
  238. 9:38one seems to be onto something. So next
  239. 9:41it's doing the opposite for short
  240. 9:43positions. And as for position sizing,
  241. 9:45it's using the current lowest low of the
  242. 9:48Fibonacci levels as the stop loss. Now
  243. 9:52let's check which one is the lowest low.
  244. 9:55Oh, okay. I see. So the lowest price.
  245. 9:57And for take profit, it's using the
  246. 10:00highest high. Now this is certainly one
  247. 10:04way to write Fibonacci strategy, but I
  248. 10:06haven't seen it. then it's risking 2% of
  249. 10:09the current available margin for each
  250. 10:11position. It's doing the opposite for a
  251. 10:13short position. Once the position is
  252. 10:15open, it is submitting the stop loss and
  253. 10:17take profit. So this is correct. But
  254. 10:20here's the thing, it didn't really need
  255. 10:22to define the takerit here. I mean, as
  256. 10:25for a stop loss, I get it. It is using
  257. 10:27it here. But this takerit variable is
  258. 10:30not being used anywhere. And in here,
  259. 10:32we're defining it even again. So this is
  260. 10:35unnecessary. And then if we already have
  261. 10:37an open position, it's saying if it's
  262. 10:39long and the current price is more than
  263. 10:43the entry price of the position plus the
  264. 10:46highest high minus the entry price of
  265. 10:49the current strategy multiplied by half.
  266. 10:52If that's the case, then update the
  267. 10:55current stop loss. So it defines some
  268. 10:57kind of trailing stop order. So this
  269. 10:59seems fine. Let's go and see if it runs.
  270. 11:02And it doesn't. So let's see where it
  271. 11:05went wrong. So, it's using this, but it
  272. 11:09didn't define it here. I mean, if it's
  273. 11:11using the 0.5 Fibonacci level in here, I
  274. 11:16believe this should also be here
  275. 11:19and here. And this should be this line.
  276. 11:24So, I think this is the correct
  277. 11:25approach. So, let's go back and give it
  278. 11:27another try. And it's not even
  279. 11:29performing that bad. Okay. So this is
  280. 11:31also a pass but I'm going to subtract at
  281. 11:35least one point because I could get it
  282. 11:38working by just one simple change and
  283. 11:40also overall the way it defined the
  284. 11:43logic of the strategy was really
  285. 11:44beautiful. Next update my code to
  286. 11:47display the values of important
  287. 11:48indicators of my strategy in back test
  288. 11:50for debugging purposes. Now for this one
  289. 11:53we're going to need a strategy and I
  290. 11:54will choose this one called teotren
  291. 11:57following from our website. I will fetch
  292. 11:58its source code. Go back and
  293. 12:03paste it here.
  294. 12:07Now let's remove these lines for
  295. 12:10the charts because we expect the model
  296. 12:14to write them.
  297. 12:17All right. So let's copy the code,
  298. 12:22paste it here. All right. So it defined
  299. 12:24this after method. It's using the
  300. 12:26addline to candle chart function. It
  301. 12:30gave it the name tema 10, tema 80 and 20
  302. 12:33and 70 for the 4 hours time frame.
  303. 12:35Everything seems correct.
  304. 12:37It define one extra line chart with the
  305. 12:41name of indicators to display the ATR
  306. 12:44value in it. And then it defined
  307. 12:46horizontal lines to our extra line which
  308. 12:49is this one. It defined the current
  309. 12:52threshold for the ADX and CMO both
  310. 12:56overbought and oversold values. But the
  311. 12:59problem is it didn't actually define the
  312. 13:01values of ADX and CMO on this chart. So
  313. 13:06it's just displaying the threshold. So
  314. 13:08this isn't exactly what I needed. So
  315. 13:10this is going to be a pass but not a
  316. 13:12perfect score. So let's go back and
  317. 13:15enable the interactive charts and give
  318. 13:18it a start. Now this error is because
  319. 13:21we're using the 4hour time frame in the
  320. 13:23strategy but we didn't define the data
  321. 13:25out but in back test Jess is smart
  322. 13:28enough to figure this out and handle the
  323. 13:30error for you. So the back test will go
  324. 13:32through but in live trading you got to
  325. 13:34be careful to add that data out
  326. 13:36otherwise your session could fail. Now
  327. 13:40it went through. Let's take a look. Now
  328. 13:42here are the values of the temo lines
  329. 13:46and this is the value of the ADX. Now,
  330. 13:49if I lower this, you can also find the
  331. 13:50thresholds for CMO and ADX. But again,
  332. 13:53this isn't exactly what I needed because
  333. 13:55the threshold alone isn't enough, right?
  334. 13:57We also want to see the values. And by
  335. 13:59the way, in the interactive charts page,
  336. 14:01you can also check out all the trades
  337. 14:03that it took and the prices and the
  338. 14:06orders. You can also click here to go
  339. 14:09and find that on the chart, which is
  340. 14:11pretty cool. So, this is a pass, but not
  341. 14:14a perfect pass. So, I'm going to give it
  342. 14:16like an eight because I believe it was
  343. 14:18an easy task and it could have easily
  344. 14:21done it. So, I'm not going to give it a
  345. 14:23nine. All right. Next. Write a trend
  346. 14:25following strategy that uses 15 minutes
  347. 14:27time frame for entry and 4 hours time
  348. 14:28frame for confirmation.
  349. 14:31All right. Let's copy it.
  350. 14:35Change the code. Paste it. And it define
  351. 14:38the long-term candles using the self get
  352. 14:40candles syntax. It passed the current
  353. 14:42exchange and symbol and passed the time
  354. 14:44frame as 4 hours. This is perfect. And I
  355. 14:47like that it first defined the long-term
  356. 14:49candles here so that it can use it
  357. 14:52later. And it is indeed using it in the
  358. 14:54long-term SMA here with the period of 50
  359. 14:58and then it is using the long-term SMA
  360. 15:00here to determine the current trend, the
  361. 15:03long-term trend really. And then in the
  362. 15:07shoot long which is the inter rules of
  363. 15:09the strategy it's saying if the short
  364. 15:11SMA is above the long SMA and if the
  365. 15:15long-term trend is simply true which
  366. 15:18would be this. So it needs to be lower
  367. 15:21than the current price then it means we
  368. 15:23are in an uptrend. All right. So it's
  369. 15:26also doing the position sizing is
  370. 15:29passing 2% as the number for risking per
  371. 15:32position.
  372. 15:34The stop is current entry which is the
  373. 15:36current price minus two times the
  374. 15:38current ATR.
  375. 15:40Then it's passing the current buy order
  376. 15:42doing the opposite for short positions.
  377. 15:45And then it's saying once the position
  378. 15:46opens if it's a long position the stop
  379. 15:49loss is going to have the quantity of
  380. 15:51the current position and the price of it
  381. 15:53is going to be the current price minus
  382. 15:55two times the current ATR. For take
  383. 15:57profit it's doing two times of that. So
  384. 16:01the risk-to-reward ratio of the strategy
  385. 16:03is going to be two.
  386. 16:05And then we're saying once every candle
  387. 16:08closes, assuming we have an open
  388. 16:10position, if it's a long position and
  389. 16:12the short EMA is below the long SMA or
  390. 16:16if it's vice versa, we want to liquidate
  391. 16:18the current position. So this seems
  392. 16:19really perfect. Let's go and run it. And
  393. 16:23it's a perfect pass. So let's give it a
  394. 16:2610.
  395. 16:32Next, here's the code for my trend
  396. 16:33following strategy in the 15 minutes
  397. 16:35time frame. The strategy is losing money
  398. 16:37because it is taking too many trades and
  399. 16:40there are too many false breakouts
  400. 16:41during the ranging markets. Please
  401. 16:43improve the strategy. So, here's the
  402. 16:45thing. Now, we want to test to see if
  403. 16:47the model has some actual trading
  404. 16:50knowledge. So, forget about coding. We
  405. 16:52want to see if it knows how to prevent a
  406. 16:55trading strategy from taking too many
  407. 16:57trades. And since it is a trend
  408. 16:59following, it needs to avoid the ranging
  409. 17:02markets. Now, for that, let's paste the
  410. 17:04previous strategy that it wrote just for
  411. 17:07us and see how it is able to improve
  412. 17:10upon it. There we go. Let's copy it and
  413. 17:13update this previous code and run it one
  414. 17:17more time. Now it's getting an error
  415. 17:20saying the source type 14 not
  416. 17:23recognized. Okay, so let's see what it
  417. 17:27changed. Okay, so here's really the
  418. 17:31problem. It's trying to define a moving
  419. 17:33average based on the values of the ATR,
  420. 17:36but this isn't the correct value cuz
  421. 17:38this parameter in Jesse is the source
  422. 17:41type of the candles. Now, if you don't
  423. 17:42know what that means, it doesn't really
  424. 17:44matter, but just know that this isn't
  425. 17:46correct. So what it should have done was
  426. 17:50to here pass the sequential
  427. 17:53as true. Now this one would have been
  428. 17:56simply the period. So 14 and then
  429. 17:59instead of passing the current candles
  430. 18:01it should have given it the ATR.
  431. 18:05So this would have worked for ATRM MA
  432. 18:09and here it could have simply checked
  433. 18:13the latest value of this with this one.
  434. 18:17So this I believe should pass. Let's
  435. 18:19give it another go. Okay, so it seems
  436. 18:23like it defined a filter but it isn't
  437. 18:27correct. So let's take a look. So it
  438. 18:30defined a couple of filters and it
  439. 18:32passed them here. But this syntax seems
  440. 18:35correct except this one. Oh, so this
  441. 18:39shouldn't have been a property. So it
  442. 18:42defined this volatility check. It also
  443. 18:45defined two more filters. So one is is
  444. 18:48the current ADX value above 25 which is
  445. 18:51brilliant. And then it's checking for
  446. 18:54choppy markets because you want to make
  447. 18:56sure the choppiness index is below 50,
  448. 18:58which is really good way to make sure
  449. 19:01there are some actual structure and not
  450. 19:03so much randomness in the current
  451. 19:05market. All right, so let's give it one
  452. 19:08more try
  453. 19:10and it did go through this time. Okay,
  454. 19:13so it got a couple of things wrong, but
  455. 19:16it did lower the number of the current
  456. 19:18trades, but it still isn't profitable
  457. 19:21actually.
  458. 19:22We aren't trading in the 15 minutes. So,
  459. 19:25let's do this.
  460. 19:29Okay, it got a little bit better.
  461. 19:32But anyways, it's not a complete pass.
  462. 19:35So, I'm going to give it a seven. Next,
  463. 19:37develop a strategy that combines the
  464. 19:39Williams percentage or MACD and
  465. 19:42Ballinger bands. Okay, I'm going to copy
  466. 19:44this whole thing and go to Jess's
  467. 19:47dashboard and paste it here. All right.
  468. 19:50So it defined the Williams R with this
  469. 19:52syntax TA. R it's passing the current
  470. 19:55candles and the period is 14. Define the
  471. 19:58MACD with this syntax which seems fine.
  472. 20:01The Ballinger bands is TA. Ballinger
  473. 20:03bands passing the current candles. Again
  474. 20:05it set the mult2 and we already know
  475. 20:08this is going to fail. So let's remove
  476. 20:10it and save it. Define the current ATR
  477. 20:13as TATR
  478. 20:15and for shoot long. Now, by the way, one
  479. 20:18thing I like about this model, it writes
  480. 20:20the code in a very clean way. So, for
  481. 20:23instance, it's wrote some really easy to
  482. 20:25read comments here. And I really
  483. 20:26appreciate this. So, it's saying if the
  484. 20:28current volumes are value is below minus
  485. 20:3180 and the maxis value is above its
  486. 20:34signal and the current price is below
  487. 20:36the current lower band value of the
  488. 20:39current Ballinger band, then we want to
  489. 20:41open a long position and do the opposite
  490. 20:43for short positions.
  491. 20:46For the sub price, it says use the
  492. 20:48current entry price minus 1.5 times the
  493. 20:51current ATR and three times the current
  494. 20:53ATR for a take profit. And for the
  495. 20:57quantity, it is risking 2% of the
  496. 20:59capital. And then it is submitting all
  497. 21:01of them here. So this seems perfect. But
  498. 21:04by the way, when I want to write a
  499. 21:06ballinger band strategy, usually I don't
  500. 21:09say if the current price is above upper
  501. 21:12band and then here you simply use a
  502. 21:15market order. Instead, I would have
  503. 21:17removed this entry rule and if these two
  504. 21:21were correct and we did come here, I
  505. 21:24would have used the value of the upper
  506. 21:26band. By the way, this one is for shoot
  507. 21:28short. This is for long. So this would
  508. 21:30have been for the short position. So
  509. 21:32instead of using the upper band here, I
  510. 21:36would have used this value.
  511. 21:38Let's copy it here for my entry price.
  512. 21:43And then all the other calculations
  513. 21:44would have worked and we would have used
  514. 21:46a limit order to open the position which
  515. 21:49would have allowed us to pay less
  516. 21:51trading fees to the exchange. But
  517. 21:53anyways, let's bring it back. And then
  518. 21:55it's saying if the MACD signal is
  519. 21:59showing a reversal or if the current
  520. 22:02price is above the middle band then
  521. 22:03liquidate the position and do the
  522. 22:05opposite for short positions. So the
  523. 22:07rest of it seems fine. It is also
  524. 22:09submitting the takeprofit and a stop
  525. 22:11loss after a position is open. Now this
  526. 22:13would have been correct if it hadn't
  527. 22:16already submitted two of them here.
  528. 22:20So I think a better syntax is to just
  529. 22:22remove them from here.
  530. 22:25So, I'm going to subtract at least one
  531. 22:27point because of this, but I believe it
  532. 22:30should work.
  533. 22:34And it does. Okay. So, it's a pass now,
  534. 22:37but I'm going to subtract one point for
  535. 22:40this mistake and another for that extra
  536. 22:43multiparameter of the Ballinger bands
  537. 22:45that we already knew doesn't work from
  538. 22:47the previous question. So, it's going to
  539. 22:48be an eight. All right. Next, write the
  540. 22:50entry functions of the strategy for me
  541. 22:52in a way that it should use two limit
  542. 22:55orders for opening the position and it
  543. 22:57should only risk 2% of capital per
  544. 23:00trade. Now, notice that I'm asking for
  545. 23:02the functions and not the entire
  546. 23:04strategy. So, what I'm hoping to see,
  547. 23:06and in fact, I am seeing it, is that it
  548. 23:09shouldn't give me the entire strategy
  549. 23:11cuz this way it would be easier for me
  550. 23:13cuz the whole idea is that sometimes
  551. 23:15you're writing the strategy and you just
  552. 23:16want one piece of the strategy and
  553. 23:19you're not sure how to write it and you
  554. 23:20ask the AI to do it for you. The first
  555. 23:22entry price is going to be 1% below the
  556. 23:25current price. The second is going to be
  557. 23:272%. The stops is going to be 2% below
  558. 23:30the first entry. So, this seems perfect.
  559. 23:32And then it is indeed risking 2%.
  560. 23:36But here's the thing. It is passing only
  561. 23:39half the current available margin. So
  562. 23:42this is going to ruin the whole
  563. 23:43calculations. So this should have been
  564. 23:45the whole thing and then it should have
  565. 23:48passed this two here. So it's a fail and
  566. 23:52the syntax for submitting the buy order
  567. 23:55is correct. So it didn't do exactly what
  568. 23:58I needed to do. So I'm going to give it
  569. 24:00an eight. Now, last but not least, write
  570. 24:02a pair trading strategy for ETH and BTC.
  571. 24:05Now, with this one, what I'm hoping to
  572. 24:07get is two different strategy classes.
  573. 24:11So, one is going to be the leading
  574. 24:12strategy which will make the decisions
  575. 24:14for opening a persing strategy and the
  576. 24:17second class is going to be the follower
  577. 24:19strategy because in JC the strategies
  578. 24:21can communicate with each other, but
  579. 24:24each one of them is going to have its
  580. 24:26own separate symbols. So we need one
  581. 24:29class to make the decisions and all the
  582. 24:31other ones but usually just one more to
  583. 24:34follow that first route. Now if this
  584. 24:37seems too complex for you make sure to
  585. 24:39check out my older video called pair
  586. 24:42reading strategy from scratch in Python
  587. 24:44where I walk you through writing a pair
  588. 24:46writing strategy in Python with Jesse.
  589. 24:49All right. So let's take a look. It
  590. 24:50defined EBTC pairing strategy.
  591. 24:54Let's scroll down and then it define the
  592. 24:57BTC follower. So let's copy this first
  593. 25:00one here.
  594. 25:03Create a new strategy and call it test
  595. 25:09three
  596. 25:11pairs one or leader.
  597. 25:15Paste it. Now let's take a look at it
  598. 25:17first. So it defined the ETH candles
  599. 25:21with this syntax
  600. 25:23which is correct but this syntax for
  601. 25:26fishing the current exchanges name
  602. 25:28isn't. So let's remove this right now.
  603. 25:35Let's do the same here.
  604. 25:39Then it converted the prices into
  605. 25:40returns using prices to returns utility
  606. 25:43function of Jesse. And it also uses
  607. 25:45zscore utility function of Jesse. And
  608. 25:48inside the before function which is
  609. 25:50called before any other method of your
  610. 25:53strategy. First is saying if the current
  611. 25:55index is zero close every position. So
  612. 25:59basically using the shared v dictionary
  613. 26:03which can be accessed from within all
  614. 26:05the trading routes that you have.
  615. 26:08It is defining this which will be the
  616. 26:10state of the current position and then
  617. 26:12it's making these decisions for pair
  618. 26:14trading which again if you don't know
  619. 26:15what these are watch my previous video
  620. 26:17about it and then it is setting the
  621. 26:21current margin per each position again
  622. 26:23using this shared VS and then to make
  623. 26:27decisions for opening the position it's
  624. 26:29simply using this it's checking what's
  625. 26:32the current state of these and it also
  626. 26:35defined the position sizing again using
  627. 26:37this ETH margin here. Now let's copy
  628. 26:40this, create a new strategy and name it
  629. 26:44test coin
  630. 26:46tree
  631. 26:48pairs follower.
  632. 26:51Paste the whole thing. Remove this part.
  633. 26:56Go back
  634. 26:57and copy this. Now notice that since we
  635. 27:01didn't have the imports above here, they
  636. 27:03were up here. I made sure to bring that
  637. 27:06from the previous strategy. So let's
  638. 27:08paste the whole thing. And this one, as
  639. 27:10you can see, is simply the follower. So
  640. 27:12it is only using these values from the
  641. 27:16shared wires. So it's not making any
  642. 27:18logical decisions. So let's go and run
  643. 27:24test three pairs leader. and the second
  644. 27:28one. And by the way, the order of these
  645. 27:32strategies in your trading routes is
  646. 27:34very important. So let's
  647. 27:37pick follower this time. Now the time
  648. 27:40frame could be anything really. So let's
  649. 27:42go with 15 minutes. Let's check the code
  650. 27:45again. I want to see which one was
  651. 27:47first.
  652. 27:49So let's go down. So ETH is first and
  653. 27:53BTC is second. So this one should be ETH
  654. 27:56and this one should be BTC. And we're
  655. 28:00going to get an error now because the
  656. 28:02fast mode isn't supported when we are
  657. 28:06trading multiple routes. So let's also
  658. 28:09disable this and give it a go. And this
  659. 28:12time it's going.
  660. 28:15All right. So we're losing money which
  661. 28:17is expected because it executed too many
  662. 28:20trades and we're paying a lot of money
  663. 28:21in trading fees. That's a typical issue
  664. 28:24with pairing strategies. Now, there are
  665. 28:26many ways to fix this, of course, to
  666. 28:28either use a bigger time frame or trade
  667. 28:30something else such as meme coins. Now,
  668. 28:33this is a big topic on its own, but the
  669. 28:35fact that it was able to write something
  670. 28:37that works is a pass. So, I'm going to
  671. 28:40give it a 10. Now, we ended with a score
  672. 28:42of 80. Now, this is a pretty good score.
  673. 28:46It's not awesome, especially because it
  674. 28:48wasn't able to convert this and it was a
  675. 28:50fail. And in this one also, it didn't do
  676. 28:53a great job. But overall, this is a
  677. 28:56pretty good model. Like even though it
  678. 28:59wasn't able to get everything working,
  679. 29:01when it did work, the code that it wrote
  680. 29:03was beautiful. And I definitely didn't
  681. 29:06expect this from Alibaba because the
  682. 29:08previous coin models, they were overfit
  683. 29:10to the benchmarks and I wasn't actually
  684. 29:13able to use them in my daily work. But
  685. 29:15this one, according to our test, is
  686. 29:17significantly better. Now guys, if you
  687. 29:19like these videos, please make sure to
  688. 29:21give them a like and post a comment. Let
  689. 29:23me know what you think. And also
  690. 29:24subscribe to the channel if you want to
  691. 29:26receive more videos like this. Thank you
  692. 29:28so much for watching. I'll see you in
  693. 29:29the next one.
  694. 29:33[Applause]
  695. 29:35[Music]

About this transcript

This page contains the full transcript of Qwen3 Coder tested: Is it good for algo trading strategies? by Algo-trading with Saleh, generated from the public captions YouTube serves with the video. The transcript has 4,932 words across 695 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.