YouTube2Text

Monte Carlo simulation saved me from taking a huge loss — Transcript

by Algo-trading with Saleh · 1,632 words · 218 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Hey guys, it's so in this short video I
  2. 0:02want to show you a case where running
  3. 0:04Monte Carlo simulations helped me avoid
  4. 0:07a huge loss. And the thing is I did not
  5. 0:09expect that at all because normally when
  6. 0:11I use Monteol simulations I do it to see
  7. 0:14for example whether or not my strategy
  8. 0:16is overfit or considering my risk
  9. 0:18tolerance it helps me know how much
  10. 0:20position sizing I want to do. But the
  11. 0:22case that I'm talking about now has
  12. 0:24nothing to do with those. So let me show
  13. 0:26you what I mean. Now this is the
  14. 0:27strategy that I'm talking about. You see
  15. 0:29this equity curve? It looks awesome,
  16. 0:31right? It basically just keeps going up
  17. 0:33and up. Now it is for the Trump memecoin
  18. 0:35and the duration is almost 6 months and
  19. 0:39everything looks great. Now the penal is
  20. 0:4130% but with a max draw of minus 8%. Now
  21. 0:44considering my risk tolerance is usually
  22. 0:46minus 30%, that means I could have
  23. 0:48easily multiplied this by a number such
  24. 0:51as like three and then my P&L would have
  25. 0:54been near 100, right? So that would have
  26. 0:56been fantastic. But here's the thing,
  27. 0:59the win rate is 100%. Right? So it means
  28. 1:02basically it's never losing. And yes, it
  29. 1:05is a short only strategy. And the
  30. 1:07average holding time is 24 hours, which
  31. 1:09is a bit too high considering the time
  32. 1:12frame of the strategy was only 15
  33. 1:14minutes. And the sharp ratio was 2.55
  34. 1:17and the calmer ratio was 8. So this
  35. 1:20looks fantastic. But if you've been
  36. 1:22following me for a while, you know that
  37. 1:24recently I released this Monte Carlo
  38. 1:26feature, right? So when I ran it for
  39. 1:29this strategy just to make sure it's not
  40. 1:31overfit because the results are like too
  41. 1:34good to be true especially this 100% win
  42. 1:37rate. So that is definitely too good to
  43. 1:39be true and I wanted to see some losses
  44. 1:41because if the strategy has no losses I
  45. 1:44just cannot trust it because it
  46. 1:45basically means it's like a martingale
  47. 1:47strategy which we all know makes you a
  48. 1:50lot of money until you actually get
  49. 1:52liquidated right. So seeing a win rate
  50. 1:55of 100% is very scary and risky. Now let
  51. 1:58me show you the result of the Monte
  52. 2:00Carlo. So by the way, if you don't know
  53. 2:02how to run the script that I shared with
  54. 2:04you guys for a Monte Carlo, you
  55. 2:05basically put the code inside this file
  56. 2:08and it needs to be in the root of your
  57. 2:10project. And then in the terminal, you
  58. 2:12simply say Python and then the name of
  59. 2:14the file, which for me is test Monte
  60. 2:16Carlo, right? And inside this file, you
  61. 2:18want to make sure you've selected the
  62. 2:19correct symbol, exchange, the time
  63. 2:21frame, and the name of the strategy and
  64. 2:24the data routes in case you are using
  65. 2:26which this strategy is and also give it
  66. 2:28a starting or ending date, the number of
  67. 2:31scenarios you want to run and things
  68. 2:32like that. But anyways, let's go here.
  69. 2:35Now, this is the result. The original
  70. 2:37has a P&L of 30%, the sharp of 2.64, and
  71. 2:41the win rate of 100. exactly what I just
  72. 2:43displayed you from within the dashboard
  73. 2:45of the JC framework. But if we look at
  74. 2:47the best 5%, so it goes as well as 3.74.
  75. 2:51The MU rate is still 100%. In the
  76. 2:54median, the M win rate is 95%. So that's
  77. 2:57still really high and it looks
  78. 2:58wonderful. The sharp ratio for the
  79. 3:00median is 1.19. So again, this looks
  80. 3:03really, really awesome, right? But wait
  81. 3:05a minute, let's take a look at the
  82. 3:08chart. And this is how it looks like.
  83. 3:11Now, the thing is, most of them are
  84. 3:13indeed doing great. But some of them,
  85. 3:16not only they're not doing great, but
  86. 3:18they're actually going bananas. Like,
  87. 3:20this doesn't make any sense. The equity
  88. 3:23curve, even though it used to do really
  89. 3:25good, at some point it goes straight to
  90. 3:28zero. Some of them did good until here
  91. 3:30and then they went straight to zero. So,
  92. 3:33why is this happening? Because if the
  93. 3:35strategy has a stop-loss, which it does,
  94. 3:38this shouldn't be happening, right? So
  95. 3:39let's go to the code of the strategy.
  96. 3:41And you see when the position opens, I
  97. 3:44was submitting both the subplus and the
  98. 3:46take profit. But I also had this line.
  99. 3:48Now, by the way, this wasn't here. And
  100. 3:50that's actually what's wrong with it.
  101. 3:52Right? So we also had this line which is
  102. 3:54the update position method of Jesse,
  103. 3:57which basically means once another
  104. 3:59candle closes after I already have an
  105. 4:01open position, I want to do something.
  106. 4:03So in here, I'm checking if it's a short
  107. 4:05position, which it is because it's a
  108. 4:06short only position. I'm updating my
  109. 4:08stop loss. Now, when you do this,
  110. 4:10basically, you're creating some kind of
  111. 4:12trailing a stop, right? Because on every
  112. 4:13new candle, you're updating your stop
  113. 4:15loss. Now, remember this is short
  114. 4:17position, right? So, I want to bring
  115. 4:19down my stop loss. So, as soon as the
  116. 4:21price goes up again, I will close it,
  117. 4:23right? So, I'm using this syntax. So,
  118. 4:25the stops equals the quantity of the
  119. 4:27current position, which makes sense. And
  120. 4:29then as a price I'm saying the minimum
  121. 4:32of either the average stop loss which in
  122. 4:34this case means the previous stop loss
  123. 4:36price that we had. Now in the beginning
  124. 4:38we submitted here right? So for a short
  125. 4:41position the stop loss is being this. So
  126. 4:43the current price plus two times the
  127. 4:45ATR. But either this or if we've already
  128. 4:49updated it. So this will give us the
  129. 4:51average price. Now the average keyword
  130. 4:54here works only if you have multiple
  131. 4:56stops prices. But in this case we don't.
  132. 4:58We only have one, right? So again, it
  133. 5:01will give us that price and the big
  134. 5:02comma. Now the big comma is returning
  135. 5:04the values of the comma indicator with
  136. 5:07the period of 42. That's it basically.
  137. 5:10Now I was also selecting the current
  138. 5:12candles, but the syntax isn't really
  139. 5:14true. Like I could have just done this
  140. 5:16by the way because I'm using the same
  141. 5:18time frame. So this could have been just
  142. 5:20this. But anyways, I don't want to go
  143. 5:21through this exact syntax or entry or
  144. 5:23exit rules of the strategy. I just want
  145. 5:25to show this that basically I was
  146. 5:27updating my stop loss. So either this
  147. 5:30value which is like a moving average
  148. 5:32right and the average is stop price. So
  149. 5:36I I was just saying that give me
  150. 5:38whichever is lower. So why is this
  151. 5:40happening? So it goes really well but
  152. 5:42then it goes to zero right and the win
  153. 5:44rate is 100%. So I figured what's
  154. 5:47happening here. Basically I'm updating
  155. 5:50my stop loss price very soon after the
  156. 5:53position opens. So we can assume that
  157. 5:55this stop loss that we had here doesn't
  158. 5:57really matter and the new price was
  159. 6:00being either the previous price which of
  160. 6:02course would have been fine right or
  161. 6:05this become a value here so the only
  162. 6:07thing that could have caused things to
  163. 6:09go wrong was this and then I figured you
  164. 6:12see this is supposed to be a moving
  165. 6:13average so what if the value of it is
  166. 6:17actually below the current price and if
  167. 6:19that's happening then it is no longer a
  168. 6:22stop loss right so because if The
  169. 6:23current price is here and it's a short
  170. 6:26position. So your stop loss should
  171. 6:28always be high, right? For example, in
  172. 6:30here. But if you suddenly put it in
  173. 6:31here, then again it is no longer a stop
  174. 6:34loss, right? So it is a limit order. So
  175. 6:36it is waiting for the price to go here.
  176. 6:39So it will be your takeprofit order. But
  177. 6:41what if the price went up? Then your
  178. 6:45limit order will stay here forever. And
  179. 6:48because you keep getting losses then
  180. 6:52your equity curve will go to zero. So
  181. 6:54that was what was happening here. So the
  182. 6:56fix was to simply do this to add this
  183. 7:00value here to say if the big comma is
  184. 7:03bigger than the current price. I want to
  185. 7:06do this to make sure it is not below the
  186. 7:09current price. And when I did this then
  187. 7:12the equity curve went from this to this.
  188. 7:16So you see now instead of
  189. 7:20like 30% I'm making 5%. Although to be
  190. 7:24fair the max went down from - 8% to -4%.
  191. 7:29So it's still not that bad. In fact the
  192. 7:32win rate is still 70% which is good and
  193. 7:34the sharp ratio is 1.29 29 which again
  194. 7:37is good but it isn't this it's not like
  195. 7:41100% good anymore right and more
  196. 7:44importantly the strategy is safe to
  197. 7:46trade now so if you are using a
  198. 7:49technique like what I was doing in this
  199. 7:50strategy using a trailing stop-loss
  200. 7:53chances are you might also get some
  201. 7:55things wrong and maybe in your single
  202. 7:57back test you don't see that things are
  203. 8:00going wrong and Monte Carlo could
  204. 8:02actually save you from taking a huge
  205. 8:05loss at some point in the future. So
  206. 8:07that's it guys. I just wanted to share
  207. 8:08this experience with you because from
  208. 8:10now on I will never forget about this
  209. 8:13and I will definitely run Monte Carlo
  210. 8:15every single time before going live. Now
  211. 8:17this is a new type of video that I just
  212. 8:18did. So let me know what you guys think.
  213. 8:20If you enjoyed the video, please give it
  214. 8:22a like and subscribe to the channel for
  215. 8:24more videos like this. Thank you so much
  216. 8:25for watching. I'll see you in the next
  217. 8:27one.
  218. 8:32>> [music]

About this transcript

This page contains the full transcript of Monte Carlo simulation saved me from taking a huge loss by Algo-trading with Saleh, generated from the public captions YouTube serves with the video. The transcript has 1,632 words across 218 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.