YouTube2Text

How to Manage a Portfolio of Trading Strategies (Without Overfitting) — Transcript

by SharpeEdge · 6,253 words · 947 segments · language en · Watch on YouTube

Full transcript

  1. 0:00In the previous videos, we talked about
  2. 0:02how to build, backtest, and optimize a
  3. 0:04single strategy, but nobody serious
  4. 0:06trade a single strategy. Today, we talk
  5. 0:09about what happens after, how to put
  6. 0:11many strategies together into one
  7. 0:13portfolio, why you should diversify, how
  8. 0:15to make strategies comparable in terms
  9. 0:18of risk, how to assign weights, why
  10. 0:20optimizing the portfolio can be just
  11. 0:22another way to overfit, and a
  12. 0:24walk-forward technique to check whether
  13. 0:26your portfolio optimization actually
  14. 0:28works out of sample. We will start from
  15. 0:31the theory of diversification, then we
  16. 0:33move to the most important practical
  17. 0:35step, which is normalizing the risk for
  18. 0:37each strategy, then waiting methods, the
  19. 0:40formula I use in my live portfolio, the
  20. 0:43overfitting problem, a walk-forward
  21. 0:45approach to evaluate portfolio
  22. 0:46optimization, how to balance across
  23. 0:49instruments and strategy families, and
  24. 0:51finally some practical problems I faced
  25. 0:54running this live. Diversification is
  26. 0:57the only free lunch in finance, and
  27. 0:59these two formulas show why. If you
  28. 1:01combine N strategies with the same
  29. 1:03Sharpe ratio and an average correlation
  30. 1:05rho, the portfolio volatility goes down
  31. 1:08while the expected returns stay the
  32. 1:10same. So, the Sharpe ratio goes up. With
  33. 1:1310 strategies at Sharpe 0.5 and 0
  34. 1:16correlation, you get a portfolio Sharpe
  35. 1:19of about 1.6. But, look at the last row.
  36. 1:22When N goes to infinity, the Sharpe
  37. 1:24ratio converges to Sharpe ratio divided
  38. 1:27by the square root of rho. Correlation
  39. 1:29sets a ceiling. For example, with
  40. 1:32correlation 0.2, you can never go above
  41. 1:34about 1.1. So, the real goal is not more
  42. 1:38strategies, it's more uncorrelated
  43. 1:40strategies. This table shows the
  44. 1:43diversification multiplier, which is how
  45. 1:45much the Sharpe ratio improves as a
  46. 1:48function of the number of strategies
  47. 1:50with correlation 0.2. Going from one to
  48. 1:52five strategies gives you plus 67%
  49. 1:56from 10 to 50, only plus 14. Most of the
  50. 1:59benefit comes from the first 10 to 15
  51. 2:02different strategies. After that, every
  52. 2:05new strategy costs you development,
  53. 2:07porting, and monitoring time, and adds
  54. 2:10very little. This is why I target 10 to
  55. 2:1315 strategies live, and why a new
  56. 2:15strategy that's high correlated to what
  57. 2:18I already have usually doesn't make it
  58. 2:21to the portfolio. Before talking about
  59. 2:23weights, there is a step most people
  60. 2:25skip. Look at these three equity curves.
  61. 2:28If you just put them together with equal
  62. 2:30capital, strategy B with 25% volatility
  63. 2:34will drive almost all the portfolios ups
  64. 2:37and downs. You think you're diversified
  65. 2:40across three strategies, but in terms of
  66. 2:42risk, you're basically have one. So, the
  67. 2:45first rule is you can't compare or
  68. 2:47combine strategies until they have the
  69. 2:50same risk. And the measure of risk we
  70. 2:52will use is annualized volatility.
  71. 2:55Volatility targeting means rescaling
  72. 2:58each strategy so that stand-alone, it
  73. 3:00has the same annual volatility. You take
  74. 3:03the daily returns, compute the standard
  75. 3:05deviation, annualize it, and compute a
  76. 3:08scaling factor. Target volatility
  77. 3:10divided by realized volatility. If my
  78. 3:13target is 10% and a strategy runs at 20,
  79. 3:17I trade it half size. If it runs at
  80. 3:20five, I double it. Use daily returns,
  81. 3:22not trade returns, so that holding
  82. 3:25period and trade frequency are already
  83. 3:27accounted for. Now, how you actually
  84. 3:30apply the scaling depends on how the
  85. 3:32strategy sizes positions. So, let's see
  86. 3:35the two cases. If you use a stop-loss
  87. 3:37and size every trade as a fixed
  88. 3:40percentage of equity at risk, the risk
  89. 3:42per trade is not the same thing as the
  90. 3:45strategy risk. The annual volatility
  91. 3:47depends on how many trades you take per
  92. 3:49year, and how dispersed the outcomes are
  93. 3:52in our multiples. Two strategies both
  94. 3:55risking 1% per trade can have a
  95. 3:57completely different annual volatility.
  96. 4:00One with 50 trades per year sits around
  97. 4:0210% one with 200 trades sits around 20%.
  98. 4:06The formula is only an approximation
  99. 4:09because it assumes independent trades
  100. 4:11and ignores overlapping positions. So in
  101. 4:13practice I do it empirically. Run the
  102. 4:16back test at 1% risk measure the annual
  103. 4:18volatility of the equity curve and
  104. 4:21rescale the risk per trade linearly to
  105. 4:23hit the target. Returns scale roughly
  106. 4:26linearly with risk so this works well
  107. 4:29apart from lot rounding which we will
  108. 4:32see later. If you don't use stop losses
  109. 4:34a risk is controlled through position
  110. 4:36size directly. Here I use a simple
  111. 4:39discrete signal plus one long minus one
  112. 4:41short zero is flat. When the signal is
  113. 4:44on the position notional value is the
  114. 4:46account equity times the ratio between
  115. 4:48the target volatility and the
  116. 4:50instruments volatility. That ratio is
  117. 4:53your leverage. If the instrument moves
  118. 4:5520% a year and your target is 10% the
  119. 4:58notional is half your equity. If it
  120. 5:01moves 5% a year the notional is twice
  121. 5:03your equity. Then you convert notional
  122. 5:06to lots dividing by price times point
  123. 5:08value which is the value of one lot. Be
  124. 5:11careful not to confuse the two. Equity
  125. 5:14is what you have in the account notional
  126. 5:16is the exposure you get as output. One
  127. 5:19caveat is that this gives you the target
  128. 5:22volatility only while you're in a
  129. 5:24position. If the strategy is in the
  130. 5:27market say 40% of the time it's realized
  131. 5:30annual volatility is roughly the target
  132. 5:33times the square root of 0.4. So about
  133. 5:3563% of it. So also here the final step
  134. 5:39is the same. Measure the strategies
  135. 5:41realized annual volatility and rescale.
  136. 5:43Both approaches end in the same place.
  137. 5:46Every strategy at the same annual risk.
  138. 5:49Once the strategies at the same risk,
  139. 5:51you need weights. Here are the main
  140. 5:53families. Equal weight use no
  141. 5:55information at all. Inverse volatility
  142. 5:58is pointless once you've done volatility
  143. 6:00targeting because all volatilities are
  144. 6:02already equal. Equal risk contribution
  145. 6:05and minimum variance use the covariance
  146. 6:07metrics, but not expected returns.
  147. 6:09Markovitz max sharp uses expected
  148. 6:12returns, and that's why the trouble
  149. 6:15begins. Hierarchical risk parity from
  150. 6:17Marcos Lopez de Prado cluster strategies
  151. 6:20by correlation and allocates top-down
  152. 6:23avoiding matrix inversion, so it's more
  153. 6:25stable. And Carvers and Crafting groups
  154. 6:27similar strategies and assigns weights
  155. 6:30by hand to the groups. Moving down the
  156. 6:32table, you use more information from the
  157. 6:34data, which sounds better, but every
  158. 6:37number you estimate is a number you can
  159. 6:39get wrong. This is what I use in my life
  160. 6:41portfolio. Every strategy is already at
  161. 6:44the same target volatility, so equal
  162. 6:47weight means equal risk. If I simply
  163. 6:49divided by n, the portfolio volatility
  164. 6:52would end up well below target because
  165. 6:54the strategies aren't perfectly
  166. 6:56correlated. This formula fixes that.
  167. 6:59It's the weight that brings the whole
  168. 7:01portfolio exactly back to the target
  169. 7:03volatility given n and the average
  170. 7:05correlation. It's mathematically the
  171. 7:07same as Carver's diversification
  172. 7:09multiplier divided by n. With 10
  173. 7:12strategies and average correlation of
  174. 7:140.2, each strategy gets 18.9 of its
  175. 7:18stand-alone size instead of 10%. In
  176. 7:20practice, if a strategy risks 0.5 per
  177. 7:24trade on its own, inside the portfolio,
  178. 7:26it risks about 0.095%
  179. 7:30and the portfolio as a whole runs at 10%
  180. 7:32volatility. Why not just run an
  181. 7:34optimizer and maximize the sharp ratio?
  182. 7:37Well, because portfolio optimization is
  183. 7:39itself a fit. Classic research showed
  184. 7:42that errors in the means hurt about 10
  185. 7:45times more than errors in the variances.
  186. 7:47With a sharp 0.5 over 10 years of data,
  187. 7:50the standard error is about 0.34.
  188. 7:54So, a strategy with backtest sharp 0.5
  189. 7:57and one with 0.9 are statistically
  190. 8:01almost indistinguishable. The optimizer
  191. 8:03doesn't know that. It puts big weights
  192. 8:06on whatever got lucky in sample. De
  193. 8:08Miguel and co-authors showed that
  194. 8:11mean-variance optimization out of sample
  195. 8:14doesn't consistently beat simple 1/n.
  196. 8:17Plus, there is a double-dipping problem.
  197. 8:19You selected these strategies because
  198. 8:22their backtest was good, and now you're
  199. 8:24using the same backtest again to weight
  200. 8:26them. That's a selection bias on top of
  201. 8:28selection bias. So, how do we know if an
  202. 8:31optimization method is actually helping?
  203. 8:34The same way we validate a strategy,
  204. 8:35walk forward. You take a window of
  205. 8:37history, estimate the weights with
  206. 8:39method you want to test, then apply
  207. 8:41those weights frozen to the next unseen
  208. 8:43period. Then you roll forward and
  209. 8:45repeat. At the end, you concatenate all
  210. 8:47the out-of-sample periods, and you get
  211. 8:49an honest equity curve of the allocation
  212. 8:51method. The key is the benchmark.
  213. 8:54Compare it with the 1/n on exactly the
  214. 8:57same out-of-sample periods. If your
  215. 8:59method doesn't beat equal weights out of
  216. 9:01sample, the optimization is just fitting
  217. 9:04noise. This idea exists in the
  218. 9:06literature, is essentially how De Miguel
  219. 9:08evaluated allocation methods. Also, look
  220. 9:11at the walk forward efficiency and at
  221. 9:13how much the weights jump between
  222. 9:15windows. Unstable weights are a red flag
  223. 9:17on their own. There is also a trap that
  224. 9:19makes most portfolio walk forwards
  225. 9:22useless. If the strategy returns you
  226. 9:24feed are in-sample backtests, it doesn't
  227. 9:27matter how carefully you walk forward
  228. 9:29the weights. The inputs are already
  229. 9:31overfitted. The fix is to use for each
  230. 9:33strategy the out-of-sample returns from
  231. 9:36its own walk forward analysis or live
  232. 9:39returns. Basically, a walk forward on
  233. 9:41top on a walk forward. Also, a strategy
  234. 9:43should only enter the portfolio from the
  235. 9:46date you could actually have known about
  236. 9:48it. And remember that if you test six
  237. 9:51allocation methods and pick the best
  238. 9:53one, you've just introduced a new
  239. 9:55selection bias. So, check whether your
  240. 9:57improvement over equal weight is
  241. 9:59significant, for example, by
  242. 10:01bootstrapping the difference in Sharpe
  243. 10:03ratios. Equal weight has a weakness. It
  244. 10:06gives equal weight to strategies, not to
  245. 10:09ideas. If I have eight trend following
  246. 10:11strategies and two mean reversion ones,
  247. 10:13equal weight means 80% of my risk is on
  248. 10:16trend following, just because I happen
  249. 10:18to develop more of them. The solution is
  250. 10:21decide a priori the percentage for each
  251. 10:24strategy family, for example, 40% to
  252. 10:26trend following, 40% to mean reversion,
  253. 10:2920% for everything else. Inside each
  254. 10:32bucket, equal weight. Trend following
  255. 10:34and mean reversion tend to make money in
  256. 10:36different market regimes, so they're
  257. 10:38natural diversifiers. These percentages
  258. 10:40are not estimated from data, so they
  259. 10:43can't be over fitted, and that's the
  260. 10:45point. This is the core idea of Carvers
  261. 10:47and Crafting. The same logic applies to
  262. 10:49instruments. You can have 10 different
  263. 10:51strategies, but if four of them trade
  264. 10:54the S&P 500, you're much more
  265. 10:56concentrated than you think. On a bad
  266. 10:58day for equities, they can lose all
  267. 11:00together, even if their average
  268. 11:02correlation looked low. So, I look at
  269. 11:05the portfolio also by instrument and by
  270. 11:07asset class, and I put caps. No single
  271. 11:10instrument or asset class above a
  272. 11:11certain share of my risk. And part of
  273. 11:14the job is building new strategy that
  274. 11:16fill the gaps where you're under
  275. 11:18weighted, rather than adding a fifth
  276. 11:20strategy on the same index. The
  277. 11:23correlation formula has a hidden risk. A
  278. 11:25lower correlation gives a higher weight
  279. 11:27per strategy, which means more leverage
  280. 11:30on each one. That's fine as long as
  281. 11:32correlations stay low, but correlations
  282. 11:34are not stable. So, they tend to rise
  283. 11:37exactly in market stress when everything
  284. 11:40sells off together. That's when your
  285. 11:42portfolio volatility can blow past the
  286. 11:44target. So, I use safeguards. I never
  287. 11:46let the average correlation go below
  288. 11:48zero. Carver caps the diversification
  289. 11:51multiplier at 2.5, and you can use a
  290. 11:54conservative correlation estimate, for
  291. 11:56example, a high quantile of the rolling
  292. 11:58correlation rather than the full sample
  293. 12:01average. Now, some problems I see in
  294. 12:03real life. First, when you only have a
  295. 12:04few strategies live, for example, after
  296. 12:07pulling for some maintenance, the
  297. 12:08formula would give each one of them a
  298. 12:10very large weight. With three
  299. 12:12strategies, each one carries a lot of
  300. 12:14risk, and you have no real
  301. 12:16diversification to justify it. So, I set
  302. 12:18a minimum n of 10. Until the portfolio
  303. 12:21is full, it simply runs below its
  304. 12:23volatility target. Second, lot rounding.
  305. 12:26When you divide the risk among many
  306. 12:28strategies, the risk per trade gets very
  307. 12:30small. And minimum lot of 0.01, some
  308. 12:33trades run to zero and get skipped or
  309. 12:36get rounded up and are bigger than
  310. 12:38intended. Your live results then drift
  311. 12:41from the backtest. Check what the
  312. 12:43minimum position means in terms of risk
  313. 12:45for each instrument given your capital.
  314. 12:48Third, keep track of which sizing
  315. 12:50configuration was active for each trade.
  316. 12:53I encode it with magic number, so I can
  317. 12:55always reconstruct what was running.
  318. 12:58Last decision, what volatility target to
  319. 13:00use. On a personal account, it's about
  320. 13:02the drawdown you can tolerate
  321. 13:04emotionally and financially. On a prop
  322. 13:06firm account, it's driven by the rules,
  323. 13:09daily loss limit and maximum drawdown.
  324. 13:11The right way is not to guess, but to
  325. 13:13bootstrap the portfolio returns and
  326. 13:15simulate the challenge many times,
  327. 13:17estimating the probability of passing,
  328. 13:19the probability of hitting the daily
  329. 13:21loss limit, and the expected value per
  330. 13:23attempt. To give you an idea, 10% annual
  331. 13:26volatility is about 0.63%
  332. 13:29daily. 20% is about 1.26%.
  333. 13:33Fat tails and correlation spikes make
  334. 13:35the bad days worse than a normal
  335. 13:37distribution suggests, which is why
  336. 13:39simulation on real returns beats the
  337. 13:41formula. Now we will go through the full
  338. 13:44pipeline of managing the portfolio of
  339. 13:47strategies with this Jupiter notebook,
  340. 13:49and we will go step by step following
  341. 13:52the presentation. We start by defining
  342. 13:54these parameters. So, the number of bars
  343. 13:58per year, the target volatility of the
  344. 14:00strategies and the portfolio, the mean
  345. 14:03Sharpe ratio of each strategy, even
  346. 14:05though each one will have a different
  347. 14:07performance, the number of years
  348. 14:09simulated and the random seed. Then we
  349. 14:12initialize a basket of strategies from
  350. 14:15different styles and applied on
  351. 14:17different asset classes and instruments.
  352. 14:20So, for example, we have this trend
  353. 14:21following strategy on the S&P 500 with a
  354. 14:25win rate of 38% exposure to the market
  355. 14:28of 70% volatility raw of 14% and true
  356. 14:32Sharpe ratio of 0.75. And as you can
  357. 14:35see, each strategy has a different
  358. 14:37statistical profile in terms of win
  359. 14:40rate, exposure, volatility, and Sharpe
  360. 14:42ratio. Now a bit of explanation of how
  361. 14:45we build the strategies because since we
  362. 14:47need to know the truth, we need to
  363. 14:49generate the data ourselves in two
  364. 14:51steps. First, we generate each strategy
  365. 14:54on its own. So, every day it's either in
  366. 14:56the market or flat. If it's in the
  367. 14:58market, it wins with a given
  368. 15:00probability, which is the win rate. Then
  369. 15:02we pick the size of wins and losses so
  370. 15:05that each strategy is has exactly the
  371. 15:07Sharpe ratio that was defined for them.
  372. 15:10And as a second step, we define how they
  373. 15:13move together. So, we use a correlation
  374. 15:15matrix. So, strategies on the same
  375. 15:18instrument, the same asset class, and
  376. 15:20the same family are more correlated by
  377. 15:22definition. So, we use a tool called a
  378. 15:25Gaussian copula, which ties each
  379. 15:27strategy to the others using that matrix
  380. 15:30without changing the shape of its
  381. 15:32returns. Finally, since it's also the
  382. 15:34case as in real life, we let the
  383. 15:36correlation drift slowly over time and
  384. 15:39add a few stress periods when everything
  385. 15:42moves together to simulate the market
  386. 15:44crashes. And after we created every
  387. 15:47strategy profile, we can also see that
  388. 15:49for example, trend following strategies
  389. 15:52have a low win rate, but the average win
  390. 15:54to average loss is greater, and we can
  391. 15:57also check the skewness, which is
  392. 15:59positive for trend following and
  393. 16:01negative for mean reverting ones. Here
  394. 16:03we can see the distribution of daily
  395. 16:05returns from different strategies. So,
  396. 16:08in blue we have the trend following with
  397. 16:10positive skew and low win rate. In the
  398. 16:12red, we have the mean reverting strategy
  399. 16:15with negative skew and high win rate.
  400. 16:17And in green, we have our carry strategy
  401. 16:20with win rate about 55%. Here we can see
  402. 16:23the equity curves of all the strategies,
  403. 16:26and it's so clear that every strategy
  404. 16:29has a very different risk profile. For
  405. 16:31example, this one has a much higher
  406. 16:33volatility than this one. Here we have
  407. 16:36the correlation matrix of daily returns
  408. 16:38over the full sample, and we can see
  409. 16:41that the strategies within the same
  410. 16:43family as a higher correlation by
  411. 16:46construction of ours. And also in
  412. 16:49respect to the same instruments. For
  413. 16:51example, here we have the S&P 500 and
  414. 16:53also here, and we can see the
  415. 16:55correlation is high even though this is
  416. 16:57a trend following and this is a
  417. 16:58seasonality strategy. Here we can see
  418. 17:01the three-month pairwise correlation for
  419. 17:04four couples of strategies, and by
  420. 17:07definition, we have this correlation
  421. 17:09changing over time slowly. And also, we
  422. 17:12can see the moments of crisis when all
  423. 17:16the correlations tend to spike
  424. 17:18simultaneously.
  425. 17:19Now we see the formula for calculating
  426. 17:22the Sharpe ratio of the portfolio that
  427. 17:24given each strategy having 0.5 Sharpe
  428. 17:27ratio and a correlation of 0, 0.2, 0.5,
  429. 17:31we have the same values we obtain in the
  430. 17:34presentation. So we can see that as long
  431. 17:36as the correlation of the portfolio is
  432. 17:38low, the Sharpe ratio goes to infinity,
  433. 17:41while if the strategies are correlated,
  434. 17:44the value added is almost none. Here is
  435. 17:46the plot of that equation. So with
  436. 17:48highly correlated strategies, the value
  437. 17:51of adding new strategies is almost zero,
  438. 17:54while for totally uncorrelated
  439. 17:56strategies, the Sharpe ratio of the
  440. 17:58portfolio continues to grow up to
  441. 18:01infinity. This in particular is our
  442. 18:03case, so we have an average Sharpe ratio
  443. 18:06of 0.74 and an average correlation of
  444. 18:090.15. So we can see that we get the most
  445. 18:12benefit in the beginning and then the
  446. 18:14performance tend to stale here. This is
  447. 18:17the same concept in terms of
  448. 18:19diversification multiplier. So how much
  449. 18:22you are gaining in terms of Sharpe ratio
  450. 18:25of performance by adding new strategies.
  451. 18:28And as you can see, for correlated
  452. 18:30strategies, the the gain is zero, while
  453. 18:34for and the uncorrelated strategies is
  454. 18:36much higher, but also you can see that
  455. 18:39after a while the benefit is smoothed.
  456. 18:42So we get the most value in terms of
  457. 18:45number of strategies employed around 10
  458. 18:48to 15. This plot shows the increase in
  459. 18:51Sharpe ratio of the portfolio given the
  460. 18:54correlation of the new strategy. So if
  461. 18:57we have a strategy uncorrelated from the
  462. 18:59portfolio, we get an 8% gain, while if
  463. 19:03the strategy is very much correlated, we
  464. 19:05get a diminishing Sharpe ratio of minus
  465. 19:089%. Here we see three strategies from
  466. 19:11the portfolio and we can immediately
  467. 19:14notice that this trend following
  468. 19:15strategy on gold is way more volatile
  469. 19:18than the others. Indeed, it has a annual
  470. 19:21volatility of 25% and if we look the
  471. 19:24strategies in terms of risk, we can also
  472. 19:27see that 70% of the risk is allocated in
  473. 19:31this strategy. So, to compare different
  474. 19:33strategies, we need first to standardize
  475. 19:36each one of them to the same level of
  476. 19:39annual volatility and you can clearly
  477. 19:41see the difference once we do that
  478. 19:44because now all the strategies are on
  479. 19:46the same level of risk, which is also
  480. 19:49confirmed by this plot. So, they're all
  481. 19:52around 35%
  482. 19:54of risk and now we will dive through
  483. 19:56each case for volatility targeting your
  484. 20:00strategy. So, the first case is using a
  485. 20:02stop loss per trade. So, in this case,
  486. 20:05the annual volatility is the risk per
  487. 20:07trade multiplied the standard deviation
  488. 20:10of the R multiple multiplied the square
  489. 20:12root of the number of trades per year.
  490. 20:14So, this means that two strategies
  491. 20:17having the same risk per trade, if one
  492. 20:19trades way more often than the other, it
  493. 20:22will have a much higher volatility over
  494. 20:25the year and that's why it will have a
  495. 20:27lower risk per trade once it's scaled
  496. 20:30and we can see effectively once the
  497. 20:33scale is applied, the two strategies are
  498. 20:36almost identical. So, in this case, the
  499. 20:39first strategy trades 50 times per year
  500. 20:41with a 10% volatility. The second one
  501. 20:44trades 200 times per year with a 20.9%
  502. 20:48volatility. So, the scale the risk per
  503. 20:51trade becomes 0.93%
  504. 20:54for the first strategy and for the
  505. 20:56second one is 0.48 and as you can see,
  506. 20:59the final volatility is 10%. Instead, if
  507. 21:03you use no stop loss, you have to size
  508. 21:05your positions according to the market
  509. 21:07volatility. So, assuming that your
  510. 21:09signal is either -1, 0, or 1, so it's
  511. 21:13binary, but you can also do that with
  512. 21:16continuous signals. Your notional, so
  513. 21:18the value of the position, is your
  514. 21:20signal times the equity times the
  515. 21:23leverage, which is the ratio between the
  516. 21:25volatility target and the volatility of
  517. 21:28the instrument, and the number of lots
  518. 21:30will be the notional divided by the
  519. 21:32price of the contract, and you can
  520. 21:34estimate this instrument volatility
  521. 21:37using a rolling estimate of the
  522. 21:39volatility over the instrument. Here you
  523. 21:42can see what happens when you don't
  524. 21:44scale your positions according to
  525. 21:46volatility. So, this is the volatility
  526. 21:48of the underlying instrument, and this
  527. 21:51is the volatility of your strategy when
  528. 21:54you have a fixed notional. So, it will
  529. 21:56follow precisely the market volatility,
  530. 21:59while if you size the positions
  531. 22:01according to an estimate of market
  532. 22:03volatility, you will be always around
  533. 22:06your volatility target or lower, and I
  534. 22:09say lower because in this case you are
  535. 22:12exposed 67% of the time. So, our actual
  536. 22:16volatility becomes 8.2% instead of 10%.
  537. 22:20So, again, after we sized according to
  538. 22:24volatility, we have to rescale back
  539. 22:26according to our exposure. So, using a
  540. 22:29fixed notional, we have the same
  541. 22:31volatility of the market, while with
  542. 22:33volatility scaled we have less than 10%,
  543. 22:36so 8.3%, which is this one given this
  544. 22:40exposure, but once we scaled back, we go
  545. 22:43to our target of 10% volatility. Now,
  546. 22:46we'll go through the main methods for
  547. 22:48weighting the portfolio. So, we have the
  548. 22:50equal weights, the inverse volatility,
  549. 22:53the equal risk contribution, the minimum
  550. 22:55variance, the max sharp, and the
  551. 22:57hierarchical risk parity. We can see
  552. 22:59here the weights over the whole
  553. 23:02portfolio given different waiting
  554. 23:04methods and over the full time sample.
  555. 23:07So, what we see is that most methods are
  556. 23:11balanced except for the max sharp ratio
  557. 23:14which tends to concentrate all the
  558. 23:17power, all the weights into the most
  559. 23:20proficient strategies. And if we look at
  560. 23:23the detail of the weights here, of
  561. 23:25course equal weight and inverse
  562. 23:27volatility are constant about 8% the ERC
  563. 23:31is very conservative in the delta of
  564. 23:35weights. The mean variance as some
  565. 23:37weights close to zero. For example, this
  566. 23:40trend following strategy gets a 0.8
  567. 23:43weight which is almost none, but no
  568. 23:45weight is extremely high. While for the
  569. 23:48max sharp ratio, many strategies gets a
  570. 23:52weight around zero and a few strategies
  571. 23:54get a weight around 20 to 30%. And
  572. 23:58finally, the hierarchical risk parity is
  573. 24:02also balanced just like ERC. This is a
  574. 24:04very important plot in finance and it's
  575. 24:07called the efficient frontier. It shows
  576. 24:09the annualized volatility against the
  577. 24:13annualized return. So, here we have all
  578. 24:15our single strategies operating at a
  579. 24:19volatility of 10% given different rate
  580. 24:22of returns because they have different
  581. 24:24sharp ratios. And here we have the
  582. 24:26performance of the various kinds of
  583. 24:28portfolio techniques and this clearly
  584. 24:31shows that the portfolio aggregation
  585. 24:34maintains the same level of return, but
  586. 24:37minimizes a lot the variance or
  587. 24:40annualized volatility of the returns.
  588. 24:43Here we can see the zoom into this
  589. 24:46cluster and we can see that all these
  590. 24:49methods are very similar and close to
  591. 24:52each other in this region while the max
  592. 24:55sharp ratio wants a higher return. So,
  593. 24:58it's more distant in the plot from the
  594. 25:00others. And we can also notice that the
  595. 25:03one And of course, this is the
  596. 25:06performance in sample. So, we know
  597. 25:08nothing about the performance out of
  598. 25:10sample of this portfolio configuration.
  599. 25:14This is the formula I use for my
  600. 25:16waiting. So, it uses both the number of
  601. 25:18strategies and the average correlation
  602. 25:21of the portfolio. And it's equal to the
  603. 25:23diversification multiplier divided by
  604. 25:25the number of strategies. For example,
  605. 25:28we have a 12 strategies with average
  606. 25:30correlation of 0.15. The weight becomes
  607. 25:330.17,
  608. 25:34while the equal weight would be just
  609. 25:370.08. So, if the risk per trade on a
  610. 25:40singular level is 0.5% stand alone, it
  611. 25:43becomes 0.088
  612. 25:46in the portfolio. And we can see here
  613. 25:48just the equal weight and the equal
  614. 25:50weight plus correction for the
  615. 25:52correlation. In particular, if we just
  616. 25:55scale according to the number of assets,
  617. 25:57the volatility is reduced a lot, while
  618. 26:00we want to go back to our target of 10%
  619. 26:04volatility. Now, we see why optimizing
  620. 26:06the portfolio overfits. So, this is the
  621. 26:08formula for the standard error of the
  622. 26:11Sharpe ratio. And from this, we can
  623. 26:13calculate the standard error of our 0.5
  624. 26:16Sharpe ratio over 10 years, which is
  625. 26:190.34.
  626. 26:21So, basically, the 95% confidence
  627. 26:23intervals are something between minus
  628. 26:260.1 and 1.1. So, even using 10 years of
  629. 26:31data, the edge is not still
  630. 26:34statistically indistinguishable from
  631. 26:37noise. And if we just look at 3 years of
  632. 26:40data, the standard error is 0.63.
  633. 26:44So, this could be easily be zero, but
  634. 26:48the optimizer see that the strategy is
  635. 26:52profitable, okay? So, the the error is
  636. 26:55huge, but the optimizer sees that the
  637. 26:58strategy is profitable and allocates a
  638. 27:01greater weight to the strategy. And
  639. 27:03also, we can see that even though the
  640. 27:05strategies have a true Sharpe ratio
  641. 27:08between 0.2 and 1 by construction, if we
  642. 27:11estimate the performance on a yearly
  643. 27:13basis, the variance is huge because we
  644. 27:16have estimates between -1.34
  645. 27:20up to 2.4, 2.6, 3, -2. So, the
  646. 27:26optimizer, using just a few years of
  647. 27:29data, it's very difficult to tell real
  648. 27:32edge from just luck on that specific
  649. 27:35year or in-sample fault. And that's why
  650. 27:38it's so easy to overfit the optimization
  651. 27:42of the portfolio. And if we use the max
  652. 27:44Sharpe ratio method, we can see that the
  653. 27:47weights change enormously from one fold
  654. 27:50to the other. But what changed actually
  655. 27:53was just the estimate of the performance
  656. 27:56of the strategies because they had
  657. 27:58constant Sharpe ratio by construction.
  658. 28:00So, the optimizer just see the noise in
  659. 28:03the estimate and changes almost
  660. 28:06completely the weights from one fold to
  661. 28:08the other. Here, you can see the true
  662. 28:10Sharpe ratio of the strategy against the
  663. 28:14average weight picked by the optimizer.
  664. 28:17And we can see that there are a lot of
  665. 28:19very good strategies with high Sharpe
  666. 28:21ratios, which get very low weights on
  667. 28:24certain folds just because the optimizer
  668. 28:27saw the noise and not the signal. So, a
  669. 28:30good way to estimate the efficiency of
  670. 28:33your portfolio optimization is to use
  671. 28:36walk-forward analysis. So, we will use a
  672. 28:383-year in-sample window, estimate the
  673. 28:41weights using each method, and evaluate
  674. 28:44out of sample for the next year.
  675. 28:46Finally, we will concatenate all these
  676. 28:49out of sample returns and compare all
  677. 28:52the methods against the equal weight.
  678. 28:54And we will use as metrics the out of
  679. 28:56sample sharp, the in sample sharp, the
  680. 28:59efficiency, which is just the ratio
  681. 29:01between the out of sample and in sample,
  682. 29:04and the turnover, which is the change of
  683. 29:07the weights over time. Here is the
  684. 29:09result. So, the max sharp, which wants
  685. 29:12to optimize, actually performed worse,
  686. 29:15while the equal weight performed around
  687. 29:18the middle of all the performers. And
  688. 29:21the best one was actually the mean
  689. 29:23variance method. The results are in this
  690. 29:25table. So, the equal weight has an
  691. 29:28efficiency of around one, having done no
  692. 29:31optimization at all. Inverse volatility
  693. 29:34and ERC about the same efficiency. The
  694. 29:37mean variance was the best with 1.06
  695. 29:40efficiency. So, the out of sample was
  696. 29:43even better than the in sample on
  697. 29:45average. The max sharp was the worst,
  698. 29:48absolute worst, having a 0.59
  699. 29:50efficiency. And the hierarchical risk
  700. 29:53parity with a good performance of 1.04.
  701. 29:56Also, we can see the turnover of
  702. 29:58weights, which is kind of low, except
  703. 30:00from the mean variance and the max sharp
  704. 30:03ratio. Now, to understand if this
  705. 30:06performance is real or not, we bootstrap
  706. 30:09the delta increments in sharp ratio
  707. 30:12against the equal weight method. And
  708. 30:15what we get here is the max sharp method
  709. 30:19in green. The dotted line is the equal
  710. 30:22weight. This is the ERC, and this is the
  711. 30:25mean variance method. We can see the
  712. 30:27numbers in this table. So, the three
  713. 30:30methods based on covariances, which is
  714. 30:32the HRP, the ERC, and the mean variance,
  715. 30:35are statistically superior in this
  716. 30:38simulation compared to to equal weight,
  717. 30:40while the max sharp is inferior to the
  718. 30:43equal weight method, but not as
  719. 30:45statistically significant as the others.
  720. 30:49Here we can also see the stability of
  721. 30:51our increment against the equal weight
  722. 30:55over time, and we can see that the ERC,
  723. 30:59mean variance, and HRP are above the
  724. 31:02equal weight about 80 to 90% of the
  725. 31:05time, even though we saw the increment
  726. 31:08is not huge, while the max sharp is
  727. 31:11above the equal weight just 39% of the
  728. 31:14time. So, it's very unstable how it
  729. 31:16compares against the equal weight. Here
  730. 31:19we see the out-of-sample sharp ratio by
  731. 31:21calendar year and how many years the
  732. 31:24methods beat the equal weight. So, for
  733. 31:27inverse volatility is nine, ERC is nine,
  734. 31:30mean variance is nine, the HRP is eight,
  735. 31:33and the max sharp is four out of 10
  736. 31:35years. So, in conclusion, given our
  737. 31:38synthetic data, which has slowly
  738. 31:41changing correlation over time, the max
  739. 31:43sharp ratio method has the highest
  740. 31:46in-sample performance and the worst
  741. 31:48out-of-sample performance, while the
  742. 31:50covariance-based methods, so the ERC,
  743. 31:54mean variance, and HRP are significantly
  744. 31:57superior than the equal weight method,
  745. 32:00and the inverse volatility is just
  746. 32:02slightly different because the actual
  747. 32:05volatility is not exactly 10% per year.
  748. 32:09This means that these three methods
  749. 32:11efficiently estimate the correlation in
  750. 32:14the in-sample windows and exploit it in
  751. 32:17the out-of-sample test. This result,
  752. 32:19however, is not guaranteed in real life
  753. 32:22using your own strategies and given
  754. 32:25their rolling correlation over time. In
  755. 32:27this experiment, we create 40 strategies
  756. 32:30without any edge, and in the first case,
  757. 32:33we select 10 of them looking at the
  758. 32:35whole sample and running the equal
  759. 32:38weight portfolio on them. And as you can
  760. 32:40see, the expected sharp ratio is 0.81,
  761. 32:45even though the strategies have no edge.
  762. 32:47While in this case, we only select the
  763. 32:50strategies using the in-sample fold and
  764. 32:53evaluate the performance out of sample.
  765. 32:55And in this case, the performance is
  766. 32:57zero, of course. So, this clearly shows
  767. 33:00how selecting based on the full sample
  768. 33:04can inflate your results. So, the
  769. 33:06walk-forward analysis is correct, but
  770. 33:08the inputs are totally wrong. So, here
  771. 33:10we can see how we balance the risk
  772. 33:13between different strategy types. So, we
  773. 33:16can see that using equal weight, we have
  774. 33:18a higher risk allocated to trend
  775. 33:20following just because I have more trend
  776. 33:22following strategies in my portfolio.
  777. 33:24While I would prefer to allocate certain
  778. 33:27buckets of risk towards certain strategy
  779. 33:30families. So, for example, 40% to mean
  780. 33:34reversion, 40% to trend following, and
  781. 33:3620% to the other. So, they are more
  782. 33:39balanced independently on the number of
  783. 33:42strategies within each bucket. In this
  784. 33:44case, you define the percentage of total
  785. 33:48risk of the portfolio and then apply the
  786. 33:50equal weight or optimization method to
  787. 33:53that specific bucket of strategies which
  788. 33:56share the percentage you decided upon
  789. 33:59the total portfolio. Balancing the risk
  790. 34:02among instruments and asset classes is
  791. 34:05basically the same thing. So, we can see
  792. 34:07that if we have four strategies on the
  793. 34:09S&P 500, the risk allocated in this
  794. 34:12instrument is way higher than the other
  795. 34:15instruments. And so, the risk by asset
  796. 34:18class in this case for indices is too
  797. 34:21large. So, in this case, what we want to
  798. 34:24do is just fix a cap of share for each
  799. 34:28asset class and then rebalance all the
  800. 34:30others according to the margin left. So,
  801. 34:33for example, in this case, we want to
  802. 34:35cut the risk at 25% and then split this
  803. 34:39amount of risk within the asset classes
  804. 34:42that have less, so metals, agriculture,
  805. 34:45and energy.
  806. 34:46Another very important factor to
  807. 34:48consider is that average correlation of
  808. 34:51your portfolio and strategies changes
  809. 34:54over time. So, the problem is that when
  810. 34:56there are market crashes or crises, the
  811. 35:00average correlation tend to spike, and
  812. 35:02that's the moment when we most need the
  813. 35:05diversified portfolio. So, in this case,
  814. 35:08what do we do? We measure the volatility
  815. 35:11of the portfolio using a conservative
  816. 35:13estimate. So, for example, we measure
  817. 35:15the rolling volatility over 6 months, 1
  818. 35:19month, and then take the 90 or 95% of
  819. 35:24that as a conservative value. So, we can
  820. 35:27see that if we use the standard one,
  821. 35:29which is the average correlation, which
  822. 35:31is 0.15, the diversification multiplier
  823. 35:35becomes 2.11, and the volatility during
  824. 35:39stress periods becomes 0.16,
  825. 35:43so almost the double as what we have
  826. 35:45normally. While using a conservative
  827. 35:48value of raw, which is 0.28,
  828. 35:51so it's almost the double of the
  829. 35:54average, we have a diversification
  830. 35:56multiplier of 1.7, and the volatility in
  831. 36:00a stress period becomes 0.13.
  832. 36:03And we can see, for example, in this
  833. 36:05period of crash, our rolling volatility
  834. 36:08of the portfolio is way lower than what
  835. 36:12we would have using the average
  836. 36:13correlation. Two other important factors
  837. 36:16to consider are lot rounding and number
  838. 36:19of strategies. So, if you have a low
  839. 36:22number of strategies, the weight per
  840. 36:24strategy would be very high, And this
  841. 36:27means that anything that goes wrong with
  842. 36:30the strategy, being that alpha decay
  843. 36:33execution, it will have a drastic effect
  844. 36:36on your portfolio. And this is very
  845. 36:38dangerous to me. That's why I decided to
  846. 36:41use an effective N, which is the maximum
  847. 36:45between the number of strategies used
  848. 36:48and 10 or 15. You can decide the number.
  849. 36:51So, if my portfolio just have three to
  850. 36:54four strategies, the risk will be kept
  851. 36:57low and just when the portfolio is full,
  852. 37:01the volatility will become the target.
  853. 37:04So, for example, 10%. Before that, I
  854. 37:07will just have a few strategies with
  855. 37:09lower risk, but also lower volatility of
  856. 37:12the portfolio. And this is done to
  857. 37:14protect me against any kind of problem
  858. 37:17regarding the single strategies.
  859. 37:20Another problem is lot rounding. So, the
  860. 37:24more strategies you have, the lower the
  861. 37:27risk per trade per strategy. And this
  862. 37:29means that, especially if you have a
  863. 37:32small account, the lot size will be
  864. 37:35rounded down to the minimum value or
  865. 37:38even become zero. So, all the trades
  866. 37:41will be skipped just because you don't
  867. 37:43have enough capital to trade. And we can
  868. 37:45simulate this, for example, using the
  869. 37:49risk per trade of 0.5%
  870. 37:51a correlation of 0.2, a cost per trade
  871. 37:55of 1,000 euro or dollar, and a stop
  872. 37:59distance of 0.4 ATR. This means that,
  873. 38:02given two accounts, one of 10,000 and
  874. 38:05one of 100,000, with 10 strategies,
  875. 38:08almost 47% of the trades are skipped on
  876. 38:13the smaller account. And with 30
  877. 38:16strategies, all the trades are skipped.
  878. 38:19While for the bigger account, in all
  879. 38:22these situations, no trade is skipped.
  880. 38:25Just because the the account is so
  881. 38:27large, you can trade small and so having
  882. 38:31much more strategies. If I run this with
  883. 38:34a lower risk per trade, also the bigger
  884. 38:38account will start to having problems
  885. 38:40because you're risking so little per
  886. 38:42trade, you have so many strategies, the
  887. 38:45lot size tend to zero. So, you also have
  888. 38:49to balance this problem when deciding
  889. 38:51the number of strategies. Finally,
  890. 38:54defining your target volatility, which
  891. 38:57is the first step you need to do for
  892. 38:59balancing your portfolio. And this
  893. 39:01depends on your situation. So, if it's
  894. 39:05your personal account, it's just
  895. 39:07dependent on your tolerance on drawdowns
  896. 39:10and volatility, while if you're trading
  897. 39:12on a prop firm accounts, this is defined
  898. 39:15clearly by the prop firm rules. So, I
  899. 39:18already made a video on how to estimate
  900. 39:21the probability of passing prop firms
  901. 39:23challenges. I will leave the link in
  902. 39:25description, but in this case, we will
  903. 39:27use a simplified function for simulating
  904. 39:30challenges. And we can see here, for
  905. 39:33example, we are estimating our
  906. 39:35probability of passing a challenge
  907. 39:38having a 10% profit target, 10% loss,
  908. 39:42and 120 days for our time limit. And we
  909. 39:46can see that having a 5% annual
  910. 39:49volatility gives us a 4% probability of
  911. 39:52passing the challenge within 120 days,
  912. 39:56which is 6 months, while having 10%
  913. 40:00increases the probability to 46, and 15%
  914. 40:03increases to 68. But, if you increase
  915. 40:06too much, of course, the probability of
  916. 40:08breaching the max loss or daily loss
  917. 40:11will be also higher, so the probability
  918. 40:14of passing will be lower. So, you need
  919. 40:17to run these simulations given your
  920. 40:20constraints and ultimately defining your
  921. 40:23optimal annual volatility. To recap,
  922. 40:25diversification works, but correlation
  923. 40:28sets the ceiling. So, look for generally
  924. 40:31different strategies. Before weighting
  925. 40:33anything, normalize risk with volatility
  926. 40:35targeting. Equal weight with the
  927. 40:37correlation formula is simple, robust,
  928. 40:39and keeps the portfolio at the target
  929. 40:41volatility. If you want to use an
  930. 40:43optimizer, prove it beats one over n out
  931. 40:45of sample with a walk forward and using
  932. 40:48out of sample strategy returns as input.
  933. 40:51Balance strategy families and
  934. 40:53instruments with buckets decided in
  935. 40:55advance and protect yourself from
  936. 40:57unstable correlations and the practical
  937. 40:59issues of live execution. The notebook
  938. 41:02with the volatility targeting waiting
  939. 41:04formula and portfolio walk forward is on
  940. 41:06GitHub, so I will put the link into
  941. 41:08description. Let me know in the comments
  942. 41:10how you size your strategies, equal
  943. 41:12weight, risk parity, something else. And
  944. 41:15if you found this video useful,
  945. 41:17subscribe and share with your friends so
  946. 41:19I can keep making more videos like this
  947. 41:21one. See you in the next one.

About this transcript

This page contains the full transcript of How to Manage a Portfolio of Trading Strategies (Without Overfitting) by SharpeEdge, generated from the public captions YouTube serves with the video. The transcript has 6,253 words across 947 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 choose a caption track available on the video.

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, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.