YouTube2Text

CODING TRADING AUTOMATIONS | July 31 | Michele Rossi — Transcript

by FunderPro · 5,565 words · 930 segments · language en · Watch on YouTube

Full transcript

  1. 0:02Code code is wrong.
  2. 0:16[music]
  3. 0:56What is going on guys? Welcome back.
  4. 1:01Test test test 1212. Here we are again.
  5. 1:04Welcome back beautiful people. Before we
  6. 1:06begin, I want to thank Thunderro for
  7. 1:09making this educational series possible.
  8. 1:11Thunderpro is in my opinion one of the
  9. 1:14best prop firms for traders who want to
  10. 1:16use algorithm trading. If you want to
  11. 1:19check it out, you will find the link in
  12. 1:21the description or on screen. Uh you can
  13. 1:24also use the code live to receive the
  14. 1:26best discount currently available. Now a
  15. 1:30very quick recap. In the previous video,
  16. 1:33we started with an idea, the opening
  17. 1:36range breakout. We transformed that idea
  18. 1:40into precise trading rules. We gave the
  19. 1:44specification to codeex. We generated a
  20. 1:46pine script strategy. We installed it on
  21. 1:49trading view. We fixed couple of errors
  22. 1:53very quickly and we created the first
  23. 1:56working version of our orb bot. It is
  24. 2:01called Orbinder Pro. Right.
  25. 2:05Um, if you missed the lesson, you can
  26. 2:07find it up here or here or in the link
  27. 2:10down below on YouTube. So, today we are
  28. 2:14going to take the first working version
  29. 2:17and improve it. But we need to be
  30. 2:20careful. There is a major difference
  31. 2:23between optimization
  32. 2:25and curve fitting. Optimization means
  33. 2:30testing a small number of reasonable
  34. 2:34alternatives to understand how the
  35. 2:37strategy behaves.
  36. 2:39Curve fitting means repeatedly changing
  37. 2:44parameters until the historical equity
  38. 2:48curve looks perfect. Today I will show
  39. 2:51you the different tests I perform to
  40. 2:55reach this result.
  41. 2:57Then we will inspect the settings and
  42. 3:00the results you can see right here.
  43. 3:02Okay. And then we will inspect the
  44. 3:06settings to simulate more realistic
  45. 3:08market conditions. Export the trades and
  46. 3:11use codeex shad GPT cla I will use
  47. 3:15codeex. You can use whatever you wish to
  48. 3:17validate the strategy. So by the end of
  49. 3:20the lesson we will not simply have a
  50. 3:22profitable back test. we will have a
  51. 3:25much clearer idea of whether the
  52. 3:29strategy deserves to move to the next
  53. 3:32stage. Right? So once again, we're going
  54. 3:36to use AI. It's free. It's available for
  55. 3:40everyone. Is it the best tool that you
  56. 3:44can use? Of course not. There are
  57. 3:47professional tools to do this in a much
  58. 3:50better profound precise detailed way and
  59. 3:54it will gives us also more precise
  60. 3:57results. But
  61. 4:00I mean it's free. You can use it. It's
  62. 4:03going to give you an overall overview.
  63. 4:06It it is going to teach you a clear
  64. 4:08process. It will guide you through uh
  65. 4:12how to create a bot, back test,
  66. 4:14optimization, validation, and deploy.
  67. 4:17So, we're going to use this.
  68. 4:20Um I'm now showing you the results I
  69. 4:24obtained
  70. 4:25um on the E mining NASDAQ futures using
  71. 4:30a five minute chart. As you can see
  72. 4:32right here, the test period show here
  73. 4:36runs from April 19 to July 31st. So I
  74. 4:40tested the last three months. The better
  75. 4:43things to do is go even way back in time
  76. 4:46like testing at 365 days or even more.
  77. 4:51As you can see, the strategy is still
  78. 4:53profitable even though in the beginning
  79. 4:55give us gives us a a bit of a draw down
  80. 4:59and it stays in the red for quite a
  81. 5:01while. So this might suggest is
  82. 5:06a regime part which is giving us this
  83. 5:09beautiful uh curve in the last 90 days
  84. 5:13but we're going to use that as for
  85. 5:15educational purposes only. Okay. So the
  86. 5:18strategy produced a total of 17,152
  87. 5:23which is a 17%
  88. 5:2617% with a maximum draw down of 9.15
  89. 5:32it gives us a 61.66
  90. 5:36um win rate with a profit factor of 1.3.
  91. 5:42Right? So the equity curve finishes at a
  92. 5:47new high and the last section is
  93. 5:50particularly strong. Do I like the
  94. 5:53results? Yes, I like it as a starting
  95. 5:56point. It is profitable after adding
  96. 6:00execution costs. It has a reasonable
  97. 6:03number of trades for an initial
  98. 6:06investigation and the equity curve does
  99. 6:09not depend on one single trade. But I'm
  100. 6:12not saying the strategy is ready. A
  101. 6:14profit factor of 1.3 is positive, but it
  102. 6:17does not gives us an enormous safety
  103. 6:20margin. The maximum draw down is also
  104. 6:23important for a prop. We made
  105. 6:26approximately 17% with the um
  106. 6:32with the one point the strategy was down
  107. 6:35across approximately 9%. That gives us a
  108. 6:39return to draw down ratio of around two.
  109. 6:42That is interesting. But a 9% draw down
  110. 6:44can already be too large for many prop
  111. 6:46firm accounts, especially when the
  112. 6:48strategy is risking 1% of equity per
  113. 6:51trade. But hey, you can reduce it to 0.5
  114. 6:55just as an idea. So
  115. 6:58this uh scenario is not the conclusion.
  116. 7:02it is the candidate that we are going to
  117. 7:05investigate again for educational
  118. 7:08purposes. I I I would go and back test
  119. 7:11even more. I would try to find better
  120. 7:13settings etc etc but
  121. 7:16we have a restricted amount of time to
  122. 7:18be live with you guys today. So we're
  123. 7:20going to take this last three months I
  124. 7:22went through just before the call I
  125. 7:24found this last three month. It's okay.
  126. 7:26We can back test it. We can optimize it.
  127. 7:28So let's open the strategy inputs right
  128. 7:31here. And these are the settings that
  129. 7:35produced the results. So from here to
  130. 7:39here, let me let me get my pen.
  131. 7:47Where is it? Where is it? Where is it?
  132. 7:49Where is it? Where is it? Where is it?
  133. 7:51Screen brush.
  134. 7:53Screen brush. Show screen brush. So what
  135. 7:56you want to look is from here to here,
  136. 7:59right? Um
  137. 8:03the first trade risk-to-reward is set to
  138. 8:060.8. The reverse trade option is
  139. 8:10enabled. The risk-to-reward ratio for
  140. 8:12the reverse trade is set to 1.0. The
  141. 8:15strategy is allowed to trade in both
  142. 8:18direction, long and short. And the
  143. 8:21active days are Monday, Tuesday,
  144. 8:22Wednesday, and Friday. Thursday is
  145. 8:25disabled. So, the opening range candle
  146. 8:28begins at 10:30.
  147. 8:31Um,
  148. 8:33be careful with the time zone. The
  149. 8:35numbers shown in the input.
  150. 8:39Uh,
  151. 8:42I mean, we got to be careful. We got to
  152. 8:44be careful with this opening time and
  153. 8:48and opening range session. Okay. I I was
  154. 8:52forgotten. I set this on Asia time zone,
  155. 8:55right? So, always be careful to find the
  156. 8:58right time align with the time zone,
  157. 9:01right? Um
  158. 9:04because a strategy can produce of course
  159. 9:07a very different
  160. 9:10results if you change the time zone.
  161. 9:12It's 10:30 in Italy. It's 10:30 in Asia.
  162. 9:16It's 10:30 in Spain. Okay. Um
  163. 9:20so the chart is the last final visual
  164. 9:23check. Now let's understand how I
  165. 9:26arrived to at these values. I did not
  166. 9:29ask codeex to test thousands of random
  167. 9:32combinations. So I divided the problem
  168. 9:35into small experiments.
  169. 9:39The main variable I tested
  170. 9:42was
  171. 9:45let me give a little bit more of room
  172. 9:47right here. Okay. So, the main variables
  173. 9:51were the risk to reward.
  174. 9:58There it goes.
  175. 10:01Um,
  176. 10:03of the first breakout
  177. 10:05uh whether or not allow
  178. 10:09reverse trade. So, that means we have
  179. 10:13our range right here. We got a breakout.
  180. 10:16We take a long position buy. We got a
  181. 10:19reversal and a breakdown. And we take
  182. 10:22another position, a sell like you can
  183. 10:26see it happened right here. First
  184. 10:29breakout, sell, stop-loss, second
  185. 10:31breakout, take profit, right? Um, so
  186. 10:36what I tested, what else I tested? I
  187. 10:39tested uh of course the risk to reward
  188. 10:45into the reverse trade. Uh I tested long
  189. 10:50only
  190. 10:52short only and both directions
  191. 10:57and I tested the day of the week. So by
  192. 11:04picking which day to exclude like for
  193. 11:08example I saw that Thursday was the one
  194. 11:12day where the strategy was performing
  195. 11:14the worst. So in this period of time so
  196. 11:17I decided it for this um educational
  197. 11:21content to remove it. But we can do it.
  198. 11:24It needs to have a reason. Maybe the
  199. 11:26strategy performed not so good when we
  200. 11:29have major news releases such as we have
  201. 11:33job data on Thursday might be the case.
  202. 11:36I don't know. So I removed it but it is
  203. 11:38logical. So every time I changed one
  204. 11:41concept I uh recorded the results. So I
  205. 11:47screenshot it. I screenshotted the
  206. 11:49settings. I created a a folder on my
  207. 11:52desktop or you can simply sign up on a
  208. 11:55piece of paper. Um this is very
  209. 11:59important. If we change five inputs
  210. 12:01together, we may improve the results but
  211. 12:03we will not know which change was
  212. 12:06responsible for that. So um before we
  213. 12:11running the tests, I will ask codeex
  214. 12:15to create a simple optimization log.
  215. 12:20Okay,
  216. 12:23then I will use this prompt. Let me open
  217. 12:26up codeex.
  218. 12:28This is last week uh
  219. 12:32chat where we coded the strategy.
  220. 12:35I have the prompt already done. So, let
  221. 12:38me pick it up. I don't want to waste
  222. 12:40time.
  223. 12:46Okay, this is it. And I'm going to read
  224. 12:49it for you guys.
  225. 13:09There it goes.
  226. 13:11So the Cody the the the prompt is I'm
  227. 13:14developing an opening range breakout
  228. 13:16strategy in Trading View. I have
  229. 13:18attached a screenshot of the candidate
  230. 13:21strategy results, a screenshot of the
  231. 13:22strategy inputs, and the screenshot of
  232. 13:24the trading view strategy properties.
  233. 13:27Read the visible settings and create a
  234. 13:29optimization experiment log. Use the
  235. 13:32screenshot only to record the visible
  236. 13:34configuration. Do not calculate missing
  237. 13:36statistics from the image and do not
  238. 13:38invent values that are not visible. The
  239. 13:41candidate configuration currently uses
  240. 13:44trade to risk to reward 0.8. So right
  241. 13:46here I have all the settings that are
  242. 13:49being used right now and I want you to
  243. 13:51create a CSV which is a text file named
  244. 13:55orb optimization log CSV with this
  245. 13:58column test ID test purpose the range
  246. 14:01instrument time frame first trade risk
  247. 14:04reward reverse trade enable blah blah
  248. 14:06blah all the things that we want to test
  249. 14:09and the visible candidate results as the
  250. 14:11first row mark any unavailable values as
  251. 14:15not provided. Do not recommend a final
  252. 14:19uh configuration
  253. 14:22yet. So this is the this is not useful,
  254. 14:27right? So what are we going to do? We're
  255. 14:29going to screenshot this
  256. 14:37and put it into codeex.
  257. 14:41We're going to scroll down.
  258. 14:44Screenshot this,
  259. 14:52put it into codeex.
  260. 14:56We're going to go to the
  261. 14:59returns,
  262. 15:01screenshot this,
  263. 15:06put it into codeex.
  264. 15:09And we can also give
  265. 15:13the list of the trades. We can download
  266. 15:16it. A CSV file going to be downloaded
  267. 15:19and we can put it into our
  268. 15:27right here. Codeex. We can screenshot
  269. 15:31the settings.
  270. 15:40put it into codeex
  271. 15:43and we're going to screenshot also the
  272. 15:45properties. This is a very important
  273. 15:48part because right here we're going to
  274. 15:50talk about it a little bit later. I gave
  275. 15:54um trading view stats and let it run. I
  276. 15:59gave trading view strats um initial
  277. 16:03capital default order sides bar
  278. 16:06detailization
  279. 16:07high 40 ticks per bar. As I said this is
  280. 16:10not full depth data.
  281. 16:13Okay. So this is a
  282. 16:18something that we can use as a reference
  283. 16:20as a starting point. These are not real
  284. 16:24full indepth tick data millisecond per
  285. 16:28millisecond. Okay, we're going to add a
  286. 16:30little bit of commission. We're going to
  287. 16:32add a little bit of slipage couple of
  288. 16:34ticks. We're going to add if we're using
  289. 16:36limit orders an extra layer of one tick
  290. 16:40beyond of sleeps and order execution
  291. 16:42delay. If we're using uh market orders
  292. 16:45is going to be delayed by one tick. So
  293. 16:47we're trying to simulate the the the at
  294. 16:50the best possible uh not best possible
  295. 16:54but worst possible conditions how the
  296. 16:57strategy would really execute on live
  297. 17:00market conditions. Right?
  298. 17:04Stop.
  299. 17:13So I'm using the spreadsheet skill
  300. 17:15because the requested deletable is the
  301. 17:17instructor CBS. I record only values
  302. 17:20explicitly visible blah blah blah. The
  303. 17:21spreadsheet instruction should point to
  304. 17:23local reference file skill fer and
  305. 17:25correcting the path. So codex is doing
  306. 17:28its own thing.
  307. 17:30Um what is going to give us is going to
  308. 17:33give us a good path to
  309. 17:38um
  310. 17:41to do what to open the settings and it
  311. 17:45gives us suggestion on how to
  312. 17:50change these parameters in a intelligent
  313. 17:53way. So to have multiple
  314. 17:57um results
  315. 17:59then we're going to give it to Codex
  316. 18:02again and he's going to tell us look
  317. 18:05this is what I believe on a mathematical
  318. 18:10and statistical
  319. 18:12um reference
  320. 18:15the best possible results that I
  321. 18:19believe. Okay. So, it's going to compare
  322. 18:21the net profit, the draw down, the
  323. 18:23profit factor, the win rate, the average
  324. 18:27um trade, and the trade count. Okay. Um
  325. 18:33I don't know how long it's going to
  326. 18:34take. Okay, good. Let's open it.
  327. 18:39Let's take a look.
  328. 18:43Okay, gives us is in a very bad
  329. 18:47situation to read. Let's try this way
  330. 18:54now. Way better.
  331. 18:57Okay. It's a It's a very long It's a
  332. 18:59very long thing. It's I I believe it's
  333. 19:01not created properly.
  334. 19:05Uh
  335. 19:10again, I I'm going to say to do it again
  336. 19:13and be sure to have the full list. Okay.
  337. 19:19It happens. So, but what is what it's
  338. 19:22going to give us is a list of
  339. 19:26do this this and that. Try these
  340. 19:29parameters. So, what you're going to do,
  341. 19:30you're going to change those parameters
  342. 19:33and you're going to write down and
  343. 19:36collect all the data, all the
  344. 19:38screenshot, all the results as I said I
  345. 19:40did before. Okay. So with these results
  346. 19:44you are going to compare all all the the
  347. 19:49results the draw down the profit factor
  348. 19:51etc. But let's say you have a set of 10
  349. 19:54different one two three four five six
  350. 20:00etc etc. You have a set of 10 different
  351. 20:04um [clears throat]
  352. 20:05outcomes.
  353. 20:07Do not automatically select the value
  354. 20:09with the highest net profit.
  355. 20:12Try to identify whether there is a
  356. 20:15stable region across
  357. 20:18neighboring values. Okay. Which values
  358. 20:22produce excessive draw down? Whether the
  359. 20:27apparent improvement
  360. 20:30comes mainly from a higher win rate or a
  361. 20:34larger average winners. It is very
  362. 20:39simple to spot because you have the full
  363. 20:41list of trades. But with this particular
  364. 20:43strategy is not going to happen because
  365. 20:46again it's a very fixed riskreward,
  366. 20:49right? Um
  367. 20:52whether any results appear isolated and
  368. 20:57potentially overfeeded.
  369. 21:00Okay. Um, so you're going to
  370. 21:07get these
  371. 21:10values that Codex is going to give you
  372. 21:14and give it back to him and say, "Look,
  373. 21:17I picked this one and this one and this
  374. 21:21one for this particular reason."
  375. 21:25Okay. What do you believe is the one
  376. 21:28that is the best for my strategy?
  377. 21:32Okay. Um let's say my candidate
  378. 21:35configuration the first trade target is
  379. 21:370.8R.
  380. 21:39That means that if the initial stop
  381. 21:41distance represents one unit of risk,
  382. 21:44the target is 0.8 times that distance.
  383. 21:46That target is smaller than the stop.
  384. 21:49But that is not automatically
  385. 21:52uh means that is a problem. So the
  386. 21:55complete results depend on the win rate,
  387. 21:58the reverse trade, the transaction costs
  388. 22:01and the combined expectancy of both
  389. 22:05entry type. Right? So um when we review
  390. 22:12all of these,
  391. 22:14the next test you want to do is um the
  392. 22:21the candidate settings. So let's let's
  393. 22:24let's
  394. 22:27pick these settings. So I just explained
  395. 22:30you
  396. 22:32how I get to these results, right? So I
  397. 22:34got to these results. I use a codeex in
  398. 22:36the way I showed you. Now we have these
  399. 22:38results.
  400. 22:42Given these results,
  401. 22:45right?
  402. 22:48I save this condition.
  403. 22:52Right? So, we're going to go to
  404. 22:57the cost stress test.
  405. 23:01So, I do not want to use only one
  406. 23:05execution assumption.
  407. 23:08So, I will repeat the test under
  408. 23:11different cost scenarios,
  409. 23:14right? And we're going to have let's say
  410. 23:17four four scenarios. One which is a
  411. 23:24um
  412. 23:26[music]
  413. 23:29optimistic
  414. 23:32right.
  415. 23:34Scenario B
  416. 23:37baseline
  417. 23:40right? Scenario C is going to be a
  418. 23:45conservative
  419. 23:49and scenario scenario four which is
  420. 23:51scenario B
  421. 23:55is a stress condition right let's say
  422. 23:58for scenario H A we have commission 0.5
  423. 24:02per contract slipage one tick for the
  424. 24:05baseline still 025 per contract two
  425. 24:08ticks of delay one tick For the delay,
  426. 24:12one tick limit verification. For the
  427. 24:14conservative, we're going to even raise
  428. 24:17the commission. We can do it three
  429. 24:19ticks. One tick, one tick. And for the
  430. 24:23stress, we're going to give $1 per
  431. 24:25contract, which is unreasonable, but
  432. 24:27we're going to do it again anyway. Four
  433. 24:30ticks of sleepage and more conservative
  434. 24:32field assumptions. Okay. And the purpose
  435. 24:36of this test is not to predict the exact
  436. 24:39cost of every future order. The purpose
  437. 24:43is to determine whether a small
  438. 24:46execution difference destroys the
  439. 24:49strategy.
  440. 24:51If the strategy
  441. 24:53is profitable only with perfect fields,
  442. 24:58again it is what you find into the
  443. 25:01properties.
  444. 25:03um it is not ready for live deployment.
  445. 25:06Right? So, we're going to export all the
  446. 25:11evidence and we're going to start to um
  447. 25:18to give um to sorry to start with um
  448. 25:23with this list of candidates, right? The
  449. 25:27list of candidates. This is our
  450. 25:29baseline, right? We have all of these
  451. 25:32trades. We downloaded all of these and
  452. 25:37what we're going to do is doing an in
  453. 25:40sample and out of sample validation. Let
  454. 25:43me write it down.
  455. 25:46So the next step
  456. 25:48is in sample
  457. 25:52and out of sample validation.
  458. 26:01Okay. Right. Um
  459. 26:06so we must now separate optimization
  460. 26:09data from validation data. The period
  461. 26:14used to select the 0.8R
  462. 26:17enable the reverse trade and remove
  463. 26:19Thursday's development data. This is it.
  464. 26:22We cannot use the same period as
  465. 26:25independent proof that those settings
  466. 26:27work. For a proper chronological test, I
  467. 26:30will define an earlier period of for
  468. 26:34optimization and the later untouched
  469. 26:37period for validation. So the later
  470. 26:39period must retain remain untouched
  471. 26:43until the candidate settings are fixed.
  472. 26:46So I'm I'm not going to reoptimize the
  473. 26:49strategy after seeing the validation
  474. 26:52results. So here's the prompt.
  475. 26:56Let me copy and paste because I prepared
  476. 26:58it in advance of course or it's going to
  477. 27:00take a long time.
  478. 27:24And we're going to give it the codeex.
  479. 27:36[music]
  480. 27:43Right. So I copied and paste. Oh, sorry.
  481. 27:46You're you're not seeing it. I copied
  482. 27:47and pasted it everything right here. So
  483. 27:51it is uh we must now separate
  484. 27:53optimization data from validation data.
  485. 27:57The period used to select 0.8 are enable
  486. 28:00the reverse shade and remove Thursday's
  487. 28:02development data. We cannot use the same
  488. 28:05period as independent proof that those
  489. 28:08settings work for a proper chronological
  490. 28:10test that will define an early period of
  491. 28:13optimization and the later untouched
  492. 28:16period for validation. Right. uh audit
  493. 28:19the file and confirm chronological
  494. 28:22separation, matching strategy
  495. 28:24configuration, matching instrument and
  496. 28:26time frame, matching execution customs
  497. 28:29and and assumptions. Compare the two
  498. 28:32periods using number of trades,
  499. 28:34expectancy, profit factor, win rate,
  500. 28:36average win, average loss, maximum draw
  501. 28:39down, longest losing streak, long versus
  502. 28:42short result, first versus reverse trade
  503. 28:46results, and return to drawdown ratio.
  504. 28:48Because the sample have different
  505. 28:52lengths, focus on per trade and
  506. 28:55percentage matrix rather than total
  507. 28:59profit alone. Identify which behaviors
  508. 29:02remain stable and which deteriorated
  509. 29:05materially uh is not working. Do not
  510. 29:08optimize the out of sample period and
  511. 29:12save the results as orb out of sample
  512. 29:15validation.
  513. 29:19Okay, we can have two scenarios. We can
  514. 29:22have a weaker out of sample results or a
  515. 29:27good out of sample results. A weaker out
  516. 29:30of sample results does not automatically
  517. 29:33mean failure.
  518. 29:35Some deterioration is normal. But if the
  519. 29:39strategy moves from positive expectancy
  520. 29:42to a clear and persistence persistent
  521. 29:45negative expectancy, the optimization
  522. 29:49probably captured noise. Right?
  523. 29:53Let's let it run. What we're going to do
  524. 29:56next? Next, we're going to do a walk
  525. 30:00forward test. So, a single in sample and
  526. 30:04out of sample split can still be uh
  527. 30:07influenced by the selected dates, right?
  528. 30:11So, we can perform a workforward test.
  529. 30:16For example, we can optimize on six
  530. 30:19month, we can test on the following two
  531. 30:21months. Uh we can move the window
  532. 30:24forward and repeat. Right? Let me say
  533. 30:28that again. This is very important. Let
  534. 30:30let me write it down. Um,
  535. 30:34optimize
  536. 30:37on six months,
  537. 30:40right?
  538. 30:42Sorry, months.
  539. 30:46One. Uh, we're going to test on the
  540. 30:48following month.
  541. 30:51[music]
  542. 30:54Let's say the following
  543. 30:58two months.
  544. 31:02We're going to move the window
  545. 31:07[music]
  546. 31:08forward
  547. 31:09and we're going to repeat,
  548. 31:13right?
  549. 31:15The strategy must always be developed
  550. 31:19using past data and tested using later
  551. 31:23data and codeex chat GPT uh Gemini
  552. 31:28whatever uh clo can help organize
  553. 31:33results but trading view must generate
  554. 31:36the trades for each window.
  555. 31:39Okay, is that clear? you have any
  556. 31:41question
  557. 31:49right? Yes. Yes. That that is a good
  558. 31:52question. Um
  559. 31:56these are
  560. 31:59the the candidate settings. So our
  561. 32:02candidate uses 0.8R for the first trade
  562. 32:05and one R for the reverse trade.
  563. 32:09I tested and you have to do so. So I'm
  564. 32:11telling you to test neighboring values
  565. 32:15for example first trade 0.6 0.81 and 1.2
  566. 32:19reverse trade 0.81 and 1.2 I've already
  567. 32:23done that and already gave that to
  568. 32:26codeex otherwise he cannot produce what
  569. 32:29he's doing right now but it it take
  570. 32:32quite a bit of time and we cannot stay
  571. 32:34here all day long. So I prepared some
  572. 32:36stuff before and
  573. 32:39in this way we're going to have
  574. 32:43and use
  575. 32:46a small parameter matrix let's say. So
  576. 32:50we're not searching for a perfect
  577. 32:52combination. We are checking whether the
  578. 32:54candidate sits inside a stable region.
  579. 32:59Right?
  580. 33:01Okay,
  581. 33:05let's see what point we're at.
  582. 33:08Beautiful.
  583. 33:10Okay, let's see.
  584. 33:14Validation design. The experiment.
  585. 33:22The experiment user chronological load
  586. 33:24out in sample and out of sample
  587. 33:27configuration audit for this educational
  588. 33:29example. board export assumed to contain
  589. 33:31the following identical configuration 5
  590. 33:33minutes 5 minutes 1030 1030 100% of
  591. 33:37equities so it gives us a lot of data
  592. 33:42136 in sample 68 out of sample
  593. 33:46uh winning trades 8240 5428 60% win rate
  594. 33:5158%
  595. 33:53average win 1 average win 925
  596. 33:58and we got of
  597. 33:59different very different results even if
  598. 34:04still positive 33% and 5.64%
  599. 34:08that's a huge difference but at the same
  600. 34:11time maximum draw down nine maximum draw
  601. 34:13down 6.4 four, longest losing streak,
  602. 34:17five trades. Longest
  603. 34:20losing streak, four trades. And we have
  604. 34:23all the results that we talked about,
  605. 34:26right? So, we have our in sample and out
  606. 34:30of sample validation.
  607. 34:33Um,
  608. 34:36the next the next thing that we have to
  609. 34:40do is with this file right here. Yeah.
  610. 34:44still with the same file. Uh we're going
  611. 34:47to give it to Codex and ask him to run a
  612. 34:54Monte Carlo test. Right.
  613. 35:00Let's give it a Monte Carlo test.
  614. 35:07So perform random reshuffleling of the
  615. 35:12existing trades without replacement.
  616. 35:15Bootstrap resampling with replacement
  617. 35:18block bootstrap resampling of
  618. 35:21consecutive trades using several
  619. 35:23reasonable block sizes to preserve some
  620. 35:27short-term dependence. Use the fixed
  621. 35:30random C2 to so the analysis is repro
  622. 35:34reproducible
  623. 35:36for each method. Calculate the
  624. 35:38distribution of final profit, maximum
  625. 35:40draw down, longest losing streak,
  626. 35:42minimum equity, and return to draw down
  627. 35:45ratio. report medium 75th percentile
  628. 35:5090th percentile 95%
  629. 35:54percent percentage sorry for my English
  630. 35:56and 90 99%
  631. 35:58draw down also report
  632. 36:01probability of finishing below zero
  633. 36:05probability of exceeding the historical
  634. 36:089% draw down probability of exceeding a
  635. 36:1110% draw down because
  636. 36:14we're we're already forward thinking
  637. 36:17about where we're going to use this
  638. 36:20inside of a prop account and 90 and
  639. 36:2595th percentile losing tree clearly
  640. 36:29explain that this analysis does not
  641. 36:32model future market regime change. So
  642. 36:34this is a protection that [laughter]
  643. 36:37codex is giving but it's it's totally
  644. 36:39fine. So we took the file we take the
  645. 36:41file once again. This is it. We're going
  646. 36:44to give it and we're going to ask one
  647. 36:48extra question which is
  648. 36:52give me an
  649. 36:56HTML file with a visual representation
  650. 37:03of the Monte Carlo test. Okay, let's go.
  651. 37:09So
  652. 37:11um
  653. 37:16what do we know? What do we know? Is it
  654. 37:18working? Right? Is it working? Uh we
  655. 37:21know that the historical draw down is
  656. 37:279%. Right? But after Monte Carlo
  657. 37:30simulation, we may discover a 12 or 15
  658. 37:33or larger draw down. It's plausible.
  659. 37:37This is particularly important because
  660. 37:39the strategy currently uses a 1% chance
  661. 37:431% of equity per trade. So for many prop
  662. 37:47firm accounts that might be too
  663. 37:49aggressive. If we reduce the risk from
  664. 37:511% to 0.5 the approximate percentage
  665. 37:55impact of every trade and draw down will
  666. 37:58also be reduced. So we we we should
  667. 38:01choose the risk based on unfavorable but
  668. 38:05plausible scenarios not the historical
  669. 38:08results. Is that clear? Do you guys have
  670. 38:12questions about this?
  671. 38:14This is very important.
  672. 38:19Right. So let's see what it gives us.
  673. 38:24It's going to take a little bit of time.
  674. 38:26So if you have question this is a good
  675. 38:28moment to ask
  676. 39:19>> [snorts]
  677. 39:34>> So, let's do this while we wait. It's
  678. 39:36going to take quite a bit of a time. Um,
  679. 39:40let's
  680. 39:41let's recap what we just did, right?
  681. 39:48Um,
  682. 39:59today we begin with the first working
  683. 40:01version of our opening range breakout
  684. 40:05strategy that we coded
  685. 40:08last week.
  686. 40:10This is the code, right?
  687. 40:18And we tested the first trade target
  688. 40:24reverse trade logic direction and day
  689. 40:26filters. We reached a candidate
  690. 40:29configuration with a 0.8 R
  691. 40:35uh first target 0.1
  692. 40:38second target reverse both directions
  693. 40:41enabled and Thursday disabled. And on
  694. 40:44the period show we got a 17% of total
  695. 40:48profit and loss. Max draw down on 9.15%.
  696. 40:53Win rate 61% profit factor 1.3.
  697. 40:58So we like it. We like this as a
  698. 41:01starting point. But we did not stop
  699. 41:04right here. That would be a a a crazy
  700. 41:07error. We added commissions. We added
  701. 41:13sleepage, order delay, limit
  702. 41:15verification and intraar detail.
  703. 41:20We exported
  704. 41:22the trades from here
  705. 41:25right
  706. 41:27into codeex together with the
  707. 41:28screenshot. Then we designed an out of
  708. 41:31sample test, work forward analysis, a
  709. 41:34parameter stability, cost stress test,
  710. 41:37multicar simulation. And the last thing
  711. 41:41that we're going to do probably
  712. 41:45probably next week. Yes, I believe we're
  713. 41:48going to do it next week. We're going to
  714. 41:51do a prop firm risk analysis. Right?
  715. 41:55That is going to be very very important
  716. 41:57and very very useful.
  717. 41:59And this is the difference between
  718. 42:03optimizing
  719. 42:04a strategy and believing an
  720. 42:07optimization.
  721. 42:09So the back test gives us a candidate.
  722. 42:13Validation decides
  723. 42:16whether the candidate deserves another
  724. 42:18step.
  725. 42:20Right? So in the next final episode,
  726. 42:24we're going to talk about prop firm risk
  727. 42:27analysis. that deal with the same
  728. 42:29results, same multicar results that
  729. 42:32Codex is producing right now. And we're
  730. 42:35going to go in depth on that. So we're
  731. 42:37going to note
  732. 42:39how much
  733. 42:41the the probability in percentage that
  734. 42:45we have to pass a two-phase challenge.
  735. 42:49So we're going to have let's say you
  736. 42:50have 63% of passing a the first stage of
  737. 42:55the classic challenge of Funpro. you
  738. 42:57have 73%
  739. 43:00of chance to pass the second phase and
  740. 43:04you have let's say I don't know um
  741. 43:0872%
  742. 43:11just random number just to give you an
  743. 43:13idea of
  744. 43:17probability to get your first $8,000
  745. 43:20payout
  746. 43:23right
  747. 43:24Um,
  748. 43:28and we we will also
  749. 43:32do the same. We're going to run the
  750. 43:34strategy in forward testing. We're going
  751. 43:37to create trading view alerts.
  752. 43:41We're going to build a structured web
  753. 43:45hook alert,
  754. 43:47which is this thing right here, right?
  755. 43:52Um,
  756. 43:54and we're going to connect the signal to
  757. 43:58the execution platform can be any third
  758. 44:01party platform. I'm not going to name
  759. 44:04any, but I'm going to tell you how it
  760. 44:06works, right?
  761. 44:09And um yes,
  762. 44:13of course, we're going to do couple of
  763. 44:15other things to add security like
  764. 44:20prevent duplicates or delayed orders. Uh
  765. 44:23add the daily loss protection or create
  766. 44:27a red button, an emergency stop button,
  767. 44:32right? and
  768. 44:35and we can prepare the bot for control
  769. 44:38use on a fun pro account. And what I'm
  770. 44:42going to do, I'm going to actually run
  771. 44:44this strategy on a fun pro two-phase
  772. 44:48classic challenge. Right?
  773. 44:52So this is where the project becomes a
  774. 44:55complete trading system rather than only
  775. 44:57a back test. I know today uh lesson it's
  776. 45:02quite complex. It's not very easy for me
  777. 45:06to explain. I hope I did my best to
  778. 45:09explain you guys all the steps, but you
  779. 45:11can go back in time and rewatch if you
  780. 45:13miss some part.
  781. 45:15It's not going to take more for you to
  782. 45:18do it more than a manual back test. I
  783. 45:22see people continuously going back and
  784. 45:26forth and back testing manual strategy.
  785. 45:29That's to me totally stupid. It's good
  786. 45:34at the beginning of your career to
  787. 45:38put your hands in the mud and understand
  788. 45:41stuff, watch things, create ideas, learn
  789. 45:45how to manually execute.
  790. 45:48>> [snorts]
  791. 45:48>> But when you got a little bit of
  792. 45:51experience,
  793. 45:53there's no point of
  794. 45:56one, trade manually and two,
  795. 46:01not to code a strategy, back test it
  796. 46:04automatically and deploy it. Right? So
  797. 46:09we have our results. Let's go take a
  798. 46:11look. There it goes.
  799. 46:14complete the completed the reproducible
  800. 46:17multiarl analysis uses 68 unique close
  801. 46:20trade. Again, this is a very small
  802. 46:24amount of trades. We want to go with a
  803. 46:26one year,
  804. 46:28500 trades, 600 trades, 700, 1,000
  805. 46:31trades. That is going to be best, right?
  806. 46:35Uh reshuffle
  807. 46:38bootstrap. We got the block three, we
  808. 46:41got the block five, and we got the block
  809. 46:4310. Look how beautiful this thing is and
  810. 46:46it's very very easy to use and
  811. 46:48understand.
  812. 46:50Okay. And you have all the matrix
  813. 46:52maximum draw down by by percentile.
  814. 46:56Uh with the reshuffle only we have z%
  815. 47:00probability to finish below zero. We
  816. 47:03have 50% finishing above 10%. And the
  817. 47:0890th 95th
  818. 47:11it's very difficult for me to pronounce
  819. 47:14percentile draw down is 16.3%.
  820. 47:19The selected method profile we got all
  821. 47:24all the summarizing right here.
  822. 47:29So
  823. 47:31what you can tell at the moment about
  824. 47:36this strategy
  825. 47:41is it going to be this is not a good
  826. 47:44prompt but to show you guys what we're
  827. 47:46going to do next week to be
  828. 47:49useful and potentially
  829. 47:53profitable
  830. 47:55on a Thunder Pro two steps classic
  831. 48:00challenge
  832. 48:02account.
  833. 48:03Am I going to
  834. 48:06um how
  835. 48:08many statistical
  836. 48:13probabilities
  837. 48:18[music]
  838. 48:23I would have
  839. 48:26to pass
  840. 48:29phase one and to pass phase two and to
  841. 48:35get a $1,000
  842. 48:39payout
  843. 48:41if and once funded.
  844. 48:45So, next week we're going to have a
  845. 48:47quick look, but next week I'm going to
  846. 48:49show you guys how to design
  847. 48:54stealing codeex or CL or whatever
  848. 48:59and give it a proper prompt
  849. 49:04to
  850. 49:06um
  851. 49:08understand
  852. 49:10if the strategy is going to be good and
  853. 49:15or profitable inside of a strat inside
  854. 49:18of a prop firm account. So, we're going
  855. 49:21to run a prop firm risk validation,
  856. 49:26right? We're going to give a proper
  857. 49:30um prompt. This is not a good prompt.
  858. 49:33This is a a super basic baseline, right?
  859. 49:37I'm going to show you how so you can
  860. 49:40copy paste the prompt that you can use.
  861. 49:44Right. Okay. Let's see what it what it
  862. 49:47says and we're going to finish this
  863. 49:50lesson. If you don't have any question,
  864. 49:52let me see in the chat if you have any
  865. 49:54question. Hi
  866. 50:01Roberto. Do you ever trade too or is he
  867. 50:04just talking? Roberto
  868. 50:08GF YS.
  869. 50:11Google it.
  870. 50:15I traded for more than one year. Allies
  871. 50:18recorded live. We took profits. We took
  872. 50:22losses. We took payouts. So this is an
  873. 50:25educational content. If you don't like
  874. 50:28it, GF YS,
  875. 50:33Google it.
  876. 51:02There he goes. Short answer. The
  877. 51:04strategy shows a potentially real edge,
  878. 51:06but I would not run it unchanged on a
  879. 51:08paid founder pro challenge. It is
  880. 51:10currently sightsee
  881. 51:13beneath fun prodown limits and the back
  882. 51:15test instrument blah blah blah blah
  883. 51:17blah. What the strategy currently
  884. 51:18demonstrates blah blah blah blah blah
  885. 51:20blah blah blah. Okay. So, what it's
  886. 51:22saying is
  887. 51:25we have pass phase one, we have a 79 to
  888. 51:3181% of chance to pass.
  889. 51:36Phase two, we have 85% and
  890. 51:40to get funded, we have a 93%
  891. 51:43of getting a payout. It says it's not
  892. 51:47perfect. We have to make it better. But
  893. 51:51this is a good starting point, right?
  894. 51:54So, thank you guys for being here with
  895. 51:56me today. Thanks again, Founder Pro for
  896. 51:58making this possible. I believe this is
  897. 52:00one of the best ever educational content
  898. 52:06that you can find on a prop firm because
  899. 52:10I'm telling you guys how to actually
  900. 52:15fool the prop firm. So, Fun Pro is going
  901. 52:19to hate me for that.
  902. 52:21Maybe they're going to delete this
  903. 52:25this series because if you follow this,
  904. 52:29hey, I'm not I'm not telling you to do
  905. 52:32it, but if you do this, you have a high
  906. 52:36chance to
  907. 52:38prepare, do nothing, watch the account
  908. 52:41growth, pass, and get your payout.
  909. 52:48That's it.
  910. 52:50Yeah, but Roberto, you have a SG and
  911. 52:54you're never going to be profitable.
  912. 52:57So, enjoy it.
  913. 53:00Um,
  914. 53:02so guys, thank you so much for being
  915. 53:03here with me today. Thanks for the hate
  916. 53:06from Roberto.
  917. 53:07Um, I wish he have a great career in his
  918. 53:11life. And thank you so much to my life
  919. 53:16for all the good questions. If you have
  920. 53:19any further question, ask it down below
  921. 53:22in the comment section. I'm going to
  922. 53:24reply every question. Thank you so much
  923. 53:26and I'll see you again on Monday on
  924. 53:29Wednesday for live trading and weekly
  925. 53:32preparation, midweek preparation. And
  926. 53:34next week on Friday, same time, we're
  927. 53:36going to finish the setup, have the
  928. 53:39final bot, and deploy it live and see
  929. 53:41how uh it's going to work. Thank you.
  930. 53:44Cheers, guys. Bye bye. Bye bye.

About this transcript

This page contains the full transcript of CODING TRADING AUTOMATIONS | July 31 | Michele Rossi by FunderPro, generated from the public captions YouTube serves with the video. The transcript has 5,565 words across 930 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.