Ernie Stokely wizardchef at gmail.com
Wed Apr 13 18:16:47 CEST 2016

```After looking into this issue further I wanted to post my
understandings, which hopefully are correct and will help others with
similar questions. The equations I had in my original post are in fact
C, will always equal each other. But, when use.Adjusted = FALSE is used
rather than using Yahoo's adjusted C. It then uses that adjusted C value
to modify/adjust the values of O, H, L, and C. The modified/adjusted C
value in this case may or may not match the calculated adjusted C value
due to historic splits and dividends, and the adjusted C value from
adjustOHLC() and Yahoo don't always match (maybe rarely as Brian says
below ... have not done an exhaustive test).

The difference between the two use.Adjusted settings seems to come from
how Yahoo is calculating its adjusted C. Depending on whether one should
use use.Adjusted = TRUE or FALSE seems depend on how one will use the

I trust the adjustOHLC() values because the equations are more
transparent than Yahoo's and it grabs all splits and dividends back to
1900 and applies them where pertinent. I've read a number of posts on
stackoverflow and on this SIG and also looked at the adjustOHLC() code
to come to these conclusions.

Thanks to Brian and Josh for their input. If I have misunderstood please
correct this post.

Ernie

> Brian G. Peterson <mailto:brian at braverock.com>
> April 12, 2016 at 4:09 AM
> ever, agree, since we don't know when they are starting the
> adjustment, or how they are doing the adjustment.  There are many
> Google can locate for you.
>
> Nevertheless ...
>
> What 'most of the references' are those?
>
> Your equation doesn't subtract dividends or apply splits to arrive at
> the new ratio, and is not a continuous-time process.  (as such, it
> cannot be correct) The ratio changes over time based on the
> accumulation of splits and dividends.
>
> We can easily reference the code, by typing
>
>
> at the prompt, or you could produce an equation which actually
> includes the splits and dividends for which we must adjust ...
>
> I suggest that in addition to the code we use a slightly more
> authoritative source than Yahoo, e.g. CRSP:
>
> http://www.crsp.com/products/documentation/crsp-calculations
>
> From my read of the code, this is what adjustOHLC is doing.
>
> I believe that your error is in not realizing that the ratio changes
> over time.
>
> Brian
>
>
>
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R
> questions should go.
> Ernie Stokely <mailto:wizardchef at gmail.com>
> April 11, 2016 at 8:48 PM
> OK, I am prepared for the stones that will be thrown at me for being
> naive, but here goes anyway.
>
> Most of the references on adjusting OHLC values for splits and
> dividends say to use the following adjustment:
>
> K = Ca/C
> Om = K * O
> Hm = K * H
> Lm = K * L
> Cm = K * C = Ca
>
> where: Ca = adjusted close, OHLC are the unadjusted values, and
> OmHmLmCm are the modified (adjusted) values of OHLC.
>
> If I use adjustOHLC() in quantmod to do the adjustment I find these
> are not the equations being used. For example, for VTI here is the
>
> VTI.Open VTI.High VTI.Low VTI.Close VTI.Volume VTI.Adjusted
> 2006-03-01 128.15 128.90 127.79 128.70 216400 52.56795
> 2006-03-02 128.50 128.76 128.01 128.61 148800 52.53119
> 2006-03-03 128.26 129.43 128.20 128.40 323200 52.44541
> 2006-03-06 128.64 128.64 127.27 127.46 279800 52.06147
> 2006-03-07 127.15 127.31 126.65 126.94 218400 51.84907
> 2006-03-08 126.72 127.49 126.20 127.30 491800 51.99612
>
> If I apply adjustOHLC() to these data I get:
>
> VTI.Open VTI.High VTI.Low VTI.Close VTI.Volume VTI.Adjusted
> 2006-03-01 59.15007 59.49625 58.98391 59.40394 216400 52.56795
> 2006-03-02 59.31162 59.43163 59.08545 59.36240 148800 52.53119
> 2006-03-03 59.20084 59.74088 59.17315 59.26546 323200 52.44541
> 2006-03-06 59.37624 59.37624 58.74389 58.83159 279800 52.06147
> 2006-03-07 58.68851 58.76235 58.45772 58.59158 218400 51.84907
> 2006-03-08 58.49003 58.84544 58.25001 58.75774 491800 51.99612
>
> Obviously, VTI.Adjusted (Ca) is not equal to VTI.Close (Cm) as
> required by the formula above. I have a colleague who has been trading
> for 40 years and he says this is an erroneous result (that Cm must
> equal Ca). When I explore the package reference file for adjustOHLC()
> I see this paragraph:
>
> "New columns are derived by taking the ratio of adjusted value to
> original Close, and multiplying by the difference of the respective
> column and the original Close. This is then added to the modified
> Close column to arrive at the remaining ‘adjusted’ Open, High, Low
> column values."
>
> I am not quite sure how to translate this verbal description into an
> equation, but it doesn't sound like the same correction I see
> recommended elsewhere and described at the beginning of this note.
>
> Can someone shed some light on this discrepancy or send me a link to
> more enlightenment? Thanks in advance.
>
> Ernie
>
>

[[alternative HTML version deleted]]

```