makeOHLCV | R Documentation |
This function makes OHLC-V bars at arbitrary intervals. If the SIZE column is not present in the input, no volume column is created.
makeOHLCV(pData, alignBy = "minutes", alignPeriod = 5, tz = NULL)
pData |
|
alignBy |
character, indicating the time scale in which |
alignPeriod |
positive numeric, indicating the number of periods to aggregate over. For example, to aggregate
based on a 5 minute frequency, set |
tz |
fallback time zone used in case we we are unable to identify the timezone of the data, by default: |
Emil Sjoerup
## Not run:
minuteBars <- makeOHLCV(sampleTDataEurope, alignBy = "minutes", alignPeriod = 1)
# We can use the quantmod package's chartSeries function to plot the ohlcv data
quantmod::chartSeries(minuteBars)
minuteBars <- makeOHLCV(sampleTDataEurope[,], alignBy = "minutes", alignPeriod = 1)
# Again we plot the series with chartSeries
quantmod::chartSeries(minuteBars)
# We can also handle data across multiple days.
fiveMinuteBars <- makeOHLCV(sampleTData)
# Again we plot the series with chartSeries
quantmod::chartSeries(fiveMinuteBars)
# We can use arbitrary alignPeriod, here we choose pi
bars <- makeOHLCV(sampleTDataEurope, alignBy = "seconds", alignPeriod = pi)
# Again we plot the series with chartSeries
quantmod::chartSeries(bars)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.