Skip to contents

The hikakke_mod() is a generic S3 function that builds upon 'type-safe'-esque workflows limited to classes in in base R, and the package-wide dependencies. Ie. class in, class out. Each method is a soft wrapper of model.frame and therefore the OHLC-V series must be coercible to a data.frame.

Usage

hikakke_mod(x, cols, ...)

Arguments

x

An OHLC-V series that is coercible to data.frame.

cols

(formula). An optional 4 variable formula passed into model.frame. Internally uses ~open + high + low + close by default.

...

Additional parameters passed into model.frame

Value

An object of same class and length of x:

CDLHIKKAKEMOD

integer

Pattern codes depend on options(talib.normalize):

  • If TRUE: 1 = identified pattern; -1 = identified bearish pattern.

  • If FALSE: 100 = identified pattern; -100 = identified bearish pattern.

  • 0 = no pattern.

Details

General options for candlestick pattern recognition:

N

integer. Controls the number of candles to consider when identifying patterns.

alpha

double. A sensitivity parameter when identifying patterns.

Available options and their defaults:

BodyLong

(N = 10, alpha = 1.0). Real body is long when it's longer than the average of the 10 previous candles' real body.

BodyVeryLong

(N = 10, alpha = 3.0). Real body is very long when it's longer than 3 times the average of the 10 previous candles' real body.

BodyShort

(N = 10, alpha = 1.0). Real body is short when it's shorter than the average of the 10 previous candles' real bodies.

BodyDoji

(N = 10, alpha = 0.1). Real body is like doji's body when it's shorter than 10% the average of the 10 previous candles' high-low range.

ShadowLong

(N = 0, alpha = 1.0). Shadow is long when it's longer than the real body.

ShadowVeryLong

(N = 0, alpha = 2.0). Shadow is very long when it's longer than 2 times the real body.

ShadowShort

(N = 0, alpha = 1.0). Shadow is short when it's shorter than half the average of the 10 previous candles' sum of shadows.

ShadowVeryShort

(N = 10, alpha = 0.1). Shadow is very short when it's shorter than 10% the average of the 10 previous candles' high-low range.

Near

(N = 5, alpha = 0.2). When measuring distance between parts of candles or width of gaps "near" means "<=20% of the average of the 5 previous candles high low range."

Far

(N = 5, alpha = 0.6). When measuring distance between parts of candles or width of gaps "far" means ">= 60% of the average of the 5 previous candles high-low range."

Equal

(N = 5, alpha = 0.05). When measuring distance between parts of candles or width of gaps "equal" means "<= 5% of the average of the 5 previous candles high-low range."

The options can be modified by running options(talib.BodyLong.N = 5, talib.BodyLong.alpha = 0.2). See vignette("candlestick") for more details.

Author

Serkan Korkmaz

Examples

## load Bitcoin (BTC)
## series
data(BTC, package = "talib")

## calculate the indicator
## for Bitcoin (BTC)
output <- talib::hikakke_mod(BTC)

## display the results
utils::tail(output)
#>                     CDLHIKKAKEMOD
#> 2024-12-26 01:00:00             0
#> 2024-12-27 01:00:00             0
#> 2024-12-28 01:00:00             0
#> 2024-12-29 01:00:00             0
#> 2024-12-30 01:00:00             0
#> 2024-12-31 01:00:00             0

## visualize the indicator
## with talib::chart()
##
## see ?talib::chart or ?talib::indicator
## for more details
{
 ## chart OHLC-V
 ## series with talib::chart()
 talib::chart(BTC)

 ## chart indicator
 ## with default values
 talib::indicator(
     talib::hikakke_mod
 )
}