Vollständiges Transkript von „The Complete Trading Math Roadmap“. Klicke auf einen Zeitstempel, um das Video an dieser Stelle zu öffnen. Du brauchst ein anderes Video? Nutze den YouTube-Transkript-Generator.
0:00 The math needed for trading. If you want to become a trader, there are four essential areas of math you need to understand. Trading is all about using data to find an edge, whether you're backtesting strategies, building algorithms, or running a systematic approach, >> [music] >> math is what ties it all together. You don't need a PhD, but you do need to know the right concepts in the right order. Most traders completely skip this entirely and wonder why their strategies don't work and why they don't make money. This is actually the foundation of what firms like Renaissance Technologies built on top of. The founder, Jim Simons, if you don't know him by the way, his flagship fund averaged 66% annual returns before fees over 30 years. It's the best track record in history. He and his team obviously took things way further, but the building blocks are what I'm about to walk you through. So, I've put together the complete road map of the
0:46 exact math concepts I use across all my trading over the past 6 years and in my 10 algorithms that now manage multi-six figures. So, let's get straight into it. Well, there are four areas I'm going to cover in this video. One is statistics and probability, two is linear algebra, three is time series analysis, and four is risk management. Now first, let's go over statistics and probability. This is the foundation of extracting signal from noise. Every price move is a combination of signal and randomness. Statistics give you a tool to help separate the two. Now number one is sample size and the law of large numbers. The bigger your sample, the closer your results get to true expectations. E.g., this means if you have more trades, you have a more accurate backtest. For example, if you have a backtest that has only 10 trades and all 10 of those are winners, that
1:32 isn't impressive. It's just not enough data overall. You need years of data and hundreds of trades, probably even thousands, to get true expectations for that particular strategy. Plus, ideally you'd want it to be out of sample, meaning it's not the same data you used to optimize over. Now number two is central tendency. So, these are things like mean, median, mode, and even actually expected value. Now mean you'll often use for things like moving average. They're primarily just a rolling mean. Median, now these are actually better to use in trading because they are often a more accurate measure when outliers exist. And in trading there are a lot of outliers. For example, you could have nine small losses and one black swan. The median is going to show you a more typical outcome compared to the average which is going to overall extend to the outlier a bit more. So, especially if you're doing, for example, you know, the average open to high kind of percentage move, if you
2:19 use the average, that's going to be a lot less accurate than using the median. Next is mode. This is the most frequent value and it's really rarely used in trading or like, you know, you know, price data and stuff, but occasionally it can be useful for price clustering around round numbers, for example. And then of course, you have expected value. I actually have a think I have a whole video on expected value, but here's just kind of the basic formula for it. Next is variance and standard deviation. Variance is the average of the squared differences from the mean. Overall, it's the mathematical foundation of risk, which we'll also get into a bit more. For the most part, you know, standard deviation of returns equals volatility. So, every position sizing formula and risk metric normally uses a variation of this form. Next is correlation. Now you have covariance, which is the raw measure of how two variables co-move, and then you have correlation, which is a standardized covariance from minus one to plus one. As you can kind of see
3:04 here, you have minus one which would be opposite, they're moving different ways, and you have plus one which would mean they're moving completely the same. If it's zero, there's kind of no relation between them. This overall tells you if your strategies are actually independent. For example, if you have three momentum strategies on correlated assets, you could actually have three times the size, but not three times the diversification as you expected by having three different strategies. If you measured it and you had correlation, for example, of 0.9, you basically have just one strategy now trading three times, so that means you have three times the size. Whereas if you have 0.2 correlation, now you actually have some kind of real diversification. They're not all trending together. They trend a bit together at 0.2, but overall you've got a bit of no relation to each other. Next is probability distributions. Different types of randomness follow different patterns. Now most models, at least in trading in the beginning, assumed normality, but real returns are
3:50 actually heavy-tailed and normal kind of models like these Gaussian approximations normally underestimate crashes that happen on both either sides. Then you have binomial, which is just win or lose, up or down on the day, but primarily it's just like binary, basically. Then you have uniform, everything is equally likely. It can be useful as a baseline when you have no information, but overall you want to know which distribution fits your data and what you'll use. Next is central limit theorem. This is the average of many random variables approaching normal regardless of the underlying distribution. For example, portfolio returns can be more normal than individual stocks, and average of 100 trades is going to be more predictable than one particular trade. This justifies normal base statistics in most messy data. Then you have conditional probability. So, this is the probability of X given Y. For example, markets have
4:35 regimes, so, you know, if you have a probability on a particular strategy that it wins 55% of the time, you could then see, you know, what is the probability when VIX is above 30 or when VIX is below 15. Understanding conditional probabilities lets you filter for favorable conditions. Next you've got Bayes' theorem, which is primarily where you've got a prior belief plus new evidence means updated belief. This is how you update your probabilities when new info arrives. For example, you think a stock has a 6% chance of going up, earnings beat expectations, what's the new probability now? It's critical for adaptive and regime-based strategies. Next is maximum likelihood estimation. You pick the premises that make your observed data more likely. This is why we minimize squared error in regressions. It's the MLE solution under Gaussian noise, and understanding MLE kind of explains why loss functions are designed the way they
5:20 are. Lastly, you've got regression models. The most popular ones are obviously linear regressions where you fit a line to the data. These often used in mean reversion, predicting values, finding relationships. Then you've got logistic regression. This predict binary outcomes, up and down day predictions, win and loss probability. Both are the building blocks for way more complex models, but you should probably get at least aware of some of these regression models. Now I actually teach a lot of this and how to apply it in trading with code examples and in backtesting particular strategies as well in the backtesting bootcamp. If you want to go deeper on the statistics and actually implement it, plus learn more around algorithmic trading, click the first link in the description. >> [snorts] >> Now two, linear algebra. This is the math of portfolios for the most part. Once you're trading multiple positions or running multiple strategies, you're doing linear algebra. This starts with scalars, vectors, and matrices. For
6:06 example, a scalar is just going to be one day's return for one stock. A vector is going to be a combination. It could be multiple returns on 10 different stocks for that one particular day, or it could be a portfolio, for example, on different stocks. And then you have a matrix, which is going to normally be for risk calculations. If you want to think about it this way, your portfolio is a weighted sum of vectors, whereas your risk calculation is a matrix multiplication. Next you've got matrix operations. The main ones are going to be addition, so this is where you combine signals or returns. Next you have multiplication, which apply weights to positions, and then you've got transpose, which flip rows and columns, needed for many calculations as well. A very easy example of this is portfolio return, which is going to be a weighted vector all times a return vector. Next you've got eigenvalues and eigenvectors. This reveal primarily directions of your data. Which factors actually drive your portfolio, for example? How many independent sources of returns do you
6:53 have? What is your true diversification? It's used in a lot of risk modeling and portfolio optimization. Next you've got PCA and decomposition. Now two main versions of this is going to be SVD, which is a break a matrix into simpler components, and you've got PCA, which is finding the most important patterns in data. For example, you could have 50 noisy indicators, you then run it through PCA, and you get five independent factors. Most of time they'll help you explain stuff. So, for example, out of this it will explain 90% of the variations with far less noise, and then you can trade five independent signals instead of 50 noisy ones. Now next is time series analysis. Markets have memory and actually have structure. Today's prices depend on yesterday's, volatility clusters, you've got trend persists, and time series analysis model these dependencies. Now the first one is stationary. A time
7:38 series is stationary if its statistical properties stay consistent over time. Most tests assume Most tests assume stationary. The problem is markets aren't stationary at all. Volatility changes, correlations shift, market structure evolves. This is often why strategies decay. You have a regime shift and your model assumes it hasn't. Next you've got autocorrelation. How much does today's value depend on yesterday's, for example? Positive correlation would equal momentum, negative correlation would mean mean reversion, and zero correlation would mean it's a random walk. Next you've got autoregressive integrated moving averages. This is primarily broken down into AR, which is going to be today's depend on previous days, I, which account for trends, and A, which which means today's depend on previous errors. This is often used for forecasting returns, volatility, or any variable that evolves over time. Next you've got GARCH models. These are kind of like a
8:24 fancy name for volatility clusters and changes over time. After a big move, for example, expect more volatility. After a calm period, expect continued calm. And if you're sizing positions based on recent volatility, which you normally should be, GARCH kind of formalizes this in that structure. Next you've got cointegration. This is where two assets can both be non-stationary, meaning, for example, they could be trending, but their difference stationary. An easy way to think about this is that say we have two stocks that are trending upwards as we can see here from stock A that's $50 going to 150 and stock B from $45 going to 135. But the actual spread between these two stocks stays stationary, meaning it's always been a $5 spread. This is overall the foundation of pairs trading. You're not necessarily betting on a direction, you're betting that the spread returns to normal based on that kind of stationary spread. Next you've got risk management math.
9:10 This is how not to blow up, which is obviously very important in trading. Edge doesn't really matter if you size completely wrong. Now first you've got value at risk. This is the maximum expected loss at any given confidence level. For example, 95% VaR equals a $5,000 loss means 95% of the time you won't lose more than $5,000, but 5% of the time you might lose more, possibly much more. Next you've got a classic, which is the Sharpe ratio. Sharpe ratio is just return minus risk-free rate divided by volatility. How much return basically are you getting per unit of risk you're inputting? So, if you get the same return, but with low volatility, that equals a higher Sharpe, which means it's overall better. Next you've got maximum drawdown. This is the biggest peak-to-trough loss. It's often more intuitive than volatility for most people. The most critical question from this, can you mentally actually handle the maximum drawdown? Especially a lot
9:56 of times in in live trading, you can have a maximum drawdown that actually exceeds that in live. Next is Monte Carlo simulations. I actually have a whole video on this particular test, but primarily what it does is your standalone backtest is just one sequence of trades. What Monte Carlo simulations do is it takes that sequence of trades and completely reorder reorders them and then randomizes them, which can let you have thousands of randomized simulations and can show the range of possible outcomes that could have happened. And this is important cuz maybe your backtest got lucky with that trade sequencing and maybe the worst drawdown actually hasn't happened yet and what to expect for that. Now this overall has been a roadmap on all the different parts that is needed for trading if you want to continue advancing. But obviously each one of these topics can be quite dense and quite complicated. So here's some books and resources I'd recommend if you are interested. Now number one for most basic and beginner
10:41 stuff is quantitative trading by Ernest Chan. For example, this would be how to build your own algorithmic trading business book. Next you got algorithmic trading also by Ernest Chan and here's winning strategies and their rationale. He goes a bit more in-depth with some maths kind of related to the strategies as well. So it's a great book to pick up. Another one that I probably actually remember to put on here is Systematic Trading by Robert Carver. Another great kind of beginner book that also includes a lot of beginner math. Now if you're starting to get more into the complex parts of math, I would recommend time series analysis by Hamilton. It's really the definite ref- reference. It is quite dense, but it is comprehensive. Then you also have analysis of financial time series um and this one I specifically recommend especially as a lot of trading is going to be around time series. Then next you have Mathematics of Money Management. This is a classic text on position sizing. Overall it's not that
11:26 complicated. Most of the time I'd actually say you could probably chat with you know an AI for example and it will get a lot of it correct. Um but it is a great book if you are more of a fan of reading something structured. Lastly, we've got Testing and Tuning Market Trading Systems by Timothy Masters. Highly recommend this book. It's also very mathy. So um if you are looking to go more in-depth with a lot of this maths plus on how it relates to backtesting, then I would I would definitely recommend that book. Now what do you actually need to start? Cuz I know this video can be overwhelming. The whole purpose of this is to plan out a whole roadmap for you so you can understand all the different parts of maths you can eventually get to, but you don't need to know it all at the start. What I would recommend the minimum at least to start backtesting strategies and things like that is going to often be mean, median, standard deviation, correlation, basic probability theory, Sharpe ratio and maximum drawdown understanding. Primarily you're just starting with the statistics. This alone
12:13 is going to separate you from a lot of newcomers because some of the statistics I see on Twitter and other things like that where people don't understand basic statistics in trading is quite shocking and a lot of the time even if you're not going to be creating some complex algorithm I like I personally don't, you really need to understand the basics of statistics and then a couple of layers above that so you can understand what risks you're taking on in trading. A lot of times people don't understand the math, which means they can't actually calculate for the risk correctly. I hope this was useful and thanks for watching.