## Calculus and the Stock Market

Consider this possibility: A person wishes to follow stock prices (or commodity prices), and buy or sell securities according to market trends and condition throughout the day/week/month. Can calculus be used to follow the trend?
 Recognitions: Gold Member Staff Emeritus Derivatives whose value depends upon stocks or commodities can be valued in many ways, but the classic first method of valuing a derivative was the Black-Scholes formula for valuing European-style call and put options, which is the solution to a partial differential equation. It's been modified in various ways to deal with America-style options or options on stocks that pay dividends, etc. I know the field has come a long way since then and is well beyond the Black-Scholes formula at this point, but to be honest, I don't know that much about it. Financial engineering and quantitative finance programs in graduate schools tend to teach stochastic calculus and econometric methods as the primary means of using math to value the crazy new creations they concoct to make money off of price movement. If you're really just talking about trying to predict future movements in stock prices by following trend lines, though, that's called technical analysis and technical analysts have all kinds of weird voodoo rules regarding what to expect based upon wave oscillations and fractal geometry and what-not, but they're generally the outcasts of the finance world and their craft is considered more like numerology than science. They also tend to have a pretty bad track record.

 Quote by loseyourname Derivatives whose value depends upon stocks or commodities can be valued in many ways, but the classic first method of valuing a derivative was the Black-Scholes formula for valuing European-style call and put options, which is the solution to a partial differential equation. It's been modified in various ways to deal with America-style options or options on stocks that pay dividends, etc. I know the field has come a long way since then and is well beyond the Black-Scholes formula at this point, but to be honest, I don't know that much about it. Financial engineering and quantitative finance programs in graduate schools tend to teach stochastic calculus and econometric methods as the primary means of using math to value the crazy new creations they concoct to make money off of price movement. If you're really just talking about trying to predict future movements in stock prices by following trend lines, though, that's called technical analysis and technical analysts have all kinds of weird voodoo rules regarding what to expect based upon wave oscillations and fractal geometry and what-not, but they're generally the outcasts of the finance world and their craft is considered more like numerology than science. They also tend to have a pretty bad track record.
Thank you for the reply, that's very interesting. I understand that technical analysis is a "pseudoscience", I was thinking more along the lines of whether or not a daily price chart would be differentiable and if you could somehow use first and second derrivatives to track whether prices are "speeding up" or "slowing down" (inflection points), and executing buy and sell orders accordingly.

Recognitions:
Gold Member
Staff Emeritus

## Calculus and the Stock Market

You'd probably have to do that graphically. I can't imagine what kind of a function would actually map neatly onto a line chart of price fluctuations, though you could always attempt to derive a regression curve of price against time. Again though, with the number of ups and down in a given day, you could be looking at a 500th order polynomial or something defining the function, with hundreds of inflection points.

In practice, if you're looking for a way to place limit orders that don't get triggered by short-term random fluctuation, you'd just place it outside of whatever you project short-term price variability to be based on historical patterns. That way you'd generate a simple range rather than a function. For instance, if you know from past data that a security price has an average daily standard variation of 10% of its price or something like that, place a stop-loss at 15% or whatever margin of safety you want to avoid being triggered by expected fluctuation.

 Quote by loseyourname You'd probably have to do that graphically. I can't imagine what kind of a function would actually map neatly onto a line chart of price fluctuations, though you could always attempt to derive a regression curve of price against time. Again though, with the number of ups and down in a given day, you could be looking at a 500th order polynomial or something defining the function, with hundreds of inflection points. In practice, if you're looking for a way to place limit orders that don't get triggered by short-term random fluctuation, you'd just place it outside of whatever you project short-term price variability to be based on historical patterns. That way you'd generate a simple range rather than a function. For instance, if you know from past data that a security price has an average daily standard variation of 10% of its price or something like that, place a stop-loss at 15% or whatever margin of safety you want to avoid being triggered by expected fluctuation.
Very, very interesting post! That puts everything into perspective. If things are that complex, do people really make money trading stocks day to day?
 Actually, the stock market and other markets are easier to analyze using time series analysis in several time scales simultaneously. And, yes, people do make money in the stock market, and other markets. In my personal experience, FX is the most predictable one.

 Quote by wavefunc Actually, the stock market and other markets are easier to analyze using time series analysis in several time scales simultaneously. And, yes, people do make money in the stock market, and other markets. In my personal experience, FX is the most predictable one.
Thanks for replying. I'm interested in getting involved as I do have some risk capital available. Is the time series used to track daily trends, and then jump as trends increase?
 You are most welcome. In reality, it is a lot more complicated than you have just suggested. Typically, our model monitors 5 time scales around the clock to determine its entry/exit prices.
 Thanks! What would be the best way for a beginner to learn to take moving averages of, say stock prices throughout the day and determine when to enter?

Recognitions:
Gold Member
Staff Emeritus
 Quote by Mgt3 Thank you for the reply, that's very interesting. I understand that technical analysis is a "pseudoscience", I was thinking more along the lines of whether or not a daily price chart would be differentiable and if you could somehow use first and second derrivatives to track whether prices are "speeding up" or "slowing down" (inflection points), and executing buy and sell orders accordingly.
In as far as I see most simple models of stock market motion, one of the hypotheses that goes in all of these models is "market equilibrium" which means that "all the available information is in the current price". This means that the expectation value of the "next future price" is simply the current price ; in other words, the stochastic description of the stock value is a martingale. If you accept this hypothesis, it is strictly impossible to predict the expectation of future movements based on past movements better than to say "it will stay at its current value".
Another way of saying this is that most market models take on the "no arbitrage" hypothesis.

This can eventually not be the case ; if you are a fine market expert, you might know in advance how certain assets might move based upon information that is "not yet in the price" (in other words, that most traders ignore, or ignore how to use, and for which you are the world's only expert, or almost - or because you have inside information ).

Of course you CAN make money on the stock market. If you are willing to take a risk, you should be (on AVERAGE) rewarded for that with a risk premium. Normally, stock with large volatility (large fluctuations) will also grow faster (or crash...). But there's no magic formula that allows you to predict future trends beyond that, for a particular course. The reason is simple: if that formula existed, traders around the world would use it, until the gain margin (the arbitrage) would be small again, which comes exactly down to the statement that the current price already reflects the future expectation (diminished with riskless bond growth).

 Quote by Mgt3 Thanks! What would be the best way for a beginner to learn to take moving averages of, say stock prices throughout the day and determine when to enter?
A simple moving average is extremely easy to calculate, and most financial web sites have the tools to generate these for you automatically. For example, a 5-day SMA is the average closing price for the 5 most recent trading days, and is either higher or lower than the current closing price (which leads to the statement, "this stock is currently trading over its 5-day moving average"). However, this is a lagging indicator, and I strongly dissuade its use for determining "entry points" for stock purchases. A moving average is used only to smooth out price fluctuations over relevant terms for data clarity, not to predict market values or price changes.

You should consult with a qualified broker before buying or selling any securities.
 I spend alot of time playing with this, mainly because there are a wide range of theories that are flawed, yet being applied daily. And second, I am a disabled vet who has nothing better to do and applied math helps with the nerve damage. As someone pointed out, using dialy pricing is flawed for one fundamental reason: they are discrete data points in a large set of daily pricing data. Applying these discrete points to a continous function is not sound. Especially in this age of instantanous global trading. Think about it, who cares about the price of a stock at 4 pm in New York if it is continously traded in exchanges all over the globe. Just because the retail investor is limited in access does not mean your average wall street firm is not arbitraging 24 hours a day. Add to the mix the endless derivatives and synthetic positions availabe for each stock. The stock price and volume are almost meaningless if you do not consider the activity and pricing of all positions available for a stock. The problem is that most of the theories are based on research and theories formed in the 60's,70's and 80's. Hardly the global realtime markets that we have today. Everything from portfolio theory to risk artbitrage in the public domain is dated. I doubt the trading systems on wall street use these equations. Personally I am experimenting with game theory. I have been distracted this summer by my academic studies, but it is interesting.
 One experiment. Plot the daily price range as a normal distribution. Do it for a 10, 20 and 40 day range. Do it for a few stocks that are actively traded.

 Quote by talk2glenn A simple moving average is extremely easy to calculate, and most financial web sites have the tools to generate these for you automatically. For example, a 5-day SMA is the average closing price for the 5 most recent trading days, and is either higher or lower than the current closing price (which leads to the statement, "this stock is currently trading over its 5-day moving average"). However, this is a lagging indicator, and I strongly dissuade its use for determining "entry points" for stock purchases. A moving average is used only to smooth out price fluctuations over relevant terms for data clarity, not to predict market values or price changes. You should consult with a qualified broker before buying or selling any securities.
OK, but how does your broker know about the entry points? Who does he consult? What makes him/her "qualified"?

 Quote by airborne18 I spend alot of time playing with this, mainly because there are a wide range of theories that are flawed, yet being applied daily. And second, I am a disabled vet who has nothing better to do and applied math helps with the nerve damage. As someone pointed out, using dialy pricing is flawed for one fundamental reason: they are discrete data points in a large set of daily pricing data. Applying these discrete points to a continous function is not sound. Especially in this age of instantanous global trading. Think about it, who cares about the price of a stock at 4 pm in New York if it is continously traded in exchanges all over the globe. Just because the retail investor is limited in access does not mean your average wall street firm is not arbitraging 24 hours a day. Add to the mix the endless derivatives and synthetic positions availabe for each stock. The stock price and volume are almost meaningless if you do not consider the activity and pricing of all positions available for a stock. The problem is that most of the theories are based on research and theories formed in the 60's,70's and 80's. Hardly the global realtime markets that we have today. Everything from portfolio theory to risk artbitrage in the public domain is dated. I doubt the trading systems on wall street use these equations. Personally I am experimenting with game theory. I have been distracted this summer by my academic studies, but it is interesting.
Creating a profitable trading model is a challenging math problem, yet it has many acceptable solutions.

 Quote by Mgt3 Thanks! What would be the best way for a beginner to learn to take moving averages of, say stock prices throughout the day and determine when to enter?
Financial markets are merciless to a beginner. Save your risk capital, or let a professional fund manager work with it. Make sure the manager has a good track record. Do not go to brokers.
 I posted to this,, hmm didn't show up.. oh well. The issue with most models is that they do not factor in commission and fees. Which is not an issue for wall street, but is a big factor for the retail investor. I do day trade. Try buying DIA ( DJIA etf ) and writing options.. an easy 2-3% a month