Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Calculus and the Stock Market

  1. Aug 18, 2010 #1
    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?
    Last edited: Aug 18, 2010
  2. jcsd
  3. Aug 18, 2010 #2


    User Avatar
    Staff Emeritus
    Gold Member

    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.
  4. Aug 19, 2010 #3
    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.
  5. Aug 19, 2010 #4


    User Avatar
    Staff Emeritus
    Gold Member

    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.
  6. Aug 19, 2010 #5
    Very, very interesting post! That puts everything into perspective. If things are that complex, do people really make money trading stocks day to day?
  7. Aug 21, 2010 #6
    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.
  8. Aug 21, 2010 #7
    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?
  9. Aug 21, 2010 #8
    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.
  10. Aug 21, 2010 #9
    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?
  11. Aug 22, 2010 #10


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    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 :bugeye: ).

    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).
  12. Aug 22, 2010 #11
    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.
  13. Aug 22, 2010 #12
    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.
  14. Aug 22, 2010 #13
    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.
  15. Aug 22, 2010 #14
    OK, but how does your broker know about the entry points? Who does he consult? What makes him/her "qualified"?
  16. Aug 22, 2010 #15
    Creating a profitable trading model is a challenging math problem, yet it has many acceptable solutions.
  17. Aug 22, 2010 #16
    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.
  18. Aug 22, 2010 #17
    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
  19. Aug 22, 2010 #18
    As for trying to use calculus to predict the future value of the company why not look at the return on investment capital, and the portion earnings that are reinvested into the company.

    To go a step further and look at the beta, this should give some sense on how market swings effect the company. Knowing beta and market volatility perhaps some measure of risk could be estimated which could be used to determine an estimate for the risk premium so that the price to earnings could be compared to the interest rate.
  20. Aug 22, 2010 #19
    To answer the first part, that relates to valuation of the company, but that does equate into market price.

    And yes, that is exactly how valuations are done. The issue with this is that a retail investor has to rely on the analysts for this, because they given guidance by the company. Using historical data does not work for future valuations. Though the macroeconomic data, which is part of this process, is available.

    The goal of the retail investor is to buy low, and sell high. Right now there are tons of undervalued companies, sell at a 40% discount to book value. The issue is that wall street drives the market price, and wall street is all about momenteum (sp).

    Your second point is actually the issue. In today's global economy what is the risk free interest rate? 0% or 1% as Treasuries are trading? Or is it the German rate? Or for the average investor, the 2 year CD rate, which is insured?

    And market volatility, is a one year sampling accurate? Or is a average of 20, 100, and 200 day average volatility correct?

    I spend alot of time on your last point. And the volatility rate is a key, and the one year rate that is used in models is not accurate.
  21. Aug 22, 2010 #20
    Part of me says if the company pays enough dividends (now or in the future) then why does it matter but I guess there are a few possibilities for the under evaulations based on the book value:

    -The book value is wrong
    -People expect more deflation or a double dip
    -The markets are irrational (not efficient)
    -People don't have the money to invest
    -The money is chasing what they think are better opportunities/bubbles (emerging markets)

    Who's buying the treasuries anyway? Is it small scale investors or is it people who can borrow cheap on the short term (such as banks) though deposits.

    Are government securities (treasuries) assigned zero risk to the banks under bis calculations regardless of their term even though their value can change significantly if the interest rate changes. Cash equivalents are considered to have terms of three months or less see:

    However, if the bank can borrow cheaper though deposits then long term yields perhaps it doesn't matter and their is minimal risk.

    For instance the passbook savings rate has been under 4% since 1991 but has averaged around 2%.


    while the 20 year yield is close to 4% so the bank can be expected to make 2% on this. The reserve requirements in the us are 10% so if we assume all the money is deposted back into the bank the bank could make 10x2% on each dollar M1 is increased by. However, because people hold some cash I believe the multiplier is only about 2 (I'll try and track down my reference). So perhaps to a bank, the risk free rate of return is around 2% for long term investments.

    I think that volatility is different on different time scales. Additionally statical error in volatility calculations should be included when estimate risks. One could try and characterize the volatility with some kind of noise model (arma in the discrete case) and do either monty carlo simulations or use quazil linear kalman filter methods (linearization via statistical describing functions) in order to estimate the means and standard deviations in our predictions. Because the past cannot be completely relied on for future earnings and returns on capital, a random walk component could be added to the return on capital in the noise model to try and account for future uncertainties.
    Last edited: Aug 22, 2010
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Discussions: Calculus and the Stock Market
  1. Stock market explosion (Replies: 7)

  2. Invest In Stock Market (Replies: 20)