[R-SIG-Finance] adjustOHLC.R issues

Ernie Stokely wizardchef at gmail.com
Tue Apr 12 03:48:09 CEST 2016


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 
unadjusted OHLCadjC data read from Yahoo:

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



More information about the R-SIG-Finance mailing list