ichimoku | R Documentation |
Create an ichimoku object containing values for all components of the Ichimoku Kinko Hyo cloud chart. The object encapsulates a date-time index, OHLC pricing data, candle direction, the cloud lines Tenkan-sen, Kijun-sen, Senkou span A, Senkou span B and Chikou span, as well as values for the cloud top and cloud base.
ichimoku(x, ticker, periods = c(9L, 26L, 52L), keep.data = FALSE, ...)
## S3 method for class 'ichimoku'
ichimoku(x, ticker, periods = c(9L, 26L, 52L), keep.data = FALSE, ...)
## S3 method for class 'xts'
ichimoku(x, ticker, periods = c(9L, 26L, 52L), keep.data = FALSE, ...)
## S3 method for class 'data.frame'
ichimoku(x, ticker, periods = c(9L, 26L, 52L), keep.data = FALSE, ...)
## S3 method for class 'matrix'
ichimoku(x, ticker, periods = c(9L, 26L, 52L), keep.data = FALSE, ...)
## Default S3 method:
ichimoku(x, ticker, periods = c(9L, 26L, 52L), keep.data = FALSE, ...)
x |
a data.frame or other compatible object, which includes xts, data.table, tibble, and matrix. |
ticker |
(optional) specify a ticker to identify the instrument, otherwise this is set to the name of the input object. |
periods |
[default c(9L, 26L, 52L)] a vector defining the length of periods used for the cloud. This parameter shoud not normally be modified as using other values would be invalid in the context of traditional ichimoku analysis. |
keep.data |
[default FALSE] set to TRUE to retain additional data present in the input object as additional columns and/or attributes. |
... |
additional arguments, for instance ‘holidays’, passed along
to |
Calling an ichimoku object automatically invokes its print method, which by default produces a printout of the data to the console as well as a plot of the cloud chart to the graphical device.
For further options, use plot()
on the returned ichimoku object to
pass further arguments for customising the chart. Use iplot()
for
interactive charting.
Where an ichimoku object is passed to ichimoku()
, the ichimoku
object is re-calculated using the OHLC pricing data contained within.
An ichimoku object with S3 classes of ‘ichimoku’, ‘xts’ and ‘zoo’.
Index:
index(object)
: date-time index [POSIXct]
Columns [numeric]:
object$open
: opening price
$high
: high price
$low
: low price
$close
: closing price
$cd
: candle direction (-1 = down, 0 = flat, 1 = up)
$tenkan
: Tenkan-sen
$kijun
: Kijun-sen
$senkouA
: Senkou span A
$senkouB
: Senkou span B
$chikou
: Chikou span
$cloudT
: cloud Top (max of senkouA, senkouB)
$cloudB
: cloud Base (min of senkouA, senkouB)
Attributes:
attributes(object)$periods
: parameters used to calculate
the cloud [integer vector of length 3]
$periodicity
: periodicity of the data in seconds
[numeric]
$ticker
: instrument identifier [character]
ichimoku()
requires OHLC (or else HLC) price data as input to
calculate the cloud chart values.
If only single series price data is supplied, a pseudo OHLC series is generated and a pseudo cloud chart is returned.
A faster technical utility version of this function is available in
.ichimoku
for use when the data is already in the required
format.
Please refer to the reference vignette by calling:
vignette("reference", package = "ichimoku")
TKR <- sample_ohlc_data
cloud <- ichimoku(TKR)
cloud
kumo <- ichimoku(TKR, ticker = "TKR Co.", periods = c(9, 26, 52), keep.data = TRUE)
summary(kumo)
print(kumo, plot = FALSE, rows = 10)
plot(kumo, theme = "solarized", type = "bar", custom = "volume")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.