diffohlc | R Documentation |
Calculate the reduced form of an OHLC time series, or calculate the standard form from the reduced form of an OHLC time series.
diffohlc(ohlc, reducit = TRUE, ...)
ohlc |
An OHLC time series of prices in xts format. |
reducit |
A Boolean argument: should the reduced form be
calculated or the standard form? (the default is |
... |
Additional arguments to function |
The reduced form of an OHLC time series is obtained by calculating the time differences of its Close prices, and by calculating the differences between its Open, High, and Low prices minus the Close prices. The standard form is the original OHLC time series, and can be calculated from its reduced form by reversing those operations.
An OHLC time series with five columns for the Open, High, Low, Close prices, and the Volume, and with the same time index as the input series.
# Calculate reduced form of an OHLC time series
diffVTI <- rutils::diffohlc(rutils::etfenv$VTI)
# Calculate standard form of an OHLC time series
VTI <- rutils::diffohlc(diffVTI, reducit=FALSE)
identical(VTI, rutils::etfenv$VTI[, 1:5])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.