Skip to content

The Case of the Mysterious 7th Derivative

August 2, 2009

quote of the day: “Buying stocks used to be about long-term value, doing your research and finding the company that you thought had good prospects. Maybe it had a product that you liked the look of, or perhaps a solid management team. Increasingly such real value is becoming irrelevant. The contest is now between the machines — and they’re playing games with real businesses and real people”— Paul Wilmott

 Speaking of playing games, experimenting with new concepts late night can be lots of fun–it tends to be more unstructured than the serious research that gets done earlier in the day. As a result, sometimes you end up testing things that are just plain wacky, and recently one of these midnight forays brought forth a new treasure.

I call it the “case of the mysterious 7th derivative” because it is actually the 7th 5-day moving average of the 5-day rate of change. The rate of change is today’s close minus the close five days ago.  Essentially you take 7 sequential 5-day moving averages of the 5-day rate of change. Surprisingly, if you BUY after the 7th derivative is greater than zero (and SHORT below zero), performance is strong across a wide variety of stocks, indices, bonds, commodities and even currencies. In fact i was so shocked that i tested our 7th derivative against various benchmarks like 1) the 200-day moving average 2) the 50-day moving average 3) the 50 vs 250 day crossover 4) and the  increasing 200-day moving average. The result: it generally beat all of them–with the odd exception here and there. Robustness like the 7th derivative is pretty hard to find, it is actually more robust than the above mentioned moving average rules.

The problem is, i just don’t understand it. I mean, what is the 7th derivative of the 5-day rate of change? And so it shall remain a mystery to why it works so well. I could provide a mathematical explanation, but as a general rule, if i can’t explain a quantitative strategy to my mother, then i refuse to use it in real life (a funny, but highly useful rule that the banks should learn about). So if any of you out there have any good explanations–i’m all ears! In the meanwhile, if you choose to invest in such a trading strategy, and others join the bandwagon, millions of capital will flow in and out of stocks, moving their stock prices and affecting their capital raising efforts. All of this because you had faith in the 7th derivative! You would be the scorn of the old guard, and Mr. Wilmott (see above quote) would not be impressed.

FYI: the DVI part 2: the DVS should be published on Monday.

6 Comments leave one →
  1. Walter Mundell permalink
    August 7, 2009 2:33 pm

    David,
    I have tested the 7th derivative for the brazilian stock market (Ibovespa, or if you prefer an ETF, EWZ ) and the results were very disappointing for the last 5 years. I can send you the spreadsheet with the calculations if you want.
    Regards, nice blog congratulations,
    Walter Mundell

    • david varadi permalink*
      August 7, 2009 2:44 pm

      walter, first it doesn’t work with 100% reliability across the board, second the fact that it doesn’t work on emerging markets makes sense because they are less susceptible to trader effects–and tend to have strong daily persistence, and therefore the smoothing of ROC adds little value. Try 2nd, 3rd or 4th order smoothing. Nonetheless, the purpose of the blog was to show how it is dangerous to use meaningless indicators. thanks for the kind words.

      dv

  2. jkw permalink
    August 7, 2009 5:33 pm

    Using moving averages reapeatedly gives you a weighted moving average. You get a vaguely triangle shaped weighting. Using the 7th 5 day sma will give you a weighted moving average of the last 29 days, with the value from 15 days ago being the highest weighted. It is possible that you have detected a monthly periodicity in the stock market (the greatest weight is giving to the performance for 1 week following 20 days ago).

    • david varadi permalink*
      August 7, 2009 5:41 pm

      Excellent analysis jkw…….i love it! I never went that deep, as conceptually the idea has less value to use as a trading strategy. If you are correct, than optimally i would design a concept or indicator that takes advantage of that directly.

  3. toptick permalink
    December 7, 2009 12:09 pm

    I’m not sure I would call this the seventh derivative. Seems like that would be the rate-of-change of the rate-of-change seven times.

    A moving average is a kind of low-pass filter, but with a lag of approximately half the period. Recursively adding multiple moving averages as discussed here is like making a seven-pole low-pass filter. The incremental drop off of frequency response (the periods shorter than, or frequencies higher than, 5 days) quickly becomes negligible (42 dB/octave for you audio guys), but the lags add up somewhat linearly.

    Eyeballing a chart of the seventh-order moving average, it appears the 7th average has a shape very similar to the 1st average, but measuring from peaks in the rate of change to peaks in the 7th average shows delays of about two weeks (10 trading days). This is a little less than I expected going down the intutive path I described above. What I think the 7th reveals is an approximately 20-day periodicity in the markets (20 = peak to valley to peak). Raise your hand if you use a 20-day moving average (or Bollinger Band) on any of your charts!

    — Late to the party…

    P.S. This is the kind of thing to ask John Ehlers about (he brought digital signal processing to the trading masses).

    • toptick permalink
      December 7, 2009 12:13 pm

      Oops! I didn’t read jkw’s analysis, which comes to a similar conclusion! Sorry about that.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: