YouTube2Text

ChatGPT o1: Python Strategy Makes 432% — Transcript

by Algo-trading with Saleh · 2,016 words · 269 segments · language en · Watch on YouTube

Full transcript

  1. 0:00hey guys it's s today I want to do
  2. 0:01something a bit different so as you know
  3. 0:03open AI recently released their latest
  4. 0:05model called the 01 preview which is
  5. 0:08supposed to be PhD level smart so I was
  6. 0:10curious to know how helpful would it be
  7. 0:12for us to use it to write a strategy and
  8. 0:15turn it into Jess code so we can see the
  9. 0:17results so that's exactly what I did so
  10. 0:19let's get right into it oh before I
  11. 0:21forget we're going to have a giveaway as
  12. 0:22always so make sure to stick around
  13. 0:24until the end of the
  14. 0:26video if you go to the GPT store and
  15. 0:29look up the word jesse you can find the
  16. 0:32custom GPT that I released months ago
  17. 0:35which would help you write strategies
  18. 0:37and also turn your ideas into the syntax
  19. 0:40that Jesse accepts so we already had
  20. 0:43that but unfortunately at the moment we
  21. 0:45cannot use that with the o1 preview
  22. 0:47model and that's what I wanted to do so
  23. 0:49instead I opened a new chat and I simply
  24. 0:52said I need you to write me the suo code
  25. 0:55for an algorithmic trading strategy that
  26. 0:57is Trend following now I tried countless
  27. 1:00prompts and almost none of them were
  28. 1:01good enough for us to be able to use
  29. 1:03them until I came up with this one
  30. 1:06please include the following details
  31. 1:08entry signals exit signals technical
  32. 1:10indicators used use one Bas onine
  33. 1:13indicator and at least another one for
  34. 1:14confirmation as for Baseline I need you
  35. 1:16to Define one Trend property and a big
  36. 1:19one which would use a bigger time frame
  37. 1:21in these properties don't simply say if
  38. 1:23the price is bigger than the moving
  39. 1:25average if you are using moving averages
  40. 1:27make sure there are multiple of them and
  41. 1:29compare the values for them use at least
  42. 1:32one indicator to filter out ranging
  43. 1:34markets which happen to be like the
  44. 1:36biggest Factor open positions with the
  45. 1:38entire Capital because later I want
  46. 1:40myself to adjust my position sizing cuz
  47. 1:43it wasn't really helpful with that stop
  48. 1:45loss and takeprofit targets use an
  49. 1:47indicator to calculate them instead of a
  50. 1:49specific percentage number which is
  51. 1:50something I absolutely hate suggest time
  52. 1:53frame for trading the market that I will
  53. 1:55be trading is BTC UC and it gave me the
  54. 1:59sud as you can see here it sounds okay
  55. 2:03and you might be curious why did I ask
  56. 2:05for a studio code and not the python
  57. 2:07code well the reason is chat GPT is not
  58. 2:11really familiar with the Jus syntax it
  59. 2:13is a bit but not as much as I want it so
  60. 2:17the custom GPD that I had made before is
  61. 2:20much more helpful with that so I just
  62. 2:22just simply copied the studio code and
  63. 2:25went to our custom GPT and said convert
  64. 2:28and I just pasted the sud code and this
  65. 2:31is the result that it gave me so this is
  66. 2:34the python code for Jesse and this is
  67. 2:37the key points so it is explaining how
  68. 2:39it works which is really really helpful
  69. 2:41if you want to get familiar with it so
  70. 2:44let's copy first the name of the
  71. 2:46strategy go to Jesse to the strategy
  72. 2:49section create a new one paste it here
  73. 2:52and just so that we can find it easier
  74. 2:54I'm going to add the word AI to
  75. 2:57it all right so let's go back here copy
  76. 3:02the entire code and paste it here save
  77. 3:05it go to the back testing tab now which
  78. 3:09time frame should we trade well it said
  79. 3:12the 1 hour chart for exit and entry
  80. 3:14execution which would be our trading
  81. 3:16time frame and for big Trend analysis it
  82. 3:19would be the 4 hours okay so I'm going
  83. 3:22to change this to 1 hour and as for date
  84. 3:25I picked since the beginning of
  85. 3:272022 up until 20 24 until the 7th month
  86. 3:32and everything else seems fine so let's
  87. 3:35run it oh sorry I forgot to choose the
  88. 3:38correct strategy so it was Trend
  89. 3:40following AI so let's run it again and
  90. 3:44we're getting this error I want you to
  91. 3:46see this error because I've seen many
  92. 3:48beginners with Jesse facing this one and
  93. 3:51usually the reason is because the name
  94. 3:53of the strategy and the name of the
  95. 3:55class are not the same so if I go back
  96. 3:57here and let's quickly go to the editor
  97. 4:01for this strategy so the name of it was
  98. 4:04supposed to be Trend following AI but
  99. 4:06when I copied it I left out the word Ai
  100. 4:09and that's why we were getting that
  101. 4:10error so if I go back and run it again
  102. 4:12this time that error should go away now
  103. 4:15we're getting another okay the function
  104. 4:17object has no attribute shape so let's
  105. 4:19go to our editor and look up Trend
  106. 4:23following
  107. 4:26Ai and let's clean this up a bit and
  108. 4:30look for errors that we can fix so right
  109. 4:32here you can see that we're getting a
  110. 4:33warning from my editor which is py charm
  111. 4:36and it is pretty smart so it's
  112. 4:39saying actually it doesn't matter what
  113. 4:41it's saying let's just check it because
  114. 4:43it is using this just like a property
  115. 4:46but if I go here you can see it didn't
  116. 4:48Define the keyword property so it just
  117. 4:51defined a function so that's why we were
  118. 4:53getting
  119. 4:54that so now the error is gone so let's
  120. 4:59go back and run it again okay it looks
  121. 5:01like it is stuck on some kind of loop
  122. 5:04but why is
  123. 5:06that okay so you see here it defined the
  124. 5:10name of the exchange as binance which
  125. 5:13isn't true that's not the name we're
  126. 5:15using here it's binance perpetual
  127. 5:17Futures and to make sure you don't get
  128. 5:19it wrong let's define this dynamically
  129. 5:21so instead I will say self.
  130. 5:25exchange and the symbol is correct but
  131. 5:28it's still let's do the same here
  132. 5:31and the time frames are right but
  133. 5:33because this is my trading time frame
  134. 5:35I'm going to replace it with self. time
  135. 5:38frame all right let's try it again all
  136. 5:41right this time we're getting Mac the
  137. 5:42object has no attribute histo so let's
  138. 5:44go here and look for other warnings
  139. 5:48let's remove this cuz we're not using it
  140. 5:50and then we have here and that's because
  141. 5:53in Jesse the word is H not
  142. 5:56histo and there's also one case here
  143. 6:00and that's it all right let's run it
  144. 6:05again all right it got executed that's
  145. 6:09good and the results aren't great but if
  146. 6:13you see what while the price was going
  147. 6:15up our Equity gear also went up so I
  148. 6:18think it has still some potential it
  149. 6:21didn't do almost anything during the
  150. 6:23downtrend which is a bit
  151. 6:25weird
  152. 6:26and during the range Market
  153. 6:30it went a bit down but not too much okay
  154. 6:32so it's not that bad so let's go back to
  155. 6:35the
  156. 6:35strategy and here we can see that it did
  157. 6:39not Define the shoot short and go short
  158. 6:41functions and that's why it is not
  159. 6:43taking any short trades so if I go down
  160. 6:46here you can see that the Longs are 100%
  161. 6:48of the times and the shorts are 0% so
  162. 6:51let's define the shot short function and
  163. 6:57hopefully copilot will help us to write
  164. 6:59the opposite of our shootong conditions
  165. 7:02here and it did let's also Define the go
  166. 7:06short function again using co-pilot so
  167. 7:10let's go back and run it
  168. 7:13again all right so now instead of 300
  169. 7:16and something is taking 1,600 trades so
  170. 7:19it is taking short trades if I go down
  171. 7:22here you can also see it here so that's
  172. 7:24good but the results aren't great so now
  173. 7:28at this point I want to change the code
  174. 7:30a bit based on my own knowledge that I
  175. 7:33usually do to improve the results so
  176. 7:36firstly I don't want to use the 1H hour
  177. 7:39time frame I want to use the 4 hours
  178. 7:41because I found it to work significantly
  179. 7:43better with Trend following strategies
  180. 7:46so I'm going to remove this candles 1
  181. 7:49hour
  182. 7:50here and I'm going to select whichever
  183. 7:54place that was used and simply use self.
  184. 7:56candles which will give us the trading
  185. 7:59candles for our current session which
  186. 8:01would be whatever time frame you use now
  187. 8:05I'm going to change the 4 hours for our
  188. 8:07bigger time frame and use the 6 hours so
  189. 8:11I will also rename this from 4 hours to
  190. 8:156 hours all right now let's go back and
  191. 8:20change our trading time frame from 1
  192. 8:22hour to 4
  193. 8:24hours and run it again and the results
  194. 8:28is significantly better
  195. 8:30now we are finishing in profit with
  196. 8:3360% the max R isus
  197. 8:3728% the win rate is at 52% so these are
  198. 8:42actually decent results but let's take a
  199. 8:46look while we had a downtrend our Equity
  200. 8:49care went up which is exactly what we
  201. 8:51wanted however here you could argue that
  202. 8:54this is a ranging market and we didn't
  203. 8:57do great which is typical for a TR
  204. 8:59falling while the price was going up we
  205. 9:02also made some nice profits so the way I
  206. 9:05see it we need to avoid the ranging
  207. 9:07market and in fact if I go to the source
  208. 9:11code we can see that the strategy is
  209. 9:13already using the adx to avoid ranging
  210. 9:16conditions but the threshold is set at
  211. 9:1925 which I think is a bit low so I'm
  212. 9:22going to replace this with 40 and run it
  213. 9:27again and now
  214. 9:29we finished with 87% profit with a Max
  215. 9:33throw down of minus 10% which is
  216. 9:35brilliant because usually we're okay for
  217. 9:38our Maxon to go as high as 20 or even
  218. 9:4130% so that means I can easily go here
  219. 9:46and change my position sizing to use
  220. 9:50more Capital so here this is my quantity
  221. 9:54I can just simply multiply it let's say
  222. 9:56by three and also do the same for the go
  223. 10:01short and run it again all right so
  224. 10:04we're getting this error which is
  225. 10:05basically saying we run out of margin
  226. 10:08and that's because I haven't changed my
  227. 10:10leverage number so it is currently set
  228. 10:13at two so let's increase this to
  229. 10:18four now again yes it is set to four but
  230. 10:22I'm still using three I'm just using
  231. 10:24three times of my Capital but I set it
  232. 10:26to four just in case to uh you know my
  233. 10:30trading fees or anything like that won't
  234. 10:31cause us issues so let's run it
  235. 10:40again and now we are finishing with 4
  236. 10:4532% profit with a Max R of minus 31%
  237. 10:50which is acceptable to me now obviously
  238. 10:52there are much more optimizations that
  239. 10:54we can do to this strategy and in fact I
  240. 10:57am going to keep working on it and
  241. 10:59create a premium version of it and
  242. 11:01submit it to our strategy index page on
  243. 11:03our website and I will also submit this
  244. 11:05free version to our website that you can
  245. 11:07use now this was a new type of video
  246. 11:09that I just did I'm not sure if you guys
  247. 11:10liked it or not if you want me to try
  248. 11:12out other scenarios with AI or other
  249. 11:15ways we can use it to write new
  250. 11:16strategies let me know down in the
  251. 11:18comments so that I can make more videos
  252. 11:20like this one now before I leave you
  253. 11:22we're going to have a giveaway a random
  254. 11:24user who likes this video posts a
  255. 11:26comment and subscribes to the channel is
  256. 11:27going to receive 1 million bnk token all
  257. 11:30right let's pick the winner from my
  258. 11:31previous
  259. 11:33video and the winner
  260. 11:35is huge fan brother please don't stop
  261. 11:38what you're doing this is hands down the
  262. 11:41best framework on the market right now
  263. 11:43and you're absolutely killing it thank
  264. 11:45you so much for your super nice comment
  265. 11:47please reach out to me so that I can
  266. 11:49send you your bunk tokens thanks for
  267. 11:51watching and I'll see you in the next
  268. 11:54one w w
  269. 11:59oh

About this transcript

This page contains the full transcript of ChatGPT o1: Python Strategy Makes 432% by Algo-trading with Saleh, generated from the public captions YouTube serves with the video. The transcript has 2,016 words across 269 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.