From 3764c17e5f820422873a08a01e27b790c85a7d65 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Mon, 8 Jun 2026 17:17:56 +0200 Subject: [PATCH 01/12] :hammer: Added lookback-function to templates --- codegen/generate_indicator_core.sh | 2 +- codegen/templates/candlestick_template.c.in | 15 ++++++++++ codegen/templates/indicator_template.R.in | 28 +++++++++++++++++++ codegen/templates/indicator_template.c.in | 18 +++++++++++- .../templates/moving_average_template.R.in | 28 +++++++++++++++++++ codegen/templates/rolling_template.R.in | 13 +++++++++ 6 files changed, 102 insertions(+), 2 deletions(-) diff --git a/codegen/generate_indicator_core.sh b/codegen/generate_indicator_core.sh index 56d2e5d8c..b0141d3af 100755 --- a/codegen/generate_indicator_core.sh +++ b/codegen/generate_indicator_core.sh @@ -144,7 +144,7 @@ done for i in "${!in_scalars_name[@]}"; do R_SIGNATURE+=$'\tSEXP '"${in_scalars_name[$i]}"$',\n' done -R_SIGNATURE=${R_SIGNATURE%$'\n'} +R_SIGNATURE=${R_SIGNATURE%,$'\n'} ## 6) PARAM_DOC ## diff --git a/codegen/templates/candlestick_template.c.in b/codegen/templates/candlestick_template.c.in index ac9564a02..af1c33953 100644 --- a/codegen/templates/candlestick_template.c.in +++ b/codegen/templates/candlestick_template.c.in @@ -24,6 +24,21 @@ #include "normalize.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_${NAME}_lookback($R_SIGNATURE +) +// clang-format on +{ + // calculate lookback + const int lookback = {{LOOKBACK}}; + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + return output; +} + // clang-format off SEXP impl_ta_{{NAME}}( SEXP inOpen, diff --git a/codegen/templates/indicator_template.R.in b/codegen/templates/indicator_template.R.in index 0abd895ba..84b84f02d 100644 --- a/codegen/templates/indicator_template.R.in +++ b/codegen/templates/indicator_template.R.in @@ -110,3 +110,31 @@ ${FUN}.matrix <- function( ... ) } + +#' @usage NULL +${ALIAS}_lookback <- ${FUN}_lookback <- function( + x, + cols,${ARGS} + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ${FORMULA}, + data = x, + ... + ) + + .Call( + C_impl_ta_${TA_FUN}_lookback, + ## splice:lookback:start + ## splice:lookback:end + ) +} \ No newline at end of file diff --git a/codegen/templates/indicator_template.c.in b/codegen/templates/indicator_template.c.in index c8ade4f0f..69344bf2e 100644 --- a/codegen/templates/indicator_template.c.in +++ b/codegen/templates/indicator_template.c.in @@ -20,8 +20,24 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers // clang-format off -SEXP impl_ta_${NAME}($R_SIGNATURE +SEXP impl_ta_${NAME}_lookback($R_SIGNATURE +) +// clang-format on +{ + // calculate lookback + const int lookback = TA_${NAME}_Lookback($LOOKBACK_ARGS); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + return output; +} + +// clang-format off +SEXP impl_ta_${NAME}($R_SIGNATURE, SEXP na_bridge ) // clang-format on diff --git a/codegen/templates/moving_average_template.R.in b/codegen/templates/moving_average_template.R.in index 228b774a1..13f375dd9 100644 --- a/codegen/templates/moving_average_template.R.in +++ b/codegen/templates/moving_average_template.R.in @@ -163,6 +163,34 @@ $FUN.numeric <- function( } +#' @usage NULL +${ALIAS}_lookback <- ${FUN}_lookback <- function( + x, + cols,${ARGS} + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ${FORMULA}, + data = x, + ... + ) + + .Call( + C_impl_ta_${TA_FUN}_lookback, + ## splice:lookback:start + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases $FUN #' diff --git a/codegen/templates/rolling_template.R.in b/codegen/templates/rolling_template.R.in index 5a8a965eb..5418c9829 100644 --- a/codegen/templates/rolling_template.R.in +++ b/codegen/templates/rolling_template.R.in @@ -70,3 +70,16 @@ ${FUN}.numeric <- function( ## return indicator as.double(x) } + +#' @usage NULL +${ALIAS}_lookback <- ${FUN}_lookback <- function( + x,${ARGS} +) { + + .Call( + C_impl_ta_${TA_FUN}_lookback, + ## splice:lookback:start + ## splice:lookback:end + ) + +} From 74199b6af20ec2f2b1540e9f793f314869019580 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sat, 20 Jun 2026 21:36:07 +0200 Subject: [PATCH 02/12] :hammer: Added PROTECT to C-templates --- codegen/templates/candlestick_template.R.in | 30 +++++++++++++++++++++ codegen/templates/candlestick_template.c.in | 20 ++++++++++++-- codegen/templates/indicator_template.c.in | 5 ++++ 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/codegen/templates/candlestick_template.R.in b/codegen/templates/candlestick_template.R.in index a1d685cb1..1f18d98c5 100644 --- a/codegen/templates/candlestick_template.R.in +++ b/codegen/templates/candlestick_template.R.in @@ -130,6 +130,36 @@ $FUN.matrix <- function( NextMethod() } +#' @usage NULL +${ALIAS}_lookback <- ${FUN}_lookback <- function( + x, + cols,${ARGS} + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ${FORMULA}, + data = x, + ... + ) + + .Call( + C_impl_ta_${TA_FUN}_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] ${CARGS} + ) +} + #' @usage NULL #' @aliases $FUN #' diff --git a/codegen/templates/candlestick_template.c.in b/codegen/templates/candlestick_template.c.in index af1c33953..79e6e6e74 100644 --- a/codegen/templates/candlestick_template.c.in +++ b/codegen/templates/candlestick_template.c.in @@ -28,14 +28,30 @@ // is exported as a standalone // function for downstream wrappers // clang-format off -SEXP impl_ta_${NAME}_lookback($R_SIGNATURE +SEXP impl_ta_${NAME}_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose{{PEN_ARG}} ) // clang-format on { + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + {{PEN_READ}} + // calculate lookback - const int lookback = {{LOOKBACK}}; + const int lookback = {{LOOKBACK}} SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + // unprotect output + UNPROTECT(1); + return output; } diff --git a/codegen/templates/indicator_template.c.in b/codegen/templates/indicator_template.c.in index 69344bf2e..48d38ab7d 100644 --- a/codegen/templates/indicator_template.c.in +++ b/codegen/templates/indicator_template.c.in @@ -28,11 +28,16 @@ SEXP impl_ta_${NAME}_lookback($R_SIGNATURE ) // clang-format on { + // values + $VALUES + // calculate lookback const int lookback = TA_${NAME}_Lookback($LOOKBACK_ARGS); SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + // unprotect output + UNPROTECT(1); return output; } From 5d6090e2d139ab7a1d7b225a4c1bd1d3b88d4257 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sat, 20 Jun 2026 21:37:33 +0200 Subject: [PATCH 03/12] :hammer: Regenerated all indicators in C an R --- R/ta_ACCBANDS.R | 32 +++++++++ R/ta_AD.R | 31 +++++++++ R/ta_ADOSC.R | 35 ++++++++++ R/ta_ADX.R | 32 +++++++++ R/ta_ADXR.R | 32 +++++++++ R/ta_APO.R | 34 ++++++++++ R/ta_AROON.R | 31 +++++++++ R/ta_AROONOSC.R | 31 +++++++++ R/ta_ATR.R | 32 +++++++++ R/ta_AVGPRICE.R | 32 +++++++++ R/ta_BBANDS.R | 36 ++++++++++ R/ta_BETA.R | 16 +++++ R/ta_BOP.R | 31 +++++++++ R/ta_CCI.R | 32 +++++++++ R/ta_CDL2CROWS.R | 30 +++++++++ R/ta_CDL3BLACKCROWS.R | 30 +++++++++ R/ta_CDL3INSIDE.R | 30 +++++++++ R/ta_CDL3LINESTRIKE.R | 30 +++++++++ R/ta_CDL3OUTSIDE.R | 30 +++++++++ R/ta_CDL3STARSINSOUTH.R | 30 +++++++++ R/ta_CDL3WHITESOLDIERS.R | 30 +++++++++ R/ta_CDLABANDONEDBABY.R | 32 +++++++++ R/ta_CDLADVANCEBLOCK.R | 30 +++++++++ R/ta_CDLBELTHOLD.R | 30 +++++++++ R/ta_CDLBREAKAWAY.R | 30 +++++++++ R/ta_CDLCLOSINGMARUBOZU.R | 30 +++++++++ R/ta_CDLCONCEALBABYSWALL.R | 30 +++++++++ R/ta_CDLCOUNTERATTACK.R | 30 +++++++++ R/ta_CDLDARKCLOUDCOVER.R | 32 +++++++++ R/ta_CDLDOJI.R | 30 +++++++++ R/ta_CDLDOJISTAR.R | 30 +++++++++ R/ta_CDLDRAGONFLYDOJI.R | 30 +++++++++ R/ta_CDLENGULFING.R | 30 +++++++++ R/ta_CDLEVENINGDOJISTAR.R | 32 +++++++++ R/ta_CDLEVENINGSTAR.R | 32 +++++++++ R/ta_CDLGAPSIDESIDEWHITE.R | 30 +++++++++ R/ta_CDLGRAVESTONEDOJI.R | 30 +++++++++ R/ta_CDLHAMMER.R | 30 +++++++++ R/ta_CDLHANGINGMAN.R | 30 +++++++++ R/ta_CDLHARAMI.R | 30 +++++++++ R/ta_CDLHARAMICROSS.R | 30 +++++++++ R/ta_CDLHIGHWAVE.R | 30 +++++++++ R/ta_CDLHIKKAKE.R | 30 +++++++++ R/ta_CDLHIKKAKEMOD.R | 30 +++++++++ R/ta_CDLHOMINGPIGEON.R | 30 +++++++++ R/ta_CDLIDENTICAL3CROWS.R | 30 +++++++++ R/ta_CDLINNECK.R | 30 +++++++++ R/ta_CDLINVERTEDHAMMER.R | 30 +++++++++ R/ta_CDLKICKING.R | 30 +++++++++ R/ta_CDLKICKINGBYLENGTH.R | 30 +++++++++ R/ta_CDLLADDERBOTTOM.R | 30 +++++++++ R/ta_CDLLONGLEGGEDDOJI.R | 30 +++++++++ R/ta_CDLLONGLINE.R | 30 +++++++++ R/ta_CDLMARUBOZU.R | 30 +++++++++ R/ta_CDLMATCHINGLOW.R | 30 +++++++++ R/ta_CDLMATHOLD.R | 32 +++++++++ R/ta_CDLMORNINGDOJISTAR.R | 32 +++++++++ R/ta_CDLMORNINGSTAR.R | 32 +++++++++ R/ta_CDLONNECK.R | 30 +++++++++ R/ta_CDLPIERCING.R | 30 +++++++++ R/ta_CDLRICKSHAWMAN.R | 30 +++++++++ R/ta_CDLRISEFALL3METHODS.R | 30 +++++++++ R/ta_CDLSEPARATINGLINES.R | 30 +++++++++ R/ta_CDLSHOOTINGSTAR.R | 30 +++++++++ R/ta_CDLSHORTLINE.R | 30 +++++++++ R/ta_CDLSPINNINGTOP.R | 30 +++++++++ R/ta_CDLSTALLEDPATTERN.R | 30 +++++++++ R/ta_CDLSTICKSANDWICH.R | 30 +++++++++ R/ta_CDLTAKURI.R | 30 +++++++++ R/ta_CDLTASUKIGAP.R | 30 +++++++++ R/ta_CDLTHRUSTING.R | 30 +++++++++ R/ta_CDLTRISTAR.R | 30 +++++++++ R/ta_CDLUNIQUE3RIVER.R | 30 +++++++++ R/ta_CDLUPSIDEGAP2CROWS.R | 30 +++++++++ R/ta_CDLXSIDEGAP3METHODS.R | 30 +++++++++ R/ta_CMO.R | 30 +++++++++ R/ta_CORREL.R | 16 +++++ R/ta_DEMA.R | 31 +++++++++ R/ta_DX.R | 32 +++++++++ R/ta_EMA.R | 31 +++++++++ R/ta_HT_DCPERIOD.R | 28 ++++++++ R/ta_HT_DCPHASE.R | 28 ++++++++ R/ta_HT_PHASOR.R | 28 ++++++++ R/ta_HT_SINE.R | 28 ++++++++ R/ta_HT_TRENDLINE.R | 28 ++++++++ R/ta_HT_TRENDMODE.R | 28 ++++++++ R/ta_IMI.R | 31 +++++++++ R/ta_KAMA.R | 31 +++++++++ R/ta_MACD.R | 34 ++++++++++ R/ta_MACDEXT.R | 37 ++++++++++ R/ta_MACDFIX.R | 30 +++++++++ R/ta_MAMA.R | 34 ++++++++++ R/ta_MAX.R | 14 ++++ R/ta_MEDPRICE.R | 30 +++++++++ R/ta_MFI.R | 33 +++++++++ R/ta_MIDPRICE.R | 32 +++++++++ R/ta_MIN.R | 14 ++++ R/ta_MINUS_DI.R | 32 +++++++++ R/ta_MINUS_DM.R | 31 +++++++++ R/ta_MOM.R | 30 +++++++++ R/ta_NATR.R | 32 +++++++++ R/ta_OBV.R | 29 ++++++++ R/ta_PLUS_DI.R | 32 +++++++++ R/ta_PLUS_DM.R | 31 +++++++++ R/ta_PPO.R | 34 ++++++++++ R/ta_ROC.R | 30 +++++++++ R/ta_ROCR.R | 30 +++++++++ R/ta_RSI.R | 30 +++++++++ R/ta_SAR.R | 33 +++++++++ R/ta_SAREXT.R | 45 +++++++++++++ R/ta_SMA.R | 31 +++++++++ R/ta_STDDEV.R | 16 +++++ R/ta_STOCH.R | 38 +++++++++++ R/ta_STOCHF.R | 35 ++++++++++ R/ta_STOCHRSI.R | 35 ++++++++++ R/ta_SUM.R | 14 ++++ R/ta_T3.R | 33 +++++++++ R/ta_TEMA.R | 31 +++++++++ R/ta_TRANGE.R | 30 +++++++++ R/ta_TRIMA.R | 31 +++++++++ R/ta_TRIX.R | 30 +++++++++ R/ta_TYPPRICE.R | 31 +++++++++ R/ta_ULTOSC.R | 34 ++++++++++ R/ta_VAR.R | 16 +++++ R/ta_VOLUME.R | 37 ++++++++++ R/ta_WCLPRICE.R | 31 +++++++++ R/ta_WILLR.R | 32 +++++++++ R/ta_WMA.R | 31 +++++++++ src/api.h | 127 +++++++++++++++++++++++++++++++++++ src/init.c | 127 +++++++++++++++++++++++++++++++++++ src/ta_ACCBANDS.c | 34 ++++++++++ src/ta_AD.c | 32 +++++++++ src/ta_ADOSC.c | 39 +++++++++++ src/ta_ADX.c | 34 ++++++++++ src/ta_ADXR.c | 34 ++++++++++ src/ta_APO.c | 37 ++++++++++ src/ta_AROON.c | 32 +++++++++ src/ta_AROONOSC.c | 32 +++++++++ src/ta_ATR.c | 34 ++++++++++ src/ta_AVGPRICE.c | 32 +++++++++ src/ta_BBANDS.c | 40 +++++++++++ src/ta_BETA.c | 32 +++++++++ src/ta_BOP.c | 32 +++++++++ src/ta_CCI.c | 34 ++++++++++ src/ta_CDL2CROWS.c | 29 ++++++++ src/ta_CDL3BLACKCROWS.c | 29 ++++++++ src/ta_CDL3INSIDE.c | 29 ++++++++ src/ta_CDL3LINESTRIKE.c | 29 ++++++++ src/ta_CDL3OUTSIDE.c | 29 ++++++++ src/ta_CDL3STARSINSOUTH.c | 29 ++++++++ src/ta_CDL3WHITESOLDIERS.c | 29 ++++++++ src/ta_CDLABANDONEDBABY.c | 32 +++++++++ src/ta_CDLADVANCEBLOCK.c | 29 ++++++++ src/ta_CDLBELTHOLD.c | 29 ++++++++ src/ta_CDLBREAKAWAY.c | 29 ++++++++ src/ta_CDLCLOSINGMARUBOZU.c | 29 ++++++++ src/ta_CDLCONCEALBABYSWALL.c | 29 ++++++++ src/ta_CDLCOUNTERATTACK.c | 29 ++++++++ src/ta_CDLDARKCLOUDCOVER.c | 32 +++++++++ src/ta_CDLDOJI.c | 29 ++++++++ src/ta_CDLDOJISTAR.c | 29 ++++++++ src/ta_CDLDRAGONFLYDOJI.c | 29 ++++++++ src/ta_CDLENGULFING.c | 29 ++++++++ src/ta_CDLEVENINGDOJISTAR.c | 32 +++++++++ src/ta_CDLEVENINGSTAR.c | 32 +++++++++ src/ta_CDLGAPSIDESIDEWHITE.c | 29 ++++++++ src/ta_CDLGRAVESTONEDOJI.c | 29 ++++++++ src/ta_CDLHAMMER.c | 29 ++++++++ src/ta_CDLHANGINGMAN.c | 29 ++++++++ src/ta_CDLHARAMI.c | 29 ++++++++ src/ta_CDLHARAMICROSS.c | 29 ++++++++ src/ta_CDLHIGHWAVE.c | 29 ++++++++ src/ta_CDLHIKKAKE.c | 29 ++++++++ src/ta_CDLHIKKAKEMOD.c | 29 ++++++++ src/ta_CDLHOMINGPIGEON.c | 29 ++++++++ src/ta_CDLIDENTICAL3CROWS.c | 29 ++++++++ src/ta_CDLINNECK.c | 29 ++++++++ src/ta_CDLINVERTEDHAMMER.c | 29 ++++++++ src/ta_CDLKICKING.c | 29 ++++++++ src/ta_CDLKICKINGBYLENGTH.c | 29 ++++++++ src/ta_CDLLADDERBOTTOM.c | 29 ++++++++ src/ta_CDLLONGLEGGEDDOJI.c | 29 ++++++++ src/ta_CDLLONGLINE.c | 29 ++++++++ src/ta_CDLMARUBOZU.c | 29 ++++++++ src/ta_CDLMATCHINGLOW.c | 29 ++++++++ src/ta_CDLMATHOLD.c | 32 +++++++++ src/ta_CDLMORNINGDOJISTAR.c | 32 +++++++++ src/ta_CDLMORNINGSTAR.c | 32 +++++++++ src/ta_CDLONNECK.c | 29 ++++++++ src/ta_CDLPIERCING.c | 29 ++++++++ src/ta_CDLRICKSHAWMAN.c | 29 ++++++++ src/ta_CDLRISEFALL3METHODS.c | 29 ++++++++ src/ta_CDLSEPARATINGLINES.c | 29 ++++++++ src/ta_CDLSHOOTINGSTAR.c | 29 ++++++++ src/ta_CDLSHORTLINE.c | 29 ++++++++ src/ta_CDLSPINNINGTOP.c | 29 ++++++++ src/ta_CDLSTALLEDPATTERN.c | 29 ++++++++ src/ta_CDLSTICKSANDWICH.c | 29 ++++++++ src/ta_CDLTAKURI.c | 29 ++++++++ src/ta_CDLTASUKIGAP.c | 29 ++++++++ src/ta_CDLTHRUSTING.c | 29 ++++++++ src/ta_CDLTRISTAR.c | 29 ++++++++ src/ta_CDLUNIQUE3RIVER.c | 29 ++++++++ src/ta_CDLUPSIDEGAP2CROWS.c | 29 ++++++++ src/ta_CDLXSIDEGAP3METHODS.c | 29 ++++++++ src/ta_CMO.c | 30 +++++++++ src/ta_CORREL.c | 32 +++++++++ src/ta_DEMA.c | 30 +++++++++ src/ta_DX.c | 34 ++++++++++ src/ta_EMA.c | 30 +++++++++ src/ta_HT_DCPERIOD.c | 26 +++++++ src/ta_HT_DCPHASE.c | 26 +++++++ src/ta_HT_PHASOR.c | 26 +++++++ src/ta_HT_SINE.c | 26 +++++++ src/ta_HT_TRENDLINE.c | 26 +++++++ src/ta_HT_TRENDMODE.c | 26 +++++++ src/ta_IMI.c | 32 +++++++++ src/ta_KAMA.c | 30 +++++++++ src/ta_MACD.c | 37 ++++++++++ src/ta_MACDEXT.c | 46 +++++++++++++ src/ta_MACDFIX.c | 30 +++++++++ src/ta_MAMA.c | 33 +++++++++ src/ta_MAX.c | 30 +++++++++ src/ta_MEDPRICE.c | 28 ++++++++ src/ta_MFI.c | 36 ++++++++++ src/ta_MIDPRICE.c | 32 +++++++++ src/ta_MIN.c | 30 +++++++++ src/ta_MINUS_DI.c | 34 ++++++++++ src/ta_MINUS_DM.c | 32 +++++++++ src/ta_MOM.c | 30 +++++++++ src/ta_NATR.c | 34 ++++++++++ src/ta_OBV.c | 28 ++++++++ src/ta_PLUS_DI.c | 34 ++++++++++ src/ta_PLUS_DM.c | 32 +++++++++ src/ta_PPO.c | 37 ++++++++++ src/ta_ROC.c | 30 +++++++++ src/ta_ROCR.c | 30 +++++++++ src/ta_RSI.c | 30 +++++++++ src/ta_SAR.c | 35 ++++++++++ src/ta_SAREXT.c | 58 ++++++++++++++++ src/ta_SMA.c | 30 +++++++++ src/ta_STDDEV.c | 33 +++++++++ src/ta_STOCH.c | 47 +++++++++++++ src/ta_STOCHF.c | 41 +++++++++++ src/ta_STOCHRSI.c | 40 +++++++++++ src/ta_SUM.c | 30 +++++++++ src/ta_T3.c | 33 +++++++++ src/ta_TEMA.c | 30 +++++++++ src/ta_TRANGE.c | 30 +++++++++ src/ta_TRIMA.c | 30 +++++++++ src/ta_TRIX.c | 30 +++++++++ src/ta_TYPPRICE.c | 30 +++++++++ src/ta_ULTOSC.c | 41 +++++++++++ src/ta_VAR.c | 32 +++++++++ src/ta_WCLPRICE.c | 30 +++++++++ src/ta_WILLR.c | 34 ++++++++++ src/ta_WMA.c | 30 +++++++++ 257 files changed, 8077 insertions(+) diff --git a/R/ta_ACCBANDS.R b/R/ta_ACCBANDS.R index 82a7d53ff..3866b181e 100644 --- a/R/ta_ACCBANDS.R +++ b/R/ta_ACCBANDS.R @@ -122,6 +122,38 @@ acceleration_bands.matrix <- function( ) } +#' @usage NULL +ACCBANDS_lookback <- acceleration_bands_lookback <- function( + x, + cols, + n = 20, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_ACCBANDS_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases acceleration_bands diff --git a/R/ta_AD.R b/R/ta_AD.R index e0198b404..9b61ff832 100644 --- a/R/ta_AD.R +++ b/R/ta_AD.R @@ -116,6 +116,37 @@ chaikin_accumulation_distribution_line.matrix <- function( ) } +#' @usage NULL +AD_lookback <- chaikin_accumulation_distribution_line_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close + volume, + data = x, + ... + ) + + .Call( + C_impl_ta_AD_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases chaikin_accumulation_distribution_line diff --git a/R/ta_ADOSC.R b/R/ta_ADOSC.R index 953c06a71..1b16d6f7c 100644 --- a/R/ta_ADOSC.R +++ b/R/ta_ADOSC.R @@ -132,6 +132,41 @@ chaikin_accumulation_distribution_oscillator.matrix <- function( ) } +#' @usage NULL +ADOSC_lookback <- chaikin_accumulation_distribution_oscillator_lookback <- function( + x, + cols, + fast = 3, + slow = 10, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close + volume, + data = x, + ... + ) + + .Call( + C_impl_ta_ADOSC_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]], + as.integer(fast), + as.integer(slow) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases chaikin_accumulation_distribution_oscillator diff --git a/R/ta_ADX.R b/R/ta_ADX.R index 9e0b41026..a2a6495cc 100644 --- a/R/ta_ADX.R +++ b/R/ta_ADX.R @@ -122,6 +122,38 @@ average_directional_movement_index.matrix <- function( ) } +#' @usage NULL +ADX_lookback <- average_directional_movement_index_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_ADX_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases average_directional_movement_index diff --git a/R/ta_ADXR.R b/R/ta_ADXR.R index 1022b36c4..9923e53c4 100644 --- a/R/ta_ADXR.R +++ b/R/ta_ADXR.R @@ -122,6 +122,38 @@ average_directional_movement_index_rating.matrix <- function( ) } +#' @usage NULL +ADXR_lookback <- average_directional_movement_index_rating_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_ADXR_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases average_directional_movement_index_rating diff --git a/R/ta_APO.R b/R/ta_APO.R index 48bc40851..918943793 100644 --- a/R/ta_APO.R +++ b/R/ta_APO.R @@ -137,6 +137,40 @@ absolute_price_oscillator.matrix <- function( ) } +#' @usage NULL +APO_lookback <- absolute_price_oscillator_lookback <- function( + x, + cols, + fast = 12, + slow = 26, + ma = SMA(n = 9), + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_APO_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(fast), + as.integer(slow), + ma$maType + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases absolute_price_oscillator diff --git a/R/ta_AROON.R b/R/ta_AROON.R index 0cedc7c0f..3b0578853 100644 --- a/R/ta_AROON.R +++ b/R/ta_AROON.R @@ -121,6 +121,37 @@ aroon.matrix <- function( ) } +#' @usage NULL +AROON_lookback <- aroon_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low, + data = x, + ... + ) + + .Call( + C_impl_ta_AROON_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases aroon diff --git a/R/ta_AROONOSC.R b/R/ta_AROONOSC.R index 81452a9d0..08a4598a1 100644 --- a/R/ta_AROONOSC.R +++ b/R/ta_AROONOSC.R @@ -121,6 +121,37 @@ aroon_oscillator.matrix <- function( ) } +#' @usage NULL +AROONOSC_lookback <- aroon_oscillator_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low, + data = x, + ... + ) + + .Call( + C_impl_ta_AROONOSC_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases aroon_oscillator diff --git a/R/ta_ATR.R b/R/ta_ATR.R index 9c1dbbd60..d98f65450 100644 --- a/R/ta_ATR.R +++ b/R/ta_ATR.R @@ -122,6 +122,38 @@ average_true_range.matrix <- function( ) } +#' @usage NULL +ATR_lookback <- average_true_range_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_ATR_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases average_true_range diff --git a/R/ta_AVGPRICE.R b/R/ta_AVGPRICE.R index 666fd0c66..efcf7e5c2 100644 --- a/R/ta_AVGPRICE.R +++ b/R/ta_AVGPRICE.R @@ -115,3 +115,35 @@ average_price.matrix <- function( ... ) } + +#' @usage NULL +AVGPRICE_lookback <- average_price_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_AVGPRICE_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ## splice:lookback:end + ) +} diff --git a/R/ta_BBANDS.R b/R/ta_BBANDS.R index 3676bb6ad..d952e445b 100644 --- a/R/ta_BBANDS.R +++ b/R/ta_BBANDS.R @@ -145,6 +145,42 @@ bollinger_bands.matrix <- function( ) } +#' @usage NULL +BBANDS_lookback <- bollinger_bands_lookback <- function( + x, + cols, + ma = SMA(n = 5), + sd = 2, + sd_down, + sd_up, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_BBANDS_lookback, + ## splice:lookback:start + constructed_series[[1]], + ma$n, + as.double(sd_up %or% sd), + as.double(sd_down %or% sd), + ma$maType + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases bollinger_bands diff --git a/R/ta_BETA.R b/R/ta_BETA.R index 78eec1b70..26ded777b 100644 --- a/R/ta_BETA.R +++ b/R/ta_BETA.R @@ -75,3 +75,19 @@ rolling_beta.numeric <- function( ## return indicator as.double(x) } + +#' @usage NULL +BETA_lookback <- rolling_beta_lookback <- function( + x, + y, + n = 5 +) { + .Call( + C_impl_ta_BETA_lookback, + ## splice:lookback:start + as.double(x), + as.double(y), + as.integer(n) + ## splice:lookback:end + ) +} diff --git a/R/ta_BOP.R b/R/ta_BOP.R index 2e313da83..3e1d5e84a 100644 --- a/R/ta_BOP.R +++ b/R/ta_BOP.R @@ -116,6 +116,37 @@ balance_of_power.matrix <- function( ) } +#' @usage NULL +BOP_lookback <- balance_of_power_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_BOP_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases balance_of_power diff --git a/R/ta_CCI.R b/R/ta_CCI.R index e4b93a9f3..c7c1a04e1 100644 --- a/R/ta_CCI.R +++ b/R/ta_CCI.R @@ -122,6 +122,38 @@ commodity_channel_index.matrix <- function( ) } +#' @usage NULL +CCI_lookback <- commodity_channel_index_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CCI_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases commodity_channel_index diff --git a/R/ta_CDL2CROWS.R b/R/ta_CDL2CROWS.R index 1697f99c1..c79c556d3 100644 --- a/R/ta_CDL2CROWS.R +++ b/R/ta_CDL2CROWS.R @@ -132,6 +132,36 @@ two_crows.matrix <- function( NextMethod() } +#' @usage NULL +CDL2CROWS_lookback <- two_crows_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDL2CROWS_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases two_crows #' diff --git a/R/ta_CDL3BLACKCROWS.R b/R/ta_CDL3BLACKCROWS.R index a3f46cea1..4aeb645d0 100644 --- a/R/ta_CDL3BLACKCROWS.R +++ b/R/ta_CDL3BLACKCROWS.R @@ -132,6 +132,36 @@ three_black_crows.matrix <- function( NextMethod() } +#' @usage NULL +CDL3BLACKCROWS_lookback <- three_black_crows_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDL3BLACKCROWS_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases three_black_crows #' diff --git a/R/ta_CDL3INSIDE.R b/R/ta_CDL3INSIDE.R index cd46e3309..cf1dffd32 100644 --- a/R/ta_CDL3INSIDE.R +++ b/R/ta_CDL3INSIDE.R @@ -132,6 +132,36 @@ three_inside.matrix <- function( NextMethod() } +#' @usage NULL +CDL3INSIDE_lookback <- three_inside_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDL3INSIDE_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases three_inside #' diff --git a/R/ta_CDL3LINESTRIKE.R b/R/ta_CDL3LINESTRIKE.R index ac54cdbbf..13dc938f2 100644 --- a/R/ta_CDL3LINESTRIKE.R +++ b/R/ta_CDL3LINESTRIKE.R @@ -132,6 +132,36 @@ three_line_strike.matrix <- function( NextMethod() } +#' @usage NULL +CDL3LINESTRIKE_lookback <- three_line_strike_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDL3LINESTRIKE_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases three_line_strike #' diff --git a/R/ta_CDL3OUTSIDE.R b/R/ta_CDL3OUTSIDE.R index 872ce706b..13afe056f 100644 --- a/R/ta_CDL3OUTSIDE.R +++ b/R/ta_CDL3OUTSIDE.R @@ -132,6 +132,36 @@ three_outside.matrix <- function( NextMethod() } +#' @usage NULL +CDL3OUTSIDE_lookback <- three_outside_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDL3OUTSIDE_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases three_outside #' diff --git a/R/ta_CDL3STARSINSOUTH.R b/R/ta_CDL3STARSINSOUTH.R index bf6fbc1ec..2215b1764 100644 --- a/R/ta_CDL3STARSINSOUTH.R +++ b/R/ta_CDL3STARSINSOUTH.R @@ -132,6 +132,36 @@ three_stars_in_the_south.matrix <- function( NextMethod() } +#' @usage NULL +CDL3STARSINSOUTH_lookback <- three_stars_in_the_south_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDL3STARSINSOUTH_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases three_stars_in_the_south #' diff --git a/R/ta_CDL3WHITESOLDIERS.R b/R/ta_CDL3WHITESOLDIERS.R index 3d800b3f7..9e4c35425 100644 --- a/R/ta_CDL3WHITESOLDIERS.R +++ b/R/ta_CDL3WHITESOLDIERS.R @@ -132,6 +132,36 @@ three_white_soldiers.matrix <- function( NextMethod() } +#' @usage NULL +CDL3WHITESOLDIERS_lookback <- three_white_soldiers_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDL3WHITESOLDIERS_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases three_white_soldiers #' diff --git a/R/ta_CDLABANDONEDBABY.R b/R/ta_CDLABANDONEDBABY.R index 5decd6880..a3ec95c7d 100644 --- a/R/ta_CDLABANDONEDBABY.R +++ b/R/ta_CDLABANDONEDBABY.R @@ -137,6 +137,38 @@ abandoned_baby.matrix <- function( NextMethod() } +#' @usage NULL +CDLABANDONEDBABY_lookback <- abandoned_baby_lookback <- function( + x, + cols, + eps = 0, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLABANDONEDBABY_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]], + eps + ) +} + #' @usage NULL #' @aliases abandoned_baby #' diff --git a/R/ta_CDLADVANCEBLOCK.R b/R/ta_CDLADVANCEBLOCK.R index 7ffa59eb0..16c10bca5 100644 --- a/R/ta_CDLADVANCEBLOCK.R +++ b/R/ta_CDLADVANCEBLOCK.R @@ -132,6 +132,36 @@ advance_block.matrix <- function( NextMethod() } +#' @usage NULL +CDLADVANCEBLOCK_lookback <- advance_block_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLADVANCEBLOCK_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases advance_block #' diff --git a/R/ta_CDLBELTHOLD.R b/R/ta_CDLBELTHOLD.R index d241985d7..8e3a056d7 100644 --- a/R/ta_CDLBELTHOLD.R +++ b/R/ta_CDLBELTHOLD.R @@ -132,6 +132,36 @@ belt_hold.matrix <- function( NextMethod() } +#' @usage NULL +CDLBELTHOLD_lookback <- belt_hold_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLBELTHOLD_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases belt_hold #' diff --git a/R/ta_CDLBREAKAWAY.R b/R/ta_CDLBREAKAWAY.R index 05fd11f8b..d90f1f10d 100644 --- a/R/ta_CDLBREAKAWAY.R +++ b/R/ta_CDLBREAKAWAY.R @@ -132,6 +132,36 @@ break_away.matrix <- function( NextMethod() } +#' @usage NULL +CDLBREAKAWAY_lookback <- break_away_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLBREAKAWAY_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases break_away #' diff --git a/R/ta_CDLCLOSINGMARUBOZU.R b/R/ta_CDLCLOSINGMARUBOZU.R index 8c12755f5..c26fa3299 100644 --- a/R/ta_CDLCLOSINGMARUBOZU.R +++ b/R/ta_CDLCLOSINGMARUBOZU.R @@ -132,6 +132,36 @@ closing_marubozu.matrix <- function( NextMethod() } +#' @usage NULL +CDLCLOSINGMARUBOZU_lookback <- closing_marubozu_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLCLOSINGMARUBOZU_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases closing_marubozu #' diff --git a/R/ta_CDLCONCEALBABYSWALL.R b/R/ta_CDLCONCEALBABYSWALL.R index 1abe77544..bcccd5ab3 100644 --- a/R/ta_CDLCONCEALBABYSWALL.R +++ b/R/ta_CDLCONCEALBABYSWALL.R @@ -132,6 +132,36 @@ concealing_baby_swallow.matrix <- function( NextMethod() } +#' @usage NULL +CDLCONCEALBABYSWALL_lookback <- concealing_baby_swallow_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLCONCEALBABYSWALL_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases concealing_baby_swallow #' diff --git a/R/ta_CDLCOUNTERATTACK.R b/R/ta_CDLCOUNTERATTACK.R index 3fb8660c4..703654191 100644 --- a/R/ta_CDLCOUNTERATTACK.R +++ b/R/ta_CDLCOUNTERATTACK.R @@ -132,6 +132,36 @@ counter_attack.matrix <- function( NextMethod() } +#' @usage NULL +CDLCOUNTERATTACK_lookback <- counter_attack_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLCOUNTERATTACK_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases counter_attack #' diff --git a/R/ta_CDLDARKCLOUDCOVER.R b/R/ta_CDLDARKCLOUDCOVER.R index b56bd5113..553c1a7c4 100644 --- a/R/ta_CDLDARKCLOUDCOVER.R +++ b/R/ta_CDLDARKCLOUDCOVER.R @@ -137,6 +137,38 @@ dark_cloud_cover.matrix <- function( NextMethod() } +#' @usage NULL +CDLDARKCLOUDCOVER_lookback <- dark_cloud_cover_lookback <- function( + x, + cols, + eps = 0, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLDARKCLOUDCOVER_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]], + eps + ) +} + #' @usage NULL #' @aliases dark_cloud_cover #' diff --git a/R/ta_CDLDOJI.R b/R/ta_CDLDOJI.R index 2ca3a5002..da7c64f14 100644 --- a/R/ta_CDLDOJI.R +++ b/R/ta_CDLDOJI.R @@ -132,6 +132,36 @@ doji.matrix <- function( NextMethod() } +#' @usage NULL +CDLDOJI_lookback <- doji_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLDOJI_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases doji #' diff --git a/R/ta_CDLDOJISTAR.R b/R/ta_CDLDOJISTAR.R index 9691c0ef6..6a6656a0c 100644 --- a/R/ta_CDLDOJISTAR.R +++ b/R/ta_CDLDOJISTAR.R @@ -132,6 +132,36 @@ doji_star.matrix <- function( NextMethod() } +#' @usage NULL +CDLDOJISTAR_lookback <- doji_star_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLDOJISTAR_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases doji_star #' diff --git a/R/ta_CDLDRAGONFLYDOJI.R b/R/ta_CDLDRAGONFLYDOJI.R index 602530860..bba237b42 100644 --- a/R/ta_CDLDRAGONFLYDOJI.R +++ b/R/ta_CDLDRAGONFLYDOJI.R @@ -132,6 +132,36 @@ dragonfly_doji.matrix <- function( NextMethod() } +#' @usage NULL +CDLDRAGONFLYDOJI_lookback <- dragonfly_doji_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLDRAGONFLYDOJI_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases dragonfly_doji #' diff --git a/R/ta_CDLENGULFING.R b/R/ta_CDLENGULFING.R index 24038dd37..770935ea4 100644 --- a/R/ta_CDLENGULFING.R +++ b/R/ta_CDLENGULFING.R @@ -132,6 +132,36 @@ engulfing.matrix <- function( NextMethod() } +#' @usage NULL +CDLENGULFING_lookback <- engulfing_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLENGULFING_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases engulfing #' diff --git a/R/ta_CDLEVENINGDOJISTAR.R b/R/ta_CDLEVENINGDOJISTAR.R index 907656aa7..d23789049 100644 --- a/R/ta_CDLEVENINGDOJISTAR.R +++ b/R/ta_CDLEVENINGDOJISTAR.R @@ -137,6 +137,38 @@ evening_doji_star.matrix <- function( NextMethod() } +#' @usage NULL +CDLEVENINGDOJISTAR_lookback <- evening_doji_star_lookback <- function( + x, + cols, + eps = 0, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLEVENINGDOJISTAR_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]], + eps + ) +} + #' @usage NULL #' @aliases evening_doji_star #' diff --git a/R/ta_CDLEVENINGSTAR.R b/R/ta_CDLEVENINGSTAR.R index 944020248..1c6e9db5f 100644 --- a/R/ta_CDLEVENINGSTAR.R +++ b/R/ta_CDLEVENINGSTAR.R @@ -137,6 +137,38 @@ evening_star.matrix <- function( NextMethod() } +#' @usage NULL +CDLEVENINGSTAR_lookback <- evening_star_lookback <- function( + x, + cols, + eps = 0, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLEVENINGSTAR_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]], + eps + ) +} + #' @usage NULL #' @aliases evening_star #' diff --git a/R/ta_CDLGAPSIDESIDEWHITE.R b/R/ta_CDLGAPSIDESIDEWHITE.R index 50410f78b..1caf72e03 100644 --- a/R/ta_CDLGAPSIDESIDEWHITE.R +++ b/R/ta_CDLGAPSIDESIDEWHITE.R @@ -132,6 +132,36 @@ gaps_side_white.matrix <- function( NextMethod() } +#' @usage NULL +CDLGAPSIDESIDEWHITE_lookback <- gaps_side_white_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLGAPSIDESIDEWHITE_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases gaps_side_white #' diff --git a/R/ta_CDLGRAVESTONEDOJI.R b/R/ta_CDLGRAVESTONEDOJI.R index 931163072..3bbf10d63 100644 --- a/R/ta_CDLGRAVESTONEDOJI.R +++ b/R/ta_CDLGRAVESTONEDOJI.R @@ -132,6 +132,36 @@ gravestone_doji.matrix <- function( NextMethod() } +#' @usage NULL +CDLGRAVESTONEDOJI_lookback <- gravestone_doji_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLGRAVESTONEDOJI_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases gravestone_doji #' diff --git a/R/ta_CDLHAMMER.R b/R/ta_CDLHAMMER.R index bf74d0411..f129e628a 100644 --- a/R/ta_CDLHAMMER.R +++ b/R/ta_CDLHAMMER.R @@ -132,6 +132,36 @@ hammer.matrix <- function( NextMethod() } +#' @usage NULL +CDLHAMMER_lookback <- hammer_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLHAMMER_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases hammer #' diff --git a/R/ta_CDLHANGINGMAN.R b/R/ta_CDLHANGINGMAN.R index 427325177..464d17b63 100644 --- a/R/ta_CDLHANGINGMAN.R +++ b/R/ta_CDLHANGINGMAN.R @@ -132,6 +132,36 @@ hanging_man.matrix <- function( NextMethod() } +#' @usage NULL +CDLHANGINGMAN_lookback <- hanging_man_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLHANGINGMAN_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases hanging_man #' diff --git a/R/ta_CDLHARAMI.R b/R/ta_CDLHARAMI.R index 0e1a5403f..d27ef9645 100644 --- a/R/ta_CDLHARAMI.R +++ b/R/ta_CDLHARAMI.R @@ -132,6 +132,36 @@ harami.matrix <- function( NextMethod() } +#' @usage NULL +CDLHARAMI_lookback <- harami_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLHARAMI_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases harami #' diff --git a/R/ta_CDLHARAMICROSS.R b/R/ta_CDLHARAMICROSS.R index 749141b97..73e808e05 100644 --- a/R/ta_CDLHARAMICROSS.R +++ b/R/ta_CDLHARAMICROSS.R @@ -132,6 +132,36 @@ harami_cross.matrix <- function( NextMethod() } +#' @usage NULL +CDLHARAMICROSS_lookback <- harami_cross_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLHARAMICROSS_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases harami_cross #' diff --git a/R/ta_CDLHIGHWAVE.R b/R/ta_CDLHIGHWAVE.R index 17100b4e3..6c344513d 100644 --- a/R/ta_CDLHIGHWAVE.R +++ b/R/ta_CDLHIGHWAVE.R @@ -132,6 +132,36 @@ high_wave.matrix <- function( NextMethod() } +#' @usage NULL +CDLHIGHWAVE_lookback <- high_wave_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLHIGHWAVE_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases high_wave #' diff --git a/R/ta_CDLHIKKAKE.R b/R/ta_CDLHIKKAKE.R index f5e218e47..620a7d9b6 100644 --- a/R/ta_CDLHIKKAKE.R +++ b/R/ta_CDLHIKKAKE.R @@ -132,6 +132,36 @@ hikakke.matrix <- function( NextMethod() } +#' @usage NULL +CDLHIKKAKE_lookback <- hikakke_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLHIKKAKE_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases hikakke #' diff --git a/R/ta_CDLHIKKAKEMOD.R b/R/ta_CDLHIKKAKEMOD.R index 43fdab5ee..d5bc0e46b 100644 --- a/R/ta_CDLHIKKAKEMOD.R +++ b/R/ta_CDLHIKKAKEMOD.R @@ -132,6 +132,36 @@ hikakke_mod.matrix <- function( NextMethod() } +#' @usage NULL +CDLHIKKAKEMOD_lookback <- hikakke_mod_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLHIKKAKEMOD_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases hikakke_mod #' diff --git a/R/ta_CDLHOMINGPIGEON.R b/R/ta_CDLHOMINGPIGEON.R index 82566f6b6..aa59697fa 100644 --- a/R/ta_CDLHOMINGPIGEON.R +++ b/R/ta_CDLHOMINGPIGEON.R @@ -132,6 +132,36 @@ homing_pigeon.matrix <- function( NextMethod() } +#' @usage NULL +CDLHOMINGPIGEON_lookback <- homing_pigeon_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLHOMINGPIGEON_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases homing_pigeon #' diff --git a/R/ta_CDLIDENTICAL3CROWS.R b/R/ta_CDLIDENTICAL3CROWS.R index 6d53e8b46..f53a60013 100644 --- a/R/ta_CDLIDENTICAL3CROWS.R +++ b/R/ta_CDLIDENTICAL3CROWS.R @@ -132,6 +132,36 @@ three_identical_crows.matrix <- function( NextMethod() } +#' @usage NULL +CDLIDENTICAL3CROWS_lookback <- three_identical_crows_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLIDENTICAL3CROWS_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases three_identical_crows #' diff --git a/R/ta_CDLINNECK.R b/R/ta_CDLINNECK.R index 0ad45078d..ae93052c8 100644 --- a/R/ta_CDLINNECK.R +++ b/R/ta_CDLINNECK.R @@ -132,6 +132,36 @@ in_neck.matrix <- function( NextMethod() } +#' @usage NULL +CDLINNECK_lookback <- in_neck_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLINNECK_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases in_neck #' diff --git a/R/ta_CDLINVERTEDHAMMER.R b/R/ta_CDLINVERTEDHAMMER.R index 46b28e3a1..6013b62b9 100644 --- a/R/ta_CDLINVERTEDHAMMER.R +++ b/R/ta_CDLINVERTEDHAMMER.R @@ -132,6 +132,36 @@ inverted_hammer.matrix <- function( NextMethod() } +#' @usage NULL +CDLINVERTEDHAMMER_lookback <- inverted_hammer_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLINVERTEDHAMMER_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases inverted_hammer #' diff --git a/R/ta_CDLKICKING.R b/R/ta_CDLKICKING.R index 079feb387..027447af4 100644 --- a/R/ta_CDLKICKING.R +++ b/R/ta_CDLKICKING.R @@ -132,6 +132,36 @@ kicking.matrix <- function( NextMethod() } +#' @usage NULL +CDLKICKING_lookback <- kicking_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLKICKING_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases kicking #' diff --git a/R/ta_CDLKICKINGBYLENGTH.R b/R/ta_CDLKICKINGBYLENGTH.R index 9e60f5a56..694df66eb 100644 --- a/R/ta_CDLKICKINGBYLENGTH.R +++ b/R/ta_CDLKICKINGBYLENGTH.R @@ -132,6 +132,36 @@ kicking_baby_length.matrix <- function( NextMethod() } +#' @usage NULL +CDLKICKINGBYLENGTH_lookback <- kicking_baby_length_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLKICKINGBYLENGTH_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases kicking_baby_length #' diff --git a/R/ta_CDLLADDERBOTTOM.R b/R/ta_CDLLADDERBOTTOM.R index a43a9cf41..f844980a0 100644 --- a/R/ta_CDLLADDERBOTTOM.R +++ b/R/ta_CDLLADDERBOTTOM.R @@ -132,6 +132,36 @@ ladder_bottom.matrix <- function( NextMethod() } +#' @usage NULL +CDLLADDERBOTTOM_lookback <- ladder_bottom_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLLADDERBOTTOM_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases ladder_bottom #' diff --git a/R/ta_CDLLONGLEGGEDDOJI.R b/R/ta_CDLLONGLEGGEDDOJI.R index 342e5c135..86e1274b1 100644 --- a/R/ta_CDLLONGLEGGEDDOJI.R +++ b/R/ta_CDLLONGLEGGEDDOJI.R @@ -132,6 +132,36 @@ long_legged_doji.matrix <- function( NextMethod() } +#' @usage NULL +CDLLONGLEGGEDDOJI_lookback <- long_legged_doji_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLLONGLEGGEDDOJI_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases long_legged_doji #' diff --git a/R/ta_CDLLONGLINE.R b/R/ta_CDLLONGLINE.R index 7c907f73c..57c3adbd3 100644 --- a/R/ta_CDLLONGLINE.R +++ b/R/ta_CDLLONGLINE.R @@ -132,6 +132,36 @@ long_line.matrix <- function( NextMethod() } +#' @usage NULL +CDLLONGLINE_lookback <- long_line_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLLONGLINE_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases long_line #' diff --git a/R/ta_CDLMARUBOZU.R b/R/ta_CDLMARUBOZU.R index fe592ac37..a5f6eb9f5 100644 --- a/R/ta_CDLMARUBOZU.R +++ b/R/ta_CDLMARUBOZU.R @@ -132,6 +132,36 @@ marubozu.matrix <- function( NextMethod() } +#' @usage NULL +CDLMARUBOZU_lookback <- marubozu_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLMARUBOZU_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases marubozu #' diff --git a/R/ta_CDLMATCHINGLOW.R b/R/ta_CDLMATCHINGLOW.R index c1aab57d1..92b4f5280 100644 --- a/R/ta_CDLMATCHINGLOW.R +++ b/R/ta_CDLMATCHINGLOW.R @@ -132,6 +132,36 @@ matching_low.matrix <- function( NextMethod() } +#' @usage NULL +CDLMATCHINGLOW_lookback <- matching_low_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLMATCHINGLOW_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases matching_low #' diff --git a/R/ta_CDLMATHOLD.R b/R/ta_CDLMATHOLD.R index afe98eabf..15ea8f526 100644 --- a/R/ta_CDLMATHOLD.R +++ b/R/ta_CDLMATHOLD.R @@ -137,6 +137,38 @@ mat_hold.matrix <- function( NextMethod() } +#' @usage NULL +CDLMATHOLD_lookback <- mat_hold_lookback <- function( + x, + cols, + eps = 0, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLMATHOLD_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]], + eps + ) +} + #' @usage NULL #' @aliases mat_hold #' diff --git a/R/ta_CDLMORNINGDOJISTAR.R b/R/ta_CDLMORNINGDOJISTAR.R index 5aa05cb81..6de0f62d1 100644 --- a/R/ta_CDLMORNINGDOJISTAR.R +++ b/R/ta_CDLMORNINGDOJISTAR.R @@ -137,6 +137,38 @@ morning_doji_star.matrix <- function( NextMethod() } +#' @usage NULL +CDLMORNINGDOJISTAR_lookback <- morning_doji_star_lookback <- function( + x, + cols, + eps = 0, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLMORNINGDOJISTAR_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]], + eps + ) +} + #' @usage NULL #' @aliases morning_doji_star #' diff --git a/R/ta_CDLMORNINGSTAR.R b/R/ta_CDLMORNINGSTAR.R index d2fd17206..aa5404d8d 100644 --- a/R/ta_CDLMORNINGSTAR.R +++ b/R/ta_CDLMORNINGSTAR.R @@ -137,6 +137,38 @@ morning_star.matrix <- function( NextMethod() } +#' @usage NULL +CDLMORNINGSTAR_lookback <- morning_star_lookback <- function( + x, + cols, + eps = 0, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLMORNINGSTAR_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]], + eps + ) +} + #' @usage NULL #' @aliases morning_star #' diff --git a/R/ta_CDLONNECK.R b/R/ta_CDLONNECK.R index 4d9ed7fe6..dde28b5b1 100644 --- a/R/ta_CDLONNECK.R +++ b/R/ta_CDLONNECK.R @@ -132,6 +132,36 @@ on_neck.matrix <- function( NextMethod() } +#' @usage NULL +CDLONNECK_lookback <- on_neck_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLONNECK_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases on_neck #' diff --git a/R/ta_CDLPIERCING.R b/R/ta_CDLPIERCING.R index 5df9f1330..a5fda9945 100644 --- a/R/ta_CDLPIERCING.R +++ b/R/ta_CDLPIERCING.R @@ -132,6 +132,36 @@ piercing.matrix <- function( NextMethod() } +#' @usage NULL +CDLPIERCING_lookback <- piercing_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLPIERCING_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases piercing #' diff --git a/R/ta_CDLRICKSHAWMAN.R b/R/ta_CDLRICKSHAWMAN.R index f96e13579..093178afd 100644 --- a/R/ta_CDLRICKSHAWMAN.R +++ b/R/ta_CDLRICKSHAWMAN.R @@ -132,6 +132,36 @@ rickshaw_man.matrix <- function( NextMethod() } +#' @usage NULL +CDLRICKSHAWMAN_lookback <- rickshaw_man_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLRICKSHAWMAN_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases rickshaw_man #' diff --git a/R/ta_CDLRISEFALL3METHODS.R b/R/ta_CDLRISEFALL3METHODS.R index 116fa14ee..279bd00c3 100644 --- a/R/ta_CDLRISEFALL3METHODS.R +++ b/R/ta_CDLRISEFALL3METHODS.R @@ -132,6 +132,36 @@ rise_fall_3_methods.matrix <- function( NextMethod() } +#' @usage NULL +CDLRISEFALL3METHODS_lookback <- rise_fall_3_methods_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLRISEFALL3METHODS_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases rise_fall_3_methods #' diff --git a/R/ta_CDLSEPARATINGLINES.R b/R/ta_CDLSEPARATINGLINES.R index e0ff5f769..878c9d226 100644 --- a/R/ta_CDLSEPARATINGLINES.R +++ b/R/ta_CDLSEPARATINGLINES.R @@ -132,6 +132,36 @@ separating_lines.matrix <- function( NextMethod() } +#' @usage NULL +CDLSEPARATINGLINES_lookback <- separating_lines_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLSEPARATINGLINES_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases separating_lines #' diff --git a/R/ta_CDLSHOOTINGSTAR.R b/R/ta_CDLSHOOTINGSTAR.R index a99cea3f1..ba4fadd0a 100644 --- a/R/ta_CDLSHOOTINGSTAR.R +++ b/R/ta_CDLSHOOTINGSTAR.R @@ -132,6 +132,36 @@ shooting_star.matrix <- function( NextMethod() } +#' @usage NULL +CDLSHOOTINGSTAR_lookback <- shooting_star_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLSHOOTINGSTAR_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases shooting_star #' diff --git a/R/ta_CDLSHORTLINE.R b/R/ta_CDLSHORTLINE.R index c5dd4c8bf..749d270fe 100644 --- a/R/ta_CDLSHORTLINE.R +++ b/R/ta_CDLSHORTLINE.R @@ -132,6 +132,36 @@ short_line.matrix <- function( NextMethod() } +#' @usage NULL +CDLSHORTLINE_lookback <- short_line_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLSHORTLINE_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases short_line #' diff --git a/R/ta_CDLSPINNINGTOP.R b/R/ta_CDLSPINNINGTOP.R index cfb3609dd..f21273aac 100644 --- a/R/ta_CDLSPINNINGTOP.R +++ b/R/ta_CDLSPINNINGTOP.R @@ -132,6 +132,36 @@ spinning_top.matrix <- function( NextMethod() } +#' @usage NULL +CDLSPINNINGTOP_lookback <- spinning_top_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLSPINNINGTOP_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases spinning_top #' diff --git a/R/ta_CDLSTALLEDPATTERN.R b/R/ta_CDLSTALLEDPATTERN.R index 472c88d01..855622010 100644 --- a/R/ta_CDLSTALLEDPATTERN.R +++ b/R/ta_CDLSTALLEDPATTERN.R @@ -132,6 +132,36 @@ stalled_pattern.matrix <- function( NextMethod() } +#' @usage NULL +CDLSTALLEDPATTERN_lookback <- stalled_pattern_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLSTALLEDPATTERN_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases stalled_pattern #' diff --git a/R/ta_CDLSTICKSANDWICH.R b/R/ta_CDLSTICKSANDWICH.R index 75b91ed4c..2c27022f4 100644 --- a/R/ta_CDLSTICKSANDWICH.R +++ b/R/ta_CDLSTICKSANDWICH.R @@ -132,6 +132,36 @@ stick_sandwich.matrix <- function( NextMethod() } +#' @usage NULL +CDLSTICKSANDWICH_lookback <- stick_sandwich_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLSTICKSANDWICH_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases stick_sandwich #' diff --git a/R/ta_CDLTAKURI.R b/R/ta_CDLTAKURI.R index da480fd62..313cd90bf 100644 --- a/R/ta_CDLTAKURI.R +++ b/R/ta_CDLTAKURI.R @@ -132,6 +132,36 @@ takuri.matrix <- function( NextMethod() } +#' @usage NULL +CDLTAKURI_lookback <- takuri_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLTAKURI_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases takuri #' diff --git a/R/ta_CDLTASUKIGAP.R b/R/ta_CDLTASUKIGAP.R index 5ecd06cad..4a6e25fe7 100644 --- a/R/ta_CDLTASUKIGAP.R +++ b/R/ta_CDLTASUKIGAP.R @@ -132,6 +132,36 @@ tasuki_gap.matrix <- function( NextMethod() } +#' @usage NULL +CDLTASUKIGAP_lookback <- tasuki_gap_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLTASUKIGAP_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases tasuki_gap #' diff --git a/R/ta_CDLTHRUSTING.R b/R/ta_CDLTHRUSTING.R index 08b496e3e..3c2341de1 100644 --- a/R/ta_CDLTHRUSTING.R +++ b/R/ta_CDLTHRUSTING.R @@ -132,6 +132,36 @@ thrusting.matrix <- function( NextMethod() } +#' @usage NULL +CDLTHRUSTING_lookback <- thrusting_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLTHRUSTING_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases thrusting #' diff --git a/R/ta_CDLTRISTAR.R b/R/ta_CDLTRISTAR.R index fb99feeef..8144bea0b 100644 --- a/R/ta_CDLTRISTAR.R +++ b/R/ta_CDLTRISTAR.R @@ -132,6 +132,36 @@ tristar.matrix <- function( NextMethod() } +#' @usage NULL +CDLTRISTAR_lookback <- tristar_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLTRISTAR_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases tristar #' diff --git a/R/ta_CDLUNIQUE3RIVER.R b/R/ta_CDLUNIQUE3RIVER.R index ee608e3ce..a16348018 100644 --- a/R/ta_CDLUNIQUE3RIVER.R +++ b/R/ta_CDLUNIQUE3RIVER.R @@ -132,6 +132,36 @@ unique_3_river.matrix <- function( NextMethod() } +#' @usage NULL +CDLUNIQUE3RIVER_lookback <- unique_3_river_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLUNIQUE3RIVER_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases unique_3_river #' diff --git a/R/ta_CDLUPSIDEGAP2CROWS.R b/R/ta_CDLUPSIDEGAP2CROWS.R index 977c2b4e0..35f32c0c5 100644 --- a/R/ta_CDLUPSIDEGAP2CROWS.R +++ b/R/ta_CDLUPSIDEGAP2CROWS.R @@ -132,6 +132,36 @@ upside_gap_2_crows.matrix <- function( NextMethod() } +#' @usage NULL +CDLUPSIDEGAP2CROWS_lookback <- upside_gap_2_crows_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLUPSIDEGAP2CROWS_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases upside_gap_2_crows #' diff --git a/R/ta_CDLXSIDEGAP3METHODS.R b/R/ta_CDLXSIDEGAP3METHODS.R index ee6fa3088..3ae89e583 100644 --- a/R/ta_CDLXSIDEGAP3METHODS.R +++ b/R/ta_CDLXSIDEGAP3METHODS.R @@ -132,6 +132,36 @@ xside_gap_3_methods.matrix <- function( NextMethod() } +#' @usage NULL +CDLXSIDEGAP3METHODS_lookback <- xside_gap_3_methods_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_CDLXSIDEGAP3METHODS_lookback, + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]] + ) +} + #' @usage NULL #' @aliases xside_gap_3_methods #' diff --git a/R/ta_CMO.R b/R/ta_CMO.R index 213017705..209d55e0d 100644 --- a/R/ta_CMO.R +++ b/R/ta_CMO.R @@ -120,6 +120,36 @@ chande_momentum_oscillator.matrix <- function( ) } +#' @usage NULL +CMO_lookback <- chande_momentum_oscillator_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_CMO_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases chande_momentum_oscillator diff --git a/R/ta_CORREL.R b/R/ta_CORREL.R index ebfabfb6a..1da8fe771 100644 --- a/R/ta_CORREL.R +++ b/R/ta_CORREL.R @@ -75,3 +75,19 @@ rolling_correlation.numeric <- function( ## return indicator as.double(x) } + +#' @usage NULL +CORREL_lookback <- rolling_correlation_lookback <- function( + x, + y, + n = 30 +) { + .Call( + C_impl_ta_CORREL_lookback, + ## splice:lookback:start + as.double(x), + as.double(y), + as.integer(n) + ## splice:lookback:end + ) +} diff --git a/R/ta_DEMA.R b/R/ta_DEMA.R index e7d0a423f..c0a1f9777 100644 --- a/R/ta_DEMA.R +++ b/R/ta_DEMA.R @@ -170,6 +170,37 @@ double_exponential_moving_average.numeric <- function( x } +#' @usage NULL +DEMA_lookback <- double_exponential_moving_average_lookback <- function( + x, + cols, + n = 30, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_DEMA_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + as.integer(n) + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases double_exponential_moving_average #' diff --git a/R/ta_DX.R b/R/ta_DX.R index 1db4d604a..22788b760 100644 --- a/R/ta_DX.R +++ b/R/ta_DX.R @@ -122,6 +122,38 @@ directional_movement_index.matrix <- function( ) } +#' @usage NULL +DX_lookback <- directional_movement_index_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_DX_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases directional_movement_index diff --git a/R/ta_EMA.R b/R/ta_EMA.R index e999fc54b..19c4be723 100644 --- a/R/ta_EMA.R +++ b/R/ta_EMA.R @@ -170,6 +170,37 @@ exponential_moving_average.numeric <- function( x } +#' @usage NULL +EMA_lookback <- exponential_moving_average_lookback <- function( + x, + cols, + n = 30, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_EMA_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + as.integer(n) + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases exponential_moving_average #' diff --git a/R/ta_HT_DCPERIOD.R b/R/ta_HT_DCPERIOD.R index d65003f83..77e712105 100644 --- a/R/ta_HT_DCPERIOD.R +++ b/R/ta_HT_DCPERIOD.R @@ -113,6 +113,34 @@ dominant_cycle_period.matrix <- function( ) } +#' @usage NULL +HT_DCPERIOD_lookback <- dominant_cycle_period_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_HT_DCPERIOD_lookback, + ## splice:lookback:start + constructed_series[[1]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases dominant_cycle_period diff --git a/R/ta_HT_DCPHASE.R b/R/ta_HT_DCPHASE.R index 401954a82..75db0a3f4 100644 --- a/R/ta_HT_DCPHASE.R +++ b/R/ta_HT_DCPHASE.R @@ -113,6 +113,34 @@ dominant_cycle_phase.matrix <- function( ) } +#' @usage NULL +HT_DCPHASE_lookback <- dominant_cycle_phase_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_HT_DCPHASE_lookback, + ## splice:lookback:start + constructed_series[[1]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases dominant_cycle_phase diff --git a/R/ta_HT_PHASOR.R b/R/ta_HT_PHASOR.R index f29847715..9f0d96434 100644 --- a/R/ta_HT_PHASOR.R +++ b/R/ta_HT_PHASOR.R @@ -113,6 +113,34 @@ phasor_components.matrix <- function( ) } +#' @usage NULL +HT_PHASOR_lookback <- phasor_components_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_HT_PHASOR_lookback, + ## splice:lookback:start + constructed_series[[1]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases phasor_components diff --git a/R/ta_HT_SINE.R b/R/ta_HT_SINE.R index 7de5d1d60..ad304ce74 100644 --- a/R/ta_HT_SINE.R +++ b/R/ta_HT_SINE.R @@ -113,6 +113,34 @@ sine_wave.matrix <- function( ) } +#' @usage NULL +HT_SINE_lookback <- sine_wave_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_HT_SINE_lookback, + ## splice:lookback:start + constructed_series[[1]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases sine_wave diff --git a/R/ta_HT_TRENDLINE.R b/R/ta_HT_TRENDLINE.R index 3ffbe7b8b..076497767 100644 --- a/R/ta_HT_TRENDLINE.R +++ b/R/ta_HT_TRENDLINE.R @@ -113,6 +113,34 @@ trendline.matrix <- function( ) } +#' @usage NULL +HT_TRENDLINE_lookback <- trendline_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_HT_TRENDLINE_lookback, + ## splice:lookback:start + constructed_series[[1]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases trendline diff --git a/R/ta_HT_TRENDMODE.R b/R/ta_HT_TRENDMODE.R index a3d0fc48c..34e244dc4 100644 --- a/R/ta_HT_TRENDMODE.R +++ b/R/ta_HT_TRENDMODE.R @@ -113,6 +113,34 @@ trend_cycle_mode.matrix <- function( ) } +#' @usage NULL +HT_TRENDMODE_lookback <- trend_cycle_mode_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_HT_TRENDMODE_lookback, + ## splice:lookback:start + constructed_series[[1]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases trend_cycle_mode diff --git a/R/ta_IMI.R b/R/ta_IMI.R index 753987df7..741057842 100644 --- a/R/ta_IMI.R +++ b/R/ta_IMI.R @@ -121,6 +121,37 @@ intraday_movement_index.matrix <- function( ) } +#' @usage NULL +IMI_lookback <- intraday_movement_index_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ open + close, + data = x, + ... + ) + + .Call( + C_impl_ta_IMI_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases intraday_movement_index diff --git a/R/ta_KAMA.R b/R/ta_KAMA.R index 2e02e82f2..7d3f02e82 100644 --- a/R/ta_KAMA.R +++ b/R/ta_KAMA.R @@ -170,6 +170,37 @@ kaufman_adaptive_moving_average.numeric <- function( x } +#' @usage NULL +KAMA_lookback <- kaufman_adaptive_moving_average_lookback <- function( + x, + cols, + n = 30, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_KAMA_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + as.integer(n) + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases kaufman_adaptive_moving_average #' diff --git a/R/ta_MACD.R b/R/ta_MACD.R index 5e900a280..eb2822581 100644 --- a/R/ta_MACD.R +++ b/R/ta_MACD.R @@ -137,6 +137,40 @@ moving_average_convergence_divergence.matrix <- function( ) } +#' @usage NULL +MACD_lookback <- moving_average_convergence_divergence_lookback <- function( + x, + cols, + fast = 12, + slow = 26, + signal = 9, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_MACD_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(fast), + as.integer(slow), + as.integer(signal) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases moving_average_convergence_divergence diff --git a/R/ta_MACDEXT.R b/R/ta_MACDEXT.R index 5b9b4f7b8..06dc42df5 100644 --- a/R/ta_MACDEXT.R +++ b/R/ta_MACDEXT.R @@ -140,6 +140,43 @@ extended_moving_average_convergence_divergence.matrix <- function( ) } +#' @usage NULL +MACDEXT_lookback <- extended_moving_average_convergence_divergence_lookback <- function( + x, + cols, + fast = SMA(n = 12), + slow = SMA(n = 26), + signal = SMA(n = 9), + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_MACDEXT_lookback, + ## splice:lookback:start + constructed_series[[1]], + fast$n, + fast$maType, + slow$n, + slow$maType, + signal$n, + signal$maType + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases extended_moving_average_convergence_divergence diff --git a/R/ta_MACDFIX.R b/R/ta_MACDFIX.R index 9bf9dd6da..bc3898a31 100644 --- a/R/ta_MACDFIX.R +++ b/R/ta_MACDFIX.R @@ -121,6 +121,36 @@ fixed_moving_average_convergence_divergence.matrix <- function( ) } +#' @usage NULL +MACDFIX_lookback <- fixed_moving_average_convergence_divergence_lookback <- function( + x, + cols, + signal = 9, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_MACDFIX_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(signal) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases fixed_moving_average_convergence_divergence diff --git a/R/ta_MAMA.R b/R/ta_MAMA.R index 863fe8f58..79732d898 100644 --- a/R/ta_MAMA.R +++ b/R/ta_MAMA.R @@ -189,6 +189,40 @@ mesa_adaptive_moving_average.numeric <- function( x } +#' @usage NULL +MAMA_lookback <- mesa_adaptive_moving_average_lookback <- function( + x, + cols, + n = 30, + fast = 0.5, + slow = 0.05, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_MAMA_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + as.double(fast), + as.double(slow) + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases mesa_adaptive_moving_average #' diff --git a/R/ta_MAX.R b/R/ta_MAX.R index 4f65c5298..3954acbd8 100644 --- a/R/ta_MAX.R +++ b/R/ta_MAX.R @@ -70,3 +70,17 @@ rolling_max.numeric <- function( ## return indicator as.double(x) } + +#' @usage NULL +MAX_lookback <- rolling_max_lookback <- function( + x, + n = 30 +) { + .Call( + C_impl_ta_MAX_lookback, + ## splice:lookback:start + as.double(x), + as.integer(n) + ## splice:lookback:end + ) +} diff --git a/R/ta_MEDPRICE.R b/R/ta_MEDPRICE.R index d3dbb04dc..4535323ef 100644 --- a/R/ta_MEDPRICE.R +++ b/R/ta_MEDPRICE.R @@ -113,3 +113,33 @@ median_price.matrix <- function( ... ) } + +#' @usage NULL +MEDPRICE_lookback <- median_price_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low, + data = x, + ... + ) + + .Call( + C_impl_ta_MEDPRICE_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]] + ## splice:lookback:end + ) +} diff --git a/R/ta_MFI.R b/R/ta_MFI.R index 7849841d2..0f6ef5d31 100644 --- a/R/ta_MFI.R +++ b/R/ta_MFI.R @@ -123,6 +123,39 @@ money_flow_index.matrix <- function( ) } +#' @usage NULL +MFI_lookback <- money_flow_index_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close + volume, + data = x, + ... + ) + + .Call( + C_impl_ta_MFI_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + constructed_series[[4]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases money_flow_index diff --git a/R/ta_MIDPRICE.R b/R/ta_MIDPRICE.R index ef6a798fe..05f071ed6 100644 --- a/R/ta_MIDPRICE.R +++ b/R/ta_MIDPRICE.R @@ -120,3 +120,35 @@ midpoint_price.matrix <- function( ... ) } + +#' @usage NULL +MIDPRICE_lookback <- midpoint_price_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low, + data = x, + ... + ) + + .Call( + C_impl_ta_MIDPRICE_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + as.integer(n) + ## splice:lookback:end + ) +} diff --git a/R/ta_MIN.R b/R/ta_MIN.R index d9535346e..8d4481e23 100644 --- a/R/ta_MIN.R +++ b/R/ta_MIN.R @@ -70,3 +70,17 @@ rolling_min.numeric <- function( ## return indicator as.double(x) } + +#' @usage NULL +MIN_lookback <- rolling_min_lookback <- function( + x, + n = 30 +) { + .Call( + C_impl_ta_MIN_lookback, + ## splice:lookback:start + as.double(x), + as.integer(n) + ## splice:lookback:end + ) +} diff --git a/R/ta_MINUS_DI.R b/R/ta_MINUS_DI.R index 22dcea0d3..dd54051dd 100644 --- a/R/ta_MINUS_DI.R +++ b/R/ta_MINUS_DI.R @@ -122,6 +122,38 @@ minus_directional_indicator.matrix <- function( ) } +#' @usage NULL +MINUS_DI_lookback <- minus_directional_indicator_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_MINUS_DI_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases minus_directional_indicator diff --git a/R/ta_MINUS_DM.R b/R/ta_MINUS_DM.R index c46367eee..e02717913 100644 --- a/R/ta_MINUS_DM.R +++ b/R/ta_MINUS_DM.R @@ -121,6 +121,37 @@ minus_directional_movement.matrix <- function( ) } +#' @usage NULL +MINUS_DM_lookback <- minus_directional_movement_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low, + data = x, + ... + ) + + .Call( + C_impl_ta_MINUS_DM_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases minus_directional_movement diff --git a/R/ta_MOM.R b/R/ta_MOM.R index e0d939087..24cbaf9bd 100644 --- a/R/ta_MOM.R +++ b/R/ta_MOM.R @@ -120,6 +120,36 @@ momentum.matrix <- function( ) } +#' @usage NULL +MOM_lookback <- momentum_lookback <- function( + x, + cols, + n = 10, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_MOM_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases momentum diff --git a/R/ta_NATR.R b/R/ta_NATR.R index aaa630e4a..b4f33977e 100644 --- a/R/ta_NATR.R +++ b/R/ta_NATR.R @@ -122,6 +122,38 @@ normalized_average_true_range.matrix <- function( ) } +#' @usage NULL +NATR_lookback <- normalized_average_true_range_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_NATR_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases normalized_average_true_range diff --git a/R/ta_OBV.R b/R/ta_OBV.R index 829fb3365..0d9b4c0cb 100644 --- a/R/ta_OBV.R +++ b/R/ta_OBV.R @@ -114,6 +114,35 @@ on_balance_volume.matrix <- function( ) } +#' @usage NULL +OBV_lookback <- on_balance_volume_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ close + volume, + data = x, + ... + ) + + .Call( + C_impl_ta_OBV_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases on_balance_volume diff --git a/R/ta_PLUS_DI.R b/R/ta_PLUS_DI.R index 98563a504..3e9022746 100644 --- a/R/ta_PLUS_DI.R +++ b/R/ta_PLUS_DI.R @@ -122,6 +122,38 @@ plus_directional_indicator.matrix <- function( ) } +#' @usage NULL +PLUS_DI_lookback <- plus_directional_indicator_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_PLUS_DI_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases plus_directional_indicator diff --git a/R/ta_PLUS_DM.R b/R/ta_PLUS_DM.R index b24dd5c7e..8f1615dca 100644 --- a/R/ta_PLUS_DM.R +++ b/R/ta_PLUS_DM.R @@ -121,6 +121,37 @@ plus_directional_movement.matrix <- function( ) } +#' @usage NULL +PLUS_DM_lookback <- plus_directional_movement_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low, + data = x, + ... + ) + + .Call( + C_impl_ta_PLUS_DM_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases plus_directional_movement diff --git a/R/ta_PPO.R b/R/ta_PPO.R index 509b2efc6..e5efdd757 100644 --- a/R/ta_PPO.R +++ b/R/ta_PPO.R @@ -137,6 +137,40 @@ percentage_price_oscillator.matrix <- function( ) } +#' @usage NULL +PPO_lookback <- percentage_price_oscillator_lookback <- function( + x, + cols, + fast = 12, + slow = 26, + ma = SMA(n = 9), + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_PPO_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(fast), + as.integer(slow), + ma$maType + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases percentage_price_oscillator diff --git a/R/ta_ROC.R b/R/ta_ROC.R index 554e94961..532d545c8 100644 --- a/R/ta_ROC.R +++ b/R/ta_ROC.R @@ -120,6 +120,36 @@ rate_of_change.matrix <- function( ) } +#' @usage NULL +ROC_lookback <- rate_of_change_lookback <- function( + x, + cols, + n = 10, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_ROC_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases rate_of_change diff --git a/R/ta_ROCR.R b/R/ta_ROCR.R index 64adfaad7..fb2983556 100644 --- a/R/ta_ROCR.R +++ b/R/ta_ROCR.R @@ -120,6 +120,36 @@ ratio_of_change.matrix <- function( ) } +#' @usage NULL +ROCR_lookback <- ratio_of_change_lookback <- function( + x, + cols, + n = 10, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_ROCR_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases ratio_of_change diff --git a/R/ta_RSI.R b/R/ta_RSI.R index 1d0263dfa..20e34d81c 100644 --- a/R/ta_RSI.R +++ b/R/ta_RSI.R @@ -120,6 +120,36 @@ relative_strength_index.matrix <- function( ) } +#' @usage NULL +RSI_lookback <- relative_strength_index_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_RSI_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases relative_strength_index diff --git a/R/ta_SAR.R b/R/ta_SAR.R index 948915275..8698e7a69 100644 --- a/R/ta_SAR.R +++ b/R/ta_SAR.R @@ -130,6 +130,39 @@ parabolic_stop_and_reverse.matrix <- function( ) } +#' @usage NULL +SAR_lookback <- parabolic_stop_and_reverse_lookback <- function( + x, + cols, + acceleration = 0.02, + maximum = 0.2, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low, + data = x, + ... + ) + + .Call( + C_impl_ta_SAR_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + as.double(acceleration), + as.double(maximum) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases parabolic_stop_and_reverse diff --git a/R/ta_SAREXT.R b/R/ta_SAREXT.R index 36b24f643..8229f3c74 100644 --- a/R/ta_SAREXT.R +++ b/R/ta_SAREXT.R @@ -178,6 +178,51 @@ extended_parabolic_stop_and_reverse.matrix <- function( ) } +#' @usage NULL +SAREXT_lookback <- extended_parabolic_stop_and_reverse_lookback <- function( + x, + cols, + init = 0, + offset = 0, + init_long = 0.02, + long = 0.02, + max_long = 0.2, + init_short = 0.02, + short = 0.02, + max_short = 0.2, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low, + data = x, + ... + ) + + .Call( + C_impl_ta_SAREXT_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + init, + offset, + init_long, + long, + max_long, + init_short, + short, + max_short + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases extended_parabolic_stop_and_reverse diff --git a/R/ta_SMA.R b/R/ta_SMA.R index 79c660f13..513f8f4e9 100644 --- a/R/ta_SMA.R +++ b/R/ta_SMA.R @@ -170,6 +170,37 @@ simple_moving_average.numeric <- function( x } +#' @usage NULL +SMA_lookback <- simple_moving_average_lookback <- function( + x, + cols, + n = 30, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_SMA_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + as.integer(n) + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases simple_moving_average #' diff --git a/R/ta_STDDEV.R b/R/ta_STDDEV.R index 4bc21d5ad..65dbf11d8 100644 --- a/R/ta_STDDEV.R +++ b/R/ta_STDDEV.R @@ -76,3 +76,19 @@ rolling_standard_deviation.numeric <- function( ## return indicator as.double(x) } + +#' @usage NULL +STDDEV_lookback <- rolling_standard_deviation_lookback <- function( + x, + n = 5, + k = 1 +) { + .Call( + C_impl_ta_STDDEV_lookback, + ## splice:lookback:start + as.double(x), + as.integer(n), + as.double(k) + ## splice:lookback:end + ) +} diff --git a/R/ta_STOCH.R b/R/ta_STOCH.R index 735c6aa5d..c1598beeb 100644 --- a/R/ta_STOCH.R +++ b/R/ta_STOCH.R @@ -141,6 +141,44 @@ stochastic.matrix <- function( ) } +#' @usage NULL +STOCH_lookback <- stochastic_lookback <- function( + x, + cols, + fastk = 5, + slowk = SMA(n = 3), + slowd = SMA(n = 3), + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_STOCH_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(fastk), + as.integer(slowk$n), + as.integer(slowk$maType), + as.integer(slowd$n), + as.integer(slowd$maType) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases stochastic diff --git a/R/ta_STOCHF.R b/R/ta_STOCHF.R index 77fe43ad0..28939fc24 100644 --- a/R/ta_STOCHF.R +++ b/R/ta_STOCHF.R @@ -132,6 +132,41 @@ fast_stochastic.matrix <- function( ) } +#' @usage NULL +STOCHF_lookback <- fast_stochastic_lookback <- function( + x, + cols, + fastk = 5, + fastd = SMA(n = 3), + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_STOCHF_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(fastk), + as.integer(fastd$n), + as.integer(fastd$maType) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases fast_stochastic diff --git a/R/ta_STOCHRSI.R b/R/ta_STOCHRSI.R index 8573ca9b1..6b25003a2 100644 --- a/R/ta_STOCHRSI.R +++ b/R/ta_STOCHRSI.R @@ -137,6 +137,41 @@ stochastic_relative_strength_index.matrix <- function( ) } +#' @usage NULL +STOCHRSI_lookback <- stochastic_relative_strength_index_lookback <- function( + x, + cols, + n = 14, + fastk = 5, + fastd = SMA(n = 3), + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_STOCHRSI_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(n), + as.integer(fastk), + as.integer(fastd$n), + as.integer(fastd$maType) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases stochastic_relative_strength_index diff --git a/R/ta_SUM.R b/R/ta_SUM.R index 7cdf8cef3..ce35bf8cb 100644 --- a/R/ta_SUM.R +++ b/R/ta_SUM.R @@ -70,3 +70,17 @@ rolling_sum.numeric <- function( ## return indicator as.double(x) } + +#' @usage NULL +SUM_lookback <- rolling_sum_lookback <- function( + x, + n = 30 +) { + .Call( + C_impl_ta_SUM_lookback, + ## splice:lookback:start + as.double(x), + as.integer(n) + ## splice:lookback:end + ) +} diff --git a/R/ta_T3.R b/R/ta_T3.R index 933356d9f..0ca21e85b 100644 --- a/R/ta_T3.R +++ b/R/ta_T3.R @@ -180,6 +180,39 @@ t3_exponential_moving_average.numeric <- function( x } +#' @usage NULL +T3_lookback <- t3_exponential_moving_average_lookback <- function( + x, + cols, + n = 5, + vfactor = 0.7, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_T3_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + as.integer(n), + as.double(vfactor) + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases t3_exponential_moving_average #' diff --git a/R/ta_TEMA.R b/R/ta_TEMA.R index 98857cbc2..b71a3bc8d 100644 --- a/R/ta_TEMA.R +++ b/R/ta_TEMA.R @@ -170,6 +170,37 @@ triple_exponential_moving_average.numeric <- function( x } +#' @usage NULL +TEMA_lookback <- triple_exponential_moving_average_lookback <- function( + x, + cols, + n = 30, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_TEMA_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + as.integer(n) + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases triple_exponential_moving_average #' diff --git a/R/ta_TRANGE.R b/R/ta_TRANGE.R index 943ca796c..549858324 100644 --- a/R/ta_TRANGE.R +++ b/R/ta_TRANGE.R @@ -115,6 +115,36 @@ true_range.matrix <- function( ) } +#' @usage NULL +TRANGE_lookback <- true_range_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_TRANGE_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]] + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases true_range diff --git a/R/ta_TRIMA.R b/R/ta_TRIMA.R index a63af2579..5fb5a265b 100644 --- a/R/ta_TRIMA.R +++ b/R/ta_TRIMA.R @@ -170,6 +170,37 @@ triangular_moving_average.numeric <- function( x } +#' @usage NULL +TRIMA_lookback <- triangular_moving_average_lookback <- function( + x, + cols, + n = 30, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_TRIMA_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + as.integer(n) + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases triangular_moving_average #' diff --git a/R/ta_TRIX.R b/R/ta_TRIX.R index e4b64072e..9075af450 100644 --- a/R/ta_TRIX.R +++ b/R/ta_TRIX.R @@ -120,6 +120,36 @@ triple_exponential_average.matrix <- function( ) } +#' @usage NULL +TRIX_lookback <- triple_exponential_average_lookback <- function( + x, + cols, + n = 30, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_TRIX_lookback, + ## splice:lookback:start + constructed_series[[1]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases triple_exponential_average diff --git a/R/ta_TYPPRICE.R b/R/ta_TYPPRICE.R index a1628d57f..ef6b1f07a 100644 --- a/R/ta_TYPPRICE.R +++ b/R/ta_TYPPRICE.R @@ -114,3 +114,34 @@ typical_price.matrix <- function( ... ) } + +#' @usage NULL +TYPPRICE_lookback <- typical_price_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_TYPPRICE_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]] + ## splice:lookback:end + ) +} diff --git a/R/ta_ULTOSC.R b/R/ta_ULTOSC.R index b9792b5b9..5a41dc974 100644 --- a/R/ta_ULTOSC.R +++ b/R/ta_ULTOSC.R @@ -124,6 +124,40 @@ ultimate_oscillator.matrix <- function( ) } +#' @usage NULL +ULTOSC_lookback <- ultimate_oscillator_lookback <- function( + x, + cols, + n = c(7, 14, 28), + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_ULTOSC_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n[1]), + as.integer(n[2]), + as.integer(n[3]) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases ultimate_oscillator diff --git a/R/ta_VAR.R b/R/ta_VAR.R index 092542f11..f96cdfc48 100644 --- a/R/ta_VAR.R +++ b/R/ta_VAR.R @@ -76,3 +76,19 @@ rolling_variance.numeric <- function( ## return indicator as.double(x) } + +#' @usage NULL +VAR_lookback <- rolling_variance_lookback <- function( + x, + n = 5, + k = 1 +) { + .Call( + C_impl_ta_VAR_lookback, + ## splice:lookback:start + as.double(x), + as.integer(n), + as.double(k) + ## splice:lookback:end + ) +} diff --git a/R/ta_VOLUME.R b/R/ta_VOLUME.R index f60c636d6..814a59537 100644 --- a/R/ta_VOLUME.R +++ b/R/ta_VOLUME.R @@ -128,6 +128,43 @@ trading_volume.matrix <- function( ) } +#' @usage NULL +VOLUME_lookback <- trading_volume_lookback <- function( + x, + cols, + ma = list(SMA(n = 7), SMA(n = 15)), + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ volume + open + close, + data = x, + ... + ) + + .Call( + C_impl_ta_VOLUME_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + lapply( + ma, + function(x) { + as.integer( + unlist(x, use.names = FALSE) + ) + } + ) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases trading_volume diff --git a/R/ta_WCLPRICE.R b/R/ta_WCLPRICE.R index f0e20bbfe..b4940943f 100644 --- a/R/ta_WCLPRICE.R +++ b/R/ta_WCLPRICE.R @@ -114,3 +114,34 @@ weighted_close_price.matrix <- function( ... ) } + +#' @usage NULL +WCLPRICE_lookback <- weighted_close_price_lookback <- function( + x, + cols, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_WCLPRICE_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]] + ## splice:lookback:end + ) +} diff --git a/R/ta_WILLR.R b/R/ta_WILLR.R index 21c0a78de..2f48ea2a9 100644 --- a/R/ta_WILLR.R +++ b/R/ta_WILLR.R @@ -122,6 +122,38 @@ williams_oscillator.matrix <- function( ) } +#' @usage NULL +WILLR_lookback <- williams_oscillator_lookback <- function( + x, + cols, + n = 14, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~ high + low + close, + data = x, + ... + ) + + .Call( + C_impl_ta_WILLR_lookback, + ## splice:lookback:start + constructed_series[[1]], + constructed_series[[2]], + constructed_series[[3]], + as.integer(n) + ## splice:lookback:end + ) +} #' @usage NULL #' @aliases williams_oscillator diff --git a/R/ta_WMA.R b/R/ta_WMA.R index 7053c48e2..b77865f9d 100644 --- a/R/ta_WMA.R +++ b/R/ta_WMA.R @@ -170,6 +170,37 @@ weighted_moving_average.numeric <- function( x } +#' @usage NULL +WMA_lookback <- weighted_moving_average_lookback <- function( + x, + cols, + n = 30, + ... +) { + ## validate 'cols'-argument + ## if explicitly passed + if (!missing(cols)) { + assert_formula(cols) + } + + ## construct series + ## from input + constructed_series <- series( + x = cols, + default_formula = ~close, + data = x, + ... + ) + + .Call( + C_impl_ta_WMA_lookback, + ## splice:lookback:start + as.double(constructed_series[[1]]), + as.integer(n) + ## splice:lookback:end + ) +} + #' @usage NULL #' @aliases weighted_moving_average #' diff --git a/src/api.h b/src/api.h index a119d9431..60b94db16 100644 --- a/src/api.h +++ b/src/api.h @@ -5,133 +5,260 @@ #include // clang-format off +SEXP impl_ta_ACCBANDS_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_ACCBANDS(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_AD_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP inVolume); +SEXP impl_ta_ADOSC_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP inVolume, SEXP optInFastPeriod, SEXP optInSlowPeriod); SEXP impl_ta_ADOSC(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP inVolume, SEXP optInFastPeriod, SEXP optInSlowPeriod, SEXP na_bridge); SEXP impl_ta_AD(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP inVolume, SEXP na_bridge); +SEXP impl_ta_ADX_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); +SEXP impl_ta_ADXR_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_ADXR(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); SEXP impl_ta_ADX(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_APO_lookback(SEXP inReal, SEXP optInFastPeriod, SEXP optInSlowPeriod, SEXP optInMAType); SEXP impl_ta_APO(SEXP inReal, SEXP optInFastPeriod, SEXP optInSlowPeriod, SEXP optInMAType, SEXP na_bridge); +SEXP impl_ta_AROON_lookback(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod); +SEXP impl_ta_AROONOSC_lookback(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod); SEXP impl_ta_AROONOSC(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod, SEXP na_bridge); SEXP impl_ta_AROON(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_ATR_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_ATR(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_AVGPRICE_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_AVGPRICE(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP na_bridge); +SEXP impl_ta_BBANDS_lookback(SEXP inReal, SEXP optInTimePeriod, SEXP optInNbDevUp, SEXP optInNbDevDn, SEXP optInMAType); SEXP impl_ta_BBANDS(SEXP inReal, SEXP optInTimePeriod, SEXP optInNbDevUp, SEXP optInNbDevDn, SEXP optInMAType, SEXP na_bridge); +SEXP impl_ta_BETA_lookback(SEXP inReal0, SEXP inReal1, SEXP optInTimePeriod); SEXP impl_ta_BETA(SEXP inReal0, SEXP inReal1, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_BOP_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_BOP(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP na_bridge); +SEXP impl_ta_CCI_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_CCI(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_CDL2CROWS_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDL2CROWS(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDL3BLACKCROWS_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDL3BLACKCROWS(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDL3INSIDE_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDL3INSIDE(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDL3LINESTRIKE_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDL3LINESTRIKE(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDL3OUTSIDE_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDL3OUTSIDE(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDL3STARSINSOUTH_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDL3STARSINSOUTH(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDL3WHITESOLDIERS_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDL3WHITESOLDIERS(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLABANDONEDBABY_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration); SEXP impl_ta_CDLABANDONEDBABY(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLADVANCEBLOCK_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLADVANCEBLOCK(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLBELTHOLD_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLBELTHOLD(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLBREAKAWAY_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLBREAKAWAY(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLCLOSINGMARUBOZU_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLCLOSINGMARUBOZU(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLCONCEALBABYSWALL_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLCONCEALBABYSWALL(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLCOUNTERATTACK_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLCOUNTERATTACK(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLDARKCLOUDCOVER_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration); SEXP impl_ta_CDLDARKCLOUDCOVER(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLDOJI_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLDOJI(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLDOJISTAR_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLDOJISTAR(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLDRAGONFLYDOJI_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLDRAGONFLYDOJI(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLENGULFING_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLENGULFING(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLEVENINGDOJISTAR_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration); SEXP impl_ta_CDLEVENINGDOJISTAR(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLEVENINGSTAR_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration); SEXP impl_ta_CDLEVENINGSTAR(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLGAPSIDESIDEWHITE_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLGAPSIDESIDEWHITE(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLGRAVESTONEDOJI_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLGRAVESTONEDOJI(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLHAMMER_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLHAMMER(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLHANGINGMAN_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLHANGINGMAN(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLHARAMICROSS_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLHARAMICROSS(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLHARAMI_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLHARAMI(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLHIGHWAVE_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLHIGHWAVE(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLHIKKAKE_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); +SEXP impl_ta_CDLHIKKAKEMOD_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLHIKKAKEMOD(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); SEXP impl_ta_CDLHIKKAKE(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLHOMINGPIGEON_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLHOMINGPIGEON(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLIDENTICAL3CROWS_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLIDENTICAL3CROWS(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLINNECK_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLINNECK(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLINVERTEDHAMMER_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLINVERTEDHAMMER(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLKICKINGBYLENGTH_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLKICKINGBYLENGTH(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLKICKING_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLKICKING(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLLADDERBOTTOM_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLLADDERBOTTOM(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLLONGLEGGEDDOJI_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLLONGLEGGEDDOJI(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLLONGLINE_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLLONGLINE(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLMARUBOZU_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLMARUBOZU(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLMATCHINGLOW_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLMATCHINGLOW(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLMATHOLD_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration); SEXP impl_ta_CDLMATHOLD(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLMORNINGDOJISTAR_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration); SEXP impl_ta_CDLMORNINGDOJISTAR(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLMORNINGSTAR_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration); SEXP impl_ta_CDLMORNINGSTAR(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInPenetration, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLONNECK_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLONNECK(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLPIERCING_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLPIERCING(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLRICKSHAWMAN_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLRICKSHAWMAN(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLRISEFALL3METHODS_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLRISEFALL3METHODS(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLSEPARATINGLINES_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLSEPARATINGLINES(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLSHOOTINGSTAR_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLSHOOTINGSTAR(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLSHORTLINE_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLSHORTLINE(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLSPINNINGTOP_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLSPINNINGTOP(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLSTALLEDPATTERN_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLSTALLEDPATTERN(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLSTICKSANDWICH_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLSTICKSANDWICH(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLTAKURI_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLTAKURI(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLTASUKIGAP_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLTASUKIGAP(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLTHRUSTING_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLTHRUSTING(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLTRISTAR_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLTRISTAR(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLUNIQUE3RIVER_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLUNIQUE3RIVER(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLUPSIDEGAP2CROWS_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLUPSIDEGAP2CROWS(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CDLXSIDEGAP3METHODS_lookback(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_CDLXSIDEGAP3METHODS(SEXP inOpen, SEXP inHigh, SEXP inLow, SEXP inClose, SEXP flag, SEXP na_bridge); +SEXP impl_ta_CMO_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_CMO(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_CORREL_lookback(SEXP inReal0, SEXP inReal1, SEXP optInTimePeriod); SEXP impl_ta_CORREL(SEXP inReal0, SEXP inReal1, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_DEMA_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_DEMA(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_DX_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_DX(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_EMA_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_EMA(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_HT_DCPERIOD_lookback(SEXP inReal); SEXP impl_ta_HT_DCPERIOD(SEXP inReal, SEXP na_bridge); +SEXP impl_ta_HT_DCPHASE_lookback(SEXP inReal); SEXP impl_ta_HT_DCPHASE(SEXP inReal, SEXP na_bridge); +SEXP impl_ta_HT_PHASOR_lookback(SEXP inReal); SEXP impl_ta_HT_PHASOR(SEXP inReal, SEXP na_bridge); +SEXP impl_ta_HT_SINE_lookback(SEXP inReal); SEXP impl_ta_HT_SINE(SEXP inReal, SEXP na_bridge); +SEXP impl_ta_HT_TRENDLINE_lookback(SEXP inReal); SEXP impl_ta_HT_TRENDLINE(SEXP inReal, SEXP na_bridge); +SEXP impl_ta_HT_TRENDMODE_lookback(SEXP inReal); SEXP impl_ta_HT_TRENDMODE(SEXP inReal, SEXP na_bridge); +SEXP impl_ta_IMI_lookback(SEXP inOpen, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_IMI(SEXP inOpen, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_KAMA_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_KAMA(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_MACDEXT_lookback(SEXP inReal, SEXP optInFastPeriod, SEXP optInFastMAType, SEXP optInSlowPeriod, SEXP optInSlowMAType, SEXP optInSignalPeriod, SEXP optInSignalMAType); SEXP impl_ta_MACDEXT(SEXP inReal, SEXP optInFastPeriod, SEXP optInFastMAType, SEXP optInSlowPeriod, SEXP optInSlowMAType, SEXP optInSignalPeriod, SEXP optInSignalMAType, SEXP na_bridge); +SEXP impl_ta_MACDFIX_lookback(SEXP inReal, SEXP optInSignalPeriod); SEXP impl_ta_MACDFIX(SEXP inReal, SEXP optInSignalPeriod, SEXP na_bridge); +SEXP impl_ta_MACD_lookback(SEXP inReal, SEXP optInFastPeriod, SEXP optInSlowPeriod, SEXP optInSignalPeriod); SEXP impl_ta_MACD(SEXP inReal, SEXP optInFastPeriod, SEXP optInSlowPeriod, SEXP optInSignalPeriod, SEXP na_bridge); +SEXP impl_ta_MAMA_lookback(SEXP inReal, SEXP optInFastLimit, SEXP optInSlowLimit); SEXP impl_ta_MAMA(SEXP inReal, SEXP optInFastLimit, SEXP optInSlowLimit, SEXP na_bridge); +SEXP impl_ta_MAX_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_MAX(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_MEDPRICE_lookback(SEXP inHigh, SEXP inLow); SEXP impl_ta_MEDPRICE(SEXP inHigh, SEXP inLow, SEXP na_bridge); +SEXP impl_ta_MFI_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP inVolume, SEXP optInTimePeriod); SEXP impl_ta_MFI(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP inVolume, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_MIDPRICE_lookback(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod); SEXP impl_ta_MIDPRICE(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_MIN_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_MIN(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_MINUS_DI_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_MINUS_DI(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_MINUS_DM_lookback(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod); SEXP impl_ta_MINUS_DM(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_MOM_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_MOM(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_NATR_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_NATR(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_OBV_lookback(SEXP inReal, SEXP inVolume); SEXP impl_ta_OBV(SEXP inReal, SEXP inVolume, SEXP na_bridge); +SEXP impl_ta_PLUS_DI_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_PLUS_DI(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_PLUS_DM_lookback(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod); SEXP impl_ta_PLUS_DM(SEXP inHigh, SEXP inLow, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_PPO_lookback(SEXP inReal, SEXP optInFastPeriod, SEXP optInSlowPeriod, SEXP optInMAType); SEXP impl_ta_PPO(SEXP inReal, SEXP optInFastPeriod, SEXP optInSlowPeriod, SEXP optInMAType, SEXP na_bridge); +SEXP impl_ta_ROC_lookback(SEXP inReal, SEXP optInTimePeriod); +SEXP impl_ta_ROCR_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_ROCR(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); SEXP impl_ta_ROC(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_RSI_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_RSI(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_SAREXT_lookback(SEXP inHigh, SEXP inLow, SEXP optInStartValue, SEXP optInOffsetOnReverse, SEXP optInAccelerationInitLong, SEXP optInAccelerationLong, SEXP optInAccelerationMaxLong, SEXP optInAccelerationInitShort, SEXP optInAccelerationShort, SEXP optInAccelerationMaxShort); SEXP impl_ta_SAREXT(SEXP inHigh, SEXP inLow, SEXP optInStartValue, SEXP optInOffsetOnReverse, SEXP optInAccelerationInitLong, SEXP optInAccelerationLong, SEXP optInAccelerationMaxLong, SEXP optInAccelerationInitShort, SEXP optInAccelerationShort, SEXP optInAccelerationMaxShort, SEXP na_bridge); +SEXP impl_ta_SAR_lookback(SEXP inHigh, SEXP inLow, SEXP optInAcceleration, SEXP optInMaximum); SEXP impl_ta_SAR(SEXP inHigh, SEXP inLow, SEXP optInAcceleration, SEXP optInMaximum, SEXP na_bridge); +SEXP impl_ta_SMA_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_SMA(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_STDDEV_lookback(SEXP inReal, SEXP optInTimePeriod, SEXP optInNbDev); SEXP impl_ta_STDDEV(SEXP inReal, SEXP optInTimePeriod, SEXP optInNbDev, SEXP na_bridge); +SEXP impl_ta_STOCHF_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInFastK_Period, SEXP optInFastD_Period, SEXP optInFastD_MAType); SEXP impl_ta_STOCHF(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInFastK_Period, SEXP optInFastD_Period, SEXP optInFastD_MAType, SEXP na_bridge); +SEXP impl_ta_STOCH_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInFastK_Period, SEXP optInSlowK_Period, SEXP optInSlowK_MAType, SEXP optInSlowD_Period, SEXP optInSlowD_MAType); +SEXP impl_ta_STOCHRSI_lookback(SEXP inReal, SEXP optInTimePeriod, SEXP optInFastK_Period, SEXP optInFastD_Period, SEXP optInFastD_MAType); SEXP impl_ta_STOCHRSI(SEXP inReal, SEXP optInTimePeriod, SEXP optInFastK_Period, SEXP optInFastD_Period, SEXP optInFastD_MAType, SEXP na_bridge); SEXP impl_ta_STOCH(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInFastK_Period, SEXP optInSlowK_Period, SEXP optInSlowK_MAType, SEXP optInSlowD_Period, SEXP optInSlowD_MAType, SEXP na_bridge); +SEXP impl_ta_SUM_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_SUM(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_T3_lookback(SEXP inReal, SEXP optInTimePeriod, SEXP optInVFactor); SEXP impl_ta_T3(SEXP inReal, SEXP optInTimePeriod, SEXP optInVFactor, SEXP na_bridge); +SEXP impl_ta_TEMA_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_TEMA(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_TRANGE_lookback(SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_TRANGE(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP na_bridge); +SEXP impl_ta_TRIMA_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_TRIMA(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_TRIX_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_TRIX(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_TYPPRICE_lookback(SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_TYPPRICE(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP na_bridge); +SEXP impl_ta_ULTOSC_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod1, SEXP optInTimePeriod2, SEXP optInTimePeriod3); SEXP impl_ta_ULTOSC(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod1, SEXP optInTimePeriod2, SEXP optInTimePeriod3, SEXP na_bridge); +SEXP impl_ta_VAR_lookback(SEXP inReal, SEXP optInTimePeriod, SEXP optInNbDev); SEXP impl_ta_VAR(SEXP inReal, SEXP optInTimePeriod, SEXP optInNbDev, SEXP na_bridge); SEXP impl_ta_VOLUME(SEXP inReal, SEXP maSpec, SEXP na_rm); +SEXP impl_ta_WCLPRICE_lookback(SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_WCLPRICE(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP na_bridge); +SEXP impl_ta_WILLR_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod); SEXP impl_ta_WILLR(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod, SEXP na_bridge); +SEXP impl_ta_WMA_lookback(SEXP inReal, SEXP optInTimePeriod); SEXP impl_ta_WMA(SEXP inReal, SEXP optInTimePeriod, SEXP na_bridge); SEXP initialize_ta_lib(void); SEXP map_dfr_double(SEXP x); diff --git a/src/init.c b/src/init.c index a245ced9f..03c9a99dd 100644 --- a/src/init.c +++ b/src/init.c @@ -11,133 +11,260 @@ // clang-format on static const R_CallMethodDef CallEntries[] = { + CALLDEF(impl_ta_ACCBANDS_lookback, 4), CALLDEF(impl_ta_ACCBANDS, 5), + CALLDEF(impl_ta_AD_lookback, 4), + CALLDEF(impl_ta_ADOSC_lookback, 6), CALLDEF(impl_ta_ADOSC, 7), CALLDEF(impl_ta_AD, 5), + CALLDEF(impl_ta_ADX_lookback, 4), + CALLDEF(impl_ta_ADXR_lookback, 4), CALLDEF(impl_ta_ADXR, 5), CALLDEF(impl_ta_ADX, 5), + CALLDEF(impl_ta_APO_lookback, 4), CALLDEF(impl_ta_APO, 5), + CALLDEF(impl_ta_AROON_lookback, 3), + CALLDEF(impl_ta_AROONOSC_lookback, 3), CALLDEF(impl_ta_AROONOSC, 4), CALLDEF(impl_ta_AROON, 4), + CALLDEF(impl_ta_ATR_lookback, 4), CALLDEF(impl_ta_ATR, 5), + CALLDEF(impl_ta_AVGPRICE_lookback, 4), CALLDEF(impl_ta_AVGPRICE, 5), + CALLDEF(impl_ta_BBANDS_lookback, 5), CALLDEF(impl_ta_BBANDS, 6), + CALLDEF(impl_ta_BETA_lookback, 3), CALLDEF(impl_ta_BETA, 4), + CALLDEF(impl_ta_BOP_lookback, 4), CALLDEF(impl_ta_BOP, 5), + CALLDEF(impl_ta_CCI_lookback, 4), CALLDEF(impl_ta_CCI, 5), + CALLDEF(impl_ta_CDL2CROWS_lookback, 4), CALLDEF(impl_ta_CDL2CROWS, 6), + CALLDEF(impl_ta_CDL3BLACKCROWS_lookback, 4), CALLDEF(impl_ta_CDL3BLACKCROWS, 6), + CALLDEF(impl_ta_CDL3INSIDE_lookback, 4), CALLDEF(impl_ta_CDL3INSIDE, 6), + CALLDEF(impl_ta_CDL3LINESTRIKE_lookback, 4), CALLDEF(impl_ta_CDL3LINESTRIKE, 6), + CALLDEF(impl_ta_CDL3OUTSIDE_lookback, 4), CALLDEF(impl_ta_CDL3OUTSIDE, 6), + CALLDEF(impl_ta_CDL3STARSINSOUTH_lookback, 4), CALLDEF(impl_ta_CDL3STARSINSOUTH, 6), + CALLDEF(impl_ta_CDL3WHITESOLDIERS_lookback, 4), CALLDEF(impl_ta_CDL3WHITESOLDIERS, 6), + CALLDEF(impl_ta_CDLABANDONEDBABY_lookback, 5), CALLDEF(impl_ta_CDLABANDONEDBABY, 7), + CALLDEF(impl_ta_CDLADVANCEBLOCK_lookback, 4), CALLDEF(impl_ta_CDLADVANCEBLOCK, 6), + CALLDEF(impl_ta_CDLBELTHOLD_lookback, 4), CALLDEF(impl_ta_CDLBELTHOLD, 6), + CALLDEF(impl_ta_CDLBREAKAWAY_lookback, 4), CALLDEF(impl_ta_CDLBREAKAWAY, 6), + CALLDEF(impl_ta_CDLCLOSINGMARUBOZU_lookback, 4), CALLDEF(impl_ta_CDLCLOSINGMARUBOZU, 6), + CALLDEF(impl_ta_CDLCONCEALBABYSWALL_lookback, 4), CALLDEF(impl_ta_CDLCONCEALBABYSWALL, 6), + CALLDEF(impl_ta_CDLCOUNTERATTACK_lookback, 4), CALLDEF(impl_ta_CDLCOUNTERATTACK, 6), + CALLDEF(impl_ta_CDLDARKCLOUDCOVER_lookback, 5), CALLDEF(impl_ta_CDLDARKCLOUDCOVER, 7), + CALLDEF(impl_ta_CDLDOJI_lookback, 4), CALLDEF(impl_ta_CDLDOJI, 6), + CALLDEF(impl_ta_CDLDOJISTAR_lookback, 4), CALLDEF(impl_ta_CDLDOJISTAR, 6), + CALLDEF(impl_ta_CDLDRAGONFLYDOJI_lookback, 4), CALLDEF(impl_ta_CDLDRAGONFLYDOJI, 6), + CALLDEF(impl_ta_CDLENGULFING_lookback, 4), CALLDEF(impl_ta_CDLENGULFING, 6), + CALLDEF(impl_ta_CDLEVENINGDOJISTAR_lookback, 5), CALLDEF(impl_ta_CDLEVENINGDOJISTAR, 7), + CALLDEF(impl_ta_CDLEVENINGSTAR_lookback, 5), CALLDEF(impl_ta_CDLEVENINGSTAR, 7), + CALLDEF(impl_ta_CDLGAPSIDESIDEWHITE_lookback, 4), CALLDEF(impl_ta_CDLGAPSIDESIDEWHITE, 6), + CALLDEF(impl_ta_CDLGRAVESTONEDOJI_lookback, 4), CALLDEF(impl_ta_CDLGRAVESTONEDOJI, 6), + CALLDEF(impl_ta_CDLHAMMER_lookback, 4), CALLDEF(impl_ta_CDLHAMMER, 6), + CALLDEF(impl_ta_CDLHANGINGMAN_lookback, 4), CALLDEF(impl_ta_CDLHANGINGMAN, 6), + CALLDEF(impl_ta_CDLHARAMICROSS_lookback, 4), CALLDEF(impl_ta_CDLHARAMICROSS, 6), + CALLDEF(impl_ta_CDLHARAMI_lookback, 4), CALLDEF(impl_ta_CDLHARAMI, 6), + CALLDEF(impl_ta_CDLHIGHWAVE_lookback, 4), CALLDEF(impl_ta_CDLHIGHWAVE, 6), + CALLDEF(impl_ta_CDLHIKKAKE_lookback, 4), + CALLDEF(impl_ta_CDLHIKKAKEMOD_lookback, 4), CALLDEF(impl_ta_CDLHIKKAKEMOD, 6), CALLDEF(impl_ta_CDLHIKKAKE, 6), + CALLDEF(impl_ta_CDLHOMINGPIGEON_lookback, 4), CALLDEF(impl_ta_CDLHOMINGPIGEON, 6), + CALLDEF(impl_ta_CDLIDENTICAL3CROWS_lookback, 4), CALLDEF(impl_ta_CDLIDENTICAL3CROWS, 6), + CALLDEF(impl_ta_CDLINNECK_lookback, 4), CALLDEF(impl_ta_CDLINNECK, 6), + CALLDEF(impl_ta_CDLINVERTEDHAMMER_lookback, 4), CALLDEF(impl_ta_CDLINVERTEDHAMMER, 6), + CALLDEF(impl_ta_CDLKICKINGBYLENGTH_lookback, 4), CALLDEF(impl_ta_CDLKICKINGBYLENGTH, 6), + CALLDEF(impl_ta_CDLKICKING_lookback, 4), CALLDEF(impl_ta_CDLKICKING, 6), + CALLDEF(impl_ta_CDLLADDERBOTTOM_lookback, 4), CALLDEF(impl_ta_CDLLADDERBOTTOM, 6), + CALLDEF(impl_ta_CDLLONGLEGGEDDOJI_lookback, 4), CALLDEF(impl_ta_CDLLONGLEGGEDDOJI, 6), + CALLDEF(impl_ta_CDLLONGLINE_lookback, 4), CALLDEF(impl_ta_CDLLONGLINE, 6), + CALLDEF(impl_ta_CDLMARUBOZU_lookback, 4), CALLDEF(impl_ta_CDLMARUBOZU, 6), + CALLDEF(impl_ta_CDLMATCHINGLOW_lookback, 4), CALLDEF(impl_ta_CDLMATCHINGLOW, 6), + CALLDEF(impl_ta_CDLMATHOLD_lookback, 5), CALLDEF(impl_ta_CDLMATHOLD, 7), + CALLDEF(impl_ta_CDLMORNINGDOJISTAR_lookback, 5), CALLDEF(impl_ta_CDLMORNINGDOJISTAR, 7), + CALLDEF(impl_ta_CDLMORNINGSTAR_lookback, 5), CALLDEF(impl_ta_CDLMORNINGSTAR, 7), + CALLDEF(impl_ta_CDLONNECK_lookback, 4), CALLDEF(impl_ta_CDLONNECK, 6), + CALLDEF(impl_ta_CDLPIERCING_lookback, 4), CALLDEF(impl_ta_CDLPIERCING, 6), + CALLDEF(impl_ta_CDLRICKSHAWMAN_lookback, 4), CALLDEF(impl_ta_CDLRICKSHAWMAN, 6), + CALLDEF(impl_ta_CDLRISEFALL3METHODS_lookback, 4), CALLDEF(impl_ta_CDLRISEFALL3METHODS, 6), + CALLDEF(impl_ta_CDLSEPARATINGLINES_lookback, 4), CALLDEF(impl_ta_CDLSEPARATINGLINES, 6), + CALLDEF(impl_ta_CDLSHOOTINGSTAR_lookback, 4), CALLDEF(impl_ta_CDLSHOOTINGSTAR, 6), + CALLDEF(impl_ta_CDLSHORTLINE_lookback, 4), CALLDEF(impl_ta_CDLSHORTLINE, 6), + CALLDEF(impl_ta_CDLSPINNINGTOP_lookback, 4), CALLDEF(impl_ta_CDLSPINNINGTOP, 6), + CALLDEF(impl_ta_CDLSTALLEDPATTERN_lookback, 4), CALLDEF(impl_ta_CDLSTALLEDPATTERN, 6), + CALLDEF(impl_ta_CDLSTICKSANDWICH_lookback, 4), CALLDEF(impl_ta_CDLSTICKSANDWICH, 6), + CALLDEF(impl_ta_CDLTAKURI_lookback, 4), CALLDEF(impl_ta_CDLTAKURI, 6), + CALLDEF(impl_ta_CDLTASUKIGAP_lookback, 4), CALLDEF(impl_ta_CDLTASUKIGAP, 6), + CALLDEF(impl_ta_CDLTHRUSTING_lookback, 4), CALLDEF(impl_ta_CDLTHRUSTING, 6), + CALLDEF(impl_ta_CDLTRISTAR_lookback, 4), CALLDEF(impl_ta_CDLTRISTAR, 6), + CALLDEF(impl_ta_CDLUNIQUE3RIVER_lookback, 4), CALLDEF(impl_ta_CDLUNIQUE3RIVER, 6), + CALLDEF(impl_ta_CDLUPSIDEGAP2CROWS_lookback, 4), CALLDEF(impl_ta_CDLUPSIDEGAP2CROWS, 6), + CALLDEF(impl_ta_CDLXSIDEGAP3METHODS_lookback, 4), CALLDEF(impl_ta_CDLXSIDEGAP3METHODS, 6), + CALLDEF(impl_ta_CMO_lookback, 2), CALLDEF(impl_ta_CMO, 3), + CALLDEF(impl_ta_CORREL_lookback, 3), CALLDEF(impl_ta_CORREL, 4), + CALLDEF(impl_ta_DEMA_lookback, 2), CALLDEF(impl_ta_DEMA, 3), + CALLDEF(impl_ta_DX_lookback, 4), CALLDEF(impl_ta_DX, 5), + CALLDEF(impl_ta_EMA_lookback, 2), CALLDEF(impl_ta_EMA, 3), + CALLDEF(impl_ta_HT_DCPERIOD_lookback, 1), CALLDEF(impl_ta_HT_DCPERIOD, 2), + CALLDEF(impl_ta_HT_DCPHASE_lookback, 1), CALLDEF(impl_ta_HT_DCPHASE, 2), + CALLDEF(impl_ta_HT_PHASOR_lookback, 1), CALLDEF(impl_ta_HT_PHASOR, 2), + CALLDEF(impl_ta_HT_SINE_lookback, 1), CALLDEF(impl_ta_HT_SINE, 2), + CALLDEF(impl_ta_HT_TRENDLINE_lookback, 1), CALLDEF(impl_ta_HT_TRENDLINE, 2), + CALLDEF(impl_ta_HT_TRENDMODE_lookback, 1), CALLDEF(impl_ta_HT_TRENDMODE, 2), + CALLDEF(impl_ta_IMI_lookback, 3), CALLDEF(impl_ta_IMI, 4), + CALLDEF(impl_ta_KAMA_lookback, 2), CALLDEF(impl_ta_KAMA, 3), + CALLDEF(impl_ta_MACDEXT_lookback, 7), CALLDEF(impl_ta_MACDEXT, 8), + CALLDEF(impl_ta_MACDFIX_lookback, 2), CALLDEF(impl_ta_MACDFIX, 3), + CALLDEF(impl_ta_MACD_lookback, 4), CALLDEF(impl_ta_MACD, 5), + CALLDEF(impl_ta_MAMA_lookback, 3), CALLDEF(impl_ta_MAMA, 4), + CALLDEF(impl_ta_MAX_lookback, 2), CALLDEF(impl_ta_MAX, 3), + CALLDEF(impl_ta_MEDPRICE_lookback, 2), CALLDEF(impl_ta_MEDPRICE, 3), + CALLDEF(impl_ta_MFI_lookback, 5), CALLDEF(impl_ta_MFI, 6), + CALLDEF(impl_ta_MIDPRICE_lookback, 3), CALLDEF(impl_ta_MIDPRICE, 4), + CALLDEF(impl_ta_MIN_lookback, 2), CALLDEF(impl_ta_MIN, 3), + CALLDEF(impl_ta_MINUS_DI_lookback, 4), CALLDEF(impl_ta_MINUS_DI, 5), + CALLDEF(impl_ta_MINUS_DM_lookback, 3), CALLDEF(impl_ta_MINUS_DM, 4), + CALLDEF(impl_ta_MOM_lookback, 2), CALLDEF(impl_ta_MOM, 3), + CALLDEF(impl_ta_NATR_lookback, 4), CALLDEF(impl_ta_NATR, 5), + CALLDEF(impl_ta_OBV_lookback, 2), CALLDEF(impl_ta_OBV, 3), + CALLDEF(impl_ta_PLUS_DI_lookback, 4), CALLDEF(impl_ta_PLUS_DI, 5), + CALLDEF(impl_ta_PLUS_DM_lookback, 3), CALLDEF(impl_ta_PLUS_DM, 4), + CALLDEF(impl_ta_PPO_lookback, 4), CALLDEF(impl_ta_PPO, 5), + CALLDEF(impl_ta_ROC_lookback, 2), + CALLDEF(impl_ta_ROCR_lookback, 2), CALLDEF(impl_ta_ROCR, 3), CALLDEF(impl_ta_ROC, 3), + CALLDEF(impl_ta_RSI_lookback, 2), CALLDEF(impl_ta_RSI, 3), + CALLDEF(impl_ta_SAREXT_lookback, 10), CALLDEF(impl_ta_SAREXT, 11), + CALLDEF(impl_ta_SAR_lookback, 4), CALLDEF(impl_ta_SAR, 5), + CALLDEF(impl_ta_SMA_lookback, 2), CALLDEF(impl_ta_SMA, 3), + CALLDEF(impl_ta_STDDEV_lookback, 3), CALLDEF(impl_ta_STDDEV, 4), + CALLDEF(impl_ta_STOCHF_lookback, 6), CALLDEF(impl_ta_STOCHF, 7), + CALLDEF(impl_ta_STOCH_lookback, 8), + CALLDEF(impl_ta_STOCHRSI_lookback, 5), CALLDEF(impl_ta_STOCHRSI, 6), CALLDEF(impl_ta_STOCH, 9), + CALLDEF(impl_ta_SUM_lookback, 2), CALLDEF(impl_ta_SUM, 3), + CALLDEF(impl_ta_T3_lookback, 3), CALLDEF(impl_ta_T3, 4), + CALLDEF(impl_ta_TEMA_lookback, 2), CALLDEF(impl_ta_TEMA, 3), + CALLDEF(impl_ta_TRANGE_lookback, 3), CALLDEF(impl_ta_TRANGE, 4), + CALLDEF(impl_ta_TRIMA_lookback, 2), CALLDEF(impl_ta_TRIMA, 3), + CALLDEF(impl_ta_TRIX_lookback, 2), CALLDEF(impl_ta_TRIX, 3), + CALLDEF(impl_ta_TYPPRICE_lookback, 3), CALLDEF(impl_ta_TYPPRICE, 4), + CALLDEF(impl_ta_ULTOSC_lookback, 6), CALLDEF(impl_ta_ULTOSC, 7), + CALLDEF(impl_ta_VAR_lookback, 3), CALLDEF(impl_ta_VAR, 4), CALLDEF(impl_ta_VOLUME, 3), + CALLDEF(impl_ta_WCLPRICE_lookback, 3), CALLDEF(impl_ta_WCLPRICE, 4), + CALLDEF(impl_ta_WILLR_lookback, 4), CALLDEF(impl_ta_WILLR, 5), + CALLDEF(impl_ta_WMA_lookback, 2), CALLDEF(impl_ta_WMA, 3), CALLDEF(initialize_ta_lib, 0), CALLDEF(map_dfr_double, 1), diff --git a/src/ta_ACCBANDS.c b/src/ta_ACCBANDS.c index 7fc4a395c..71a71a48f 100644 --- a/src/ta_ACCBANDS.c +++ b/src/ta_ACCBANDS.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_ACCBANDS_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_ACCBANDS_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_ACCBANDS( SEXP inHigh, diff --git a/src/ta_AD.c b/src/ta_AD.c index 0b765e71d..62527a62d 100644 --- a/src/ta_AD.c +++ b/src/ta_AD.c @@ -24,6 +24,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_AD_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP inVolume +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + const double *inVolume_ptr = REAL(inVolume); + + // calculate lookback + const int lookback = TA_AD_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_AD( SEXP inHigh, diff --git a/src/ta_ADOSC.c b/src/ta_ADOSC.c index f1dca97c6..eaeae84df 100644 --- a/src/ta_ADOSC.c +++ b/src/ta_ADOSC.c @@ -26,6 +26,45 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_ADOSC_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP inVolume, + SEXP optInFastPeriod, + SEXP optInSlowPeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + const double *inVolume_ptr = REAL(inVolume); + + // extract input values + const int optInFastPeriod_value = INTEGER(optInFastPeriod)[0]; + const int optInSlowPeriod_value = INTEGER(optInSlowPeriod)[0]; + + // calculate lookback + const int lookback = + TA_ADOSC_Lookback(optInFastPeriod_value, optInSlowPeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_ADOSC( SEXP inHigh, diff --git a/src/ta_ADX.c b/src/ta_ADX.c index 1a066ab49..7331352c1 100644 --- a/src/ta_ADX.c +++ b/src/ta_ADX.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_ADX_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_ADX_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_ADX( SEXP inHigh, diff --git a/src/ta_ADXR.c b/src/ta_ADXR.c index 90dda8633..411617765 100644 --- a/src/ta_ADXR.c +++ b/src/ta_ADXR.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_ADXR_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_ADXR_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_ADXR( SEXP inHigh, diff --git a/src/ta_APO.c b/src/ta_APO.c index f71189e3c..f3892627d 100644 --- a/src/ta_APO.c +++ b/src/ta_APO.c @@ -24,6 +24,43 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_APO_lookback( + SEXP inReal, + SEXP optInFastPeriod, + SEXP optInSlowPeriod, + SEXP optInMAType +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInFastPeriod_value = INTEGER(optInFastPeriod)[0]; + const int optInSlowPeriod_value = INTEGER(optInSlowPeriod)[0]; + const TA_MAType optInMAType_value = as_MAType(optInMAType); + + // calculate lookback + const int lookback = TA_APO_Lookback( + optInFastPeriod_value, + optInSlowPeriod_value, + optInMAType_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_APO( SEXP inReal, diff --git a/src/ta_AROON.c b/src/ta_AROON.c index 948c9b941..5bf6a448b 100644 --- a/src/ta_AROON.c +++ b/src/ta_AROON.c @@ -23,6 +23,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_AROON_lookback( + SEXP inHigh, + SEXP inLow, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_AROON_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_AROON( SEXP inHigh, diff --git a/src/ta_AROONOSC.c b/src/ta_AROONOSC.c index a0247912a..c55d3ce43 100644 --- a/src/ta_AROONOSC.c +++ b/src/ta_AROONOSC.c @@ -23,6 +23,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_AROONOSC_lookback( + SEXP inHigh, + SEXP inLow, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_AROONOSC_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_AROONOSC( SEXP inHigh, diff --git a/src/ta_ATR.c b/src/ta_ATR.c index e9c41d9e6..35a0bdea7 100644 --- a/src/ta_ATR.c +++ b/src/ta_ATR.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_ATR_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_ATR_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_ATR( SEXP inHigh, diff --git a/src/ta_AVGPRICE.c b/src/ta_AVGPRICE.c index 1ea08e875..c74b13db8 100644 --- a/src/ta_AVGPRICE.c +++ b/src/ta_AVGPRICE.c @@ -24,6 +24,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_AVGPRICE_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // values + // get length of 'inOpen' (assumes equal length across input) + int n = LENGTH(inOpen); + + // pointers to input arrays + const double *inOpen_ptr = REAL(inOpen); + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // calculate lookback + const int lookback = TA_AVGPRICE_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_AVGPRICE( SEXP inOpen, diff --git a/src/ta_BBANDS.c b/src/ta_BBANDS.c index 81f68e0df..e967720ce 100644 --- a/src/ta_BBANDS.c +++ b/src/ta_BBANDS.c @@ -25,6 +25,46 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_BBANDS_lookback( + SEXP inReal, + SEXP optInTimePeriod, + SEXP optInNbDevUp, + SEXP optInNbDevDn, + SEXP optInMAType +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + const double optInNbDevUp_value = REAL(optInNbDevUp)[0]; + const double optInNbDevDn_value = REAL(optInNbDevDn)[0]; + const TA_MAType optInMAType_value = as_MAType(optInMAType); + + // calculate lookback + const int lookback = TA_BBANDS_Lookback( + optInTimePeriod_value, + optInNbDevUp_value, + optInNbDevDn_value, + optInMAType_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_BBANDS( SEXP inReal, diff --git a/src/ta_BETA.c b/src/ta_BETA.c index d1d0476f4..bc804e026 100644 --- a/src/ta_BETA.c +++ b/src/ta_BETA.c @@ -23,6 +23,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_BETA_lookback( + SEXP inReal0, + SEXP inReal1, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal0' (assumes equal length across input) + int n = LENGTH(inReal0); + + // pointers to input arrays + const double *inReal0_ptr = REAL(inReal0); + const double *inReal1_ptr = REAL(inReal1); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_BETA_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_BETA( SEXP inReal0, diff --git a/src/ta_BOP.c b/src/ta_BOP.c index 430c1d552..5be28e9a8 100644 --- a/src/ta_BOP.c +++ b/src/ta_BOP.c @@ -24,6 +24,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_BOP_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // values + // get length of 'inOpen' (assumes equal length across input) + int n = LENGTH(inOpen); + + // pointers to input arrays + const double *inOpen_ptr = REAL(inOpen); + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // calculate lookback + const int lookback = TA_BOP_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_BOP( SEXP inOpen, diff --git a/src/ta_CCI.c b/src/ta_CCI.c index 467dfd77a..1d534321f 100644 --- a/src/ta_CCI.c +++ b/src/ta_CCI.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CCI_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_CCI_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_CCI( SEXP inHigh, diff --git a/src/ta_CDL2CROWS.c b/src/ta_CDL2CROWS.c index 0ba19c781..004fbdaa7 100644 --- a/src/ta_CDL2CROWS.c +++ b/src/ta_CDL2CROWS.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDL2CROWS_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDL2CROWS_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDL2CROWS( SEXP inOpen, diff --git a/src/ta_CDL3BLACKCROWS.c b/src/ta_CDL3BLACKCROWS.c index 2119b9524..233206f78 100644 --- a/src/ta_CDL3BLACKCROWS.c +++ b/src/ta_CDL3BLACKCROWS.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDL3BLACKCROWS_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDL3BLACKCROWS_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDL3BLACKCROWS( SEXP inOpen, diff --git a/src/ta_CDL3INSIDE.c b/src/ta_CDL3INSIDE.c index 23220d6a6..cde4c4e2c 100644 --- a/src/ta_CDL3INSIDE.c +++ b/src/ta_CDL3INSIDE.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDL3INSIDE_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDL3INSIDE_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDL3INSIDE( SEXP inOpen, diff --git a/src/ta_CDL3LINESTRIKE.c b/src/ta_CDL3LINESTRIKE.c index a0ee4b6ec..6bbd86e42 100644 --- a/src/ta_CDL3LINESTRIKE.c +++ b/src/ta_CDL3LINESTRIKE.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDL3LINESTRIKE_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDL3LINESTRIKE_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDL3LINESTRIKE( SEXP inOpen, diff --git a/src/ta_CDL3OUTSIDE.c b/src/ta_CDL3OUTSIDE.c index 5cf16e81a..d090b8e81 100644 --- a/src/ta_CDL3OUTSIDE.c +++ b/src/ta_CDL3OUTSIDE.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDL3OUTSIDE_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDL3OUTSIDE_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDL3OUTSIDE( SEXP inOpen, diff --git a/src/ta_CDL3STARSINSOUTH.c b/src/ta_CDL3STARSINSOUTH.c index 93083dc43..2b16cb16b 100644 --- a/src/ta_CDL3STARSINSOUTH.c +++ b/src/ta_CDL3STARSINSOUTH.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDL3STARSINSOUTH_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDL3STARSINSOUTH_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDL3STARSINSOUTH( SEXP inOpen, diff --git a/src/ta_CDL3WHITESOLDIERS.c b/src/ta_CDL3WHITESOLDIERS.c index d0cfd8ef3..adfe188b2 100644 --- a/src/ta_CDL3WHITESOLDIERS.c +++ b/src/ta_CDL3WHITESOLDIERS.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDL3WHITESOLDIERS_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDL3WHITESOLDIERS_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDL3WHITESOLDIERS( SEXP inOpen, diff --git a/src/ta_CDLABANDONEDBABY.c b/src/ta_CDLABANDONEDBABY.c index af02a6a29..b6198a461 100644 --- a/src/ta_CDLABANDONEDBABY.c +++ b/src/ta_CDLABANDONEDBABY.c @@ -25,6 +25,38 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLABANDONEDBABY_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInPenetration +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + const double penetration = REAL(optInPenetration)[0]; + + // calculate lookback + const int lookback = TA_CDLABANDONEDBABY_Lookback(penetration); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLABANDONEDBABY( SEXP inOpen, diff --git a/src/ta_CDLADVANCEBLOCK.c b/src/ta_CDLADVANCEBLOCK.c index 2ddb9f16b..ee38fc0b0 100644 --- a/src/ta_CDLADVANCEBLOCK.c +++ b/src/ta_CDLADVANCEBLOCK.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLADVANCEBLOCK_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLADVANCEBLOCK_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLADVANCEBLOCK( SEXP inOpen, diff --git a/src/ta_CDLBELTHOLD.c b/src/ta_CDLBELTHOLD.c index 86e808c23..783e9c80b 100644 --- a/src/ta_CDLBELTHOLD.c +++ b/src/ta_CDLBELTHOLD.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLBELTHOLD_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLBELTHOLD_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLBELTHOLD( SEXP inOpen, diff --git a/src/ta_CDLBREAKAWAY.c b/src/ta_CDLBREAKAWAY.c index 122ca67d5..f777a39c3 100644 --- a/src/ta_CDLBREAKAWAY.c +++ b/src/ta_CDLBREAKAWAY.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLBREAKAWAY_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLBREAKAWAY_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLBREAKAWAY( SEXP inOpen, diff --git a/src/ta_CDLCLOSINGMARUBOZU.c b/src/ta_CDLCLOSINGMARUBOZU.c index 35b7f2e88..ab2bf4027 100644 --- a/src/ta_CDLCLOSINGMARUBOZU.c +++ b/src/ta_CDLCLOSINGMARUBOZU.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLCLOSINGMARUBOZU_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLCLOSINGMARUBOZU_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLCLOSINGMARUBOZU( SEXP inOpen, diff --git a/src/ta_CDLCONCEALBABYSWALL.c b/src/ta_CDLCONCEALBABYSWALL.c index 31c1e9d9d..d194d45dc 100644 --- a/src/ta_CDLCONCEALBABYSWALL.c +++ b/src/ta_CDLCONCEALBABYSWALL.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLCONCEALBABYSWALL_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLCONCEALBABYSWALL_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLCONCEALBABYSWALL( SEXP inOpen, diff --git a/src/ta_CDLCOUNTERATTACK.c b/src/ta_CDLCOUNTERATTACK.c index ecc8e9f72..3856d5945 100644 --- a/src/ta_CDLCOUNTERATTACK.c +++ b/src/ta_CDLCOUNTERATTACK.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLCOUNTERATTACK_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLCOUNTERATTACK_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLCOUNTERATTACK( SEXP inOpen, diff --git a/src/ta_CDLDARKCLOUDCOVER.c b/src/ta_CDLDARKCLOUDCOVER.c index 9abf0809f..27b11bc26 100644 --- a/src/ta_CDLDARKCLOUDCOVER.c +++ b/src/ta_CDLDARKCLOUDCOVER.c @@ -25,6 +25,38 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLDARKCLOUDCOVER_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInPenetration +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + const double penetration = REAL(optInPenetration)[0]; + + // calculate lookback + const int lookback = TA_CDLDARKCLOUDCOVER_Lookback(penetration); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLDARKCLOUDCOVER( SEXP inOpen, diff --git a/src/ta_CDLDOJI.c b/src/ta_CDLDOJI.c index e9faf5f87..9785ae209 100644 --- a/src/ta_CDLDOJI.c +++ b/src/ta_CDLDOJI.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLDOJI_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLDOJI_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLDOJI( SEXP inOpen, diff --git a/src/ta_CDLDOJISTAR.c b/src/ta_CDLDOJISTAR.c index 9241eeaad..e9f06bfc2 100644 --- a/src/ta_CDLDOJISTAR.c +++ b/src/ta_CDLDOJISTAR.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLDOJISTAR_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLDOJISTAR_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLDOJISTAR( SEXP inOpen, diff --git a/src/ta_CDLDRAGONFLYDOJI.c b/src/ta_CDLDRAGONFLYDOJI.c index 03be99e17..27b3b5749 100644 --- a/src/ta_CDLDRAGONFLYDOJI.c +++ b/src/ta_CDLDRAGONFLYDOJI.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLDRAGONFLYDOJI_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLDRAGONFLYDOJI_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLDRAGONFLYDOJI( SEXP inOpen, diff --git a/src/ta_CDLENGULFING.c b/src/ta_CDLENGULFING.c index 8dbb06d85..c399e015f 100644 --- a/src/ta_CDLENGULFING.c +++ b/src/ta_CDLENGULFING.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLENGULFING_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLENGULFING_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLENGULFING( SEXP inOpen, diff --git a/src/ta_CDLEVENINGDOJISTAR.c b/src/ta_CDLEVENINGDOJISTAR.c index ba51e0f05..ef7aab8cc 100644 --- a/src/ta_CDLEVENINGDOJISTAR.c +++ b/src/ta_CDLEVENINGDOJISTAR.c @@ -25,6 +25,38 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLEVENINGDOJISTAR_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInPenetration +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + const double penetration = REAL(optInPenetration)[0]; + + // calculate lookback + const int lookback = TA_CDLEVENINGDOJISTAR_Lookback(penetration); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLEVENINGDOJISTAR( SEXP inOpen, diff --git a/src/ta_CDLEVENINGSTAR.c b/src/ta_CDLEVENINGSTAR.c index 1b82c5724..67852193a 100644 --- a/src/ta_CDLEVENINGSTAR.c +++ b/src/ta_CDLEVENINGSTAR.c @@ -25,6 +25,38 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLEVENINGSTAR_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInPenetration +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + const double penetration = REAL(optInPenetration)[0]; + + // calculate lookback + const int lookback = TA_CDLEVENINGSTAR_Lookback(penetration); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLEVENINGSTAR( SEXP inOpen, diff --git a/src/ta_CDLGAPSIDESIDEWHITE.c b/src/ta_CDLGAPSIDESIDEWHITE.c index eaceff14a..1a13ee90b 100644 --- a/src/ta_CDLGAPSIDESIDEWHITE.c +++ b/src/ta_CDLGAPSIDESIDEWHITE.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLGAPSIDESIDEWHITE_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLGAPSIDESIDEWHITE_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLGAPSIDESIDEWHITE( SEXP inOpen, diff --git a/src/ta_CDLGRAVESTONEDOJI.c b/src/ta_CDLGRAVESTONEDOJI.c index fb73cf388..952100fc5 100644 --- a/src/ta_CDLGRAVESTONEDOJI.c +++ b/src/ta_CDLGRAVESTONEDOJI.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLGRAVESTONEDOJI_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLGRAVESTONEDOJI_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLGRAVESTONEDOJI( SEXP inOpen, diff --git a/src/ta_CDLHAMMER.c b/src/ta_CDLHAMMER.c index 6f8ceba46..e361a610a 100644 --- a/src/ta_CDLHAMMER.c +++ b/src/ta_CDLHAMMER.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLHAMMER_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLHAMMER_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLHAMMER( SEXP inOpen, diff --git a/src/ta_CDLHANGINGMAN.c b/src/ta_CDLHANGINGMAN.c index 87eea059c..4e13daf3b 100644 --- a/src/ta_CDLHANGINGMAN.c +++ b/src/ta_CDLHANGINGMAN.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLHANGINGMAN_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLHANGINGMAN_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLHANGINGMAN( SEXP inOpen, diff --git a/src/ta_CDLHARAMI.c b/src/ta_CDLHARAMI.c index 60ed602c2..06511cf04 100644 --- a/src/ta_CDLHARAMI.c +++ b/src/ta_CDLHARAMI.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLHARAMI_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLHARAMI_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLHARAMI( SEXP inOpen, diff --git a/src/ta_CDLHARAMICROSS.c b/src/ta_CDLHARAMICROSS.c index e392cfbed..52bd8ae16 100644 --- a/src/ta_CDLHARAMICROSS.c +++ b/src/ta_CDLHARAMICROSS.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLHARAMICROSS_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLHARAMICROSS_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLHARAMICROSS( SEXP inOpen, diff --git a/src/ta_CDLHIGHWAVE.c b/src/ta_CDLHIGHWAVE.c index 9d1b0de94..8673192bd 100644 --- a/src/ta_CDLHIGHWAVE.c +++ b/src/ta_CDLHIGHWAVE.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLHIGHWAVE_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLHIGHWAVE_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLHIGHWAVE( SEXP inOpen, diff --git a/src/ta_CDLHIKKAKE.c b/src/ta_CDLHIKKAKE.c index 5f70a053a..22730af0b 100644 --- a/src/ta_CDLHIKKAKE.c +++ b/src/ta_CDLHIKKAKE.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLHIKKAKE_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLHIKKAKE_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLHIKKAKE( SEXP inOpen, diff --git a/src/ta_CDLHIKKAKEMOD.c b/src/ta_CDLHIKKAKEMOD.c index d1a721947..611ff6b28 100644 --- a/src/ta_CDLHIKKAKEMOD.c +++ b/src/ta_CDLHIKKAKEMOD.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLHIKKAKEMOD_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLHIKKAKEMOD_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLHIKKAKEMOD( SEXP inOpen, diff --git a/src/ta_CDLHOMINGPIGEON.c b/src/ta_CDLHOMINGPIGEON.c index b26f446de..f6476ae7b 100644 --- a/src/ta_CDLHOMINGPIGEON.c +++ b/src/ta_CDLHOMINGPIGEON.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLHOMINGPIGEON_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLHOMINGPIGEON_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLHOMINGPIGEON( SEXP inOpen, diff --git a/src/ta_CDLIDENTICAL3CROWS.c b/src/ta_CDLIDENTICAL3CROWS.c index 97aa530de..aa1f5a7ea 100644 --- a/src/ta_CDLIDENTICAL3CROWS.c +++ b/src/ta_CDLIDENTICAL3CROWS.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLIDENTICAL3CROWS_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLIDENTICAL3CROWS_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLIDENTICAL3CROWS( SEXP inOpen, diff --git a/src/ta_CDLINNECK.c b/src/ta_CDLINNECK.c index e248af245..ae61db637 100644 --- a/src/ta_CDLINNECK.c +++ b/src/ta_CDLINNECK.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLINNECK_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLINNECK_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLINNECK( SEXP inOpen, diff --git a/src/ta_CDLINVERTEDHAMMER.c b/src/ta_CDLINVERTEDHAMMER.c index 66df11952..a640bf24f 100644 --- a/src/ta_CDLINVERTEDHAMMER.c +++ b/src/ta_CDLINVERTEDHAMMER.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLINVERTEDHAMMER_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLINVERTEDHAMMER_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLINVERTEDHAMMER( SEXP inOpen, diff --git a/src/ta_CDLKICKING.c b/src/ta_CDLKICKING.c index 4bbad2514..82be38042 100644 --- a/src/ta_CDLKICKING.c +++ b/src/ta_CDLKICKING.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLKICKING_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLKICKING_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLKICKING( SEXP inOpen, diff --git a/src/ta_CDLKICKINGBYLENGTH.c b/src/ta_CDLKICKINGBYLENGTH.c index f5f6faf88..7bb5aebb0 100644 --- a/src/ta_CDLKICKINGBYLENGTH.c +++ b/src/ta_CDLKICKINGBYLENGTH.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLKICKINGBYLENGTH_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLKICKINGBYLENGTH_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLKICKINGBYLENGTH( SEXP inOpen, diff --git a/src/ta_CDLLADDERBOTTOM.c b/src/ta_CDLLADDERBOTTOM.c index 81b29ae46..458967b42 100644 --- a/src/ta_CDLLADDERBOTTOM.c +++ b/src/ta_CDLLADDERBOTTOM.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLLADDERBOTTOM_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLLADDERBOTTOM_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLLADDERBOTTOM( SEXP inOpen, diff --git a/src/ta_CDLLONGLEGGEDDOJI.c b/src/ta_CDLLONGLEGGEDDOJI.c index c1920a94e..d5c764bd5 100644 --- a/src/ta_CDLLONGLEGGEDDOJI.c +++ b/src/ta_CDLLONGLEGGEDDOJI.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLLONGLEGGEDDOJI_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLLONGLEGGEDDOJI_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLLONGLEGGEDDOJI( SEXP inOpen, diff --git a/src/ta_CDLLONGLINE.c b/src/ta_CDLLONGLINE.c index 577a53aad..d80d705ce 100644 --- a/src/ta_CDLLONGLINE.c +++ b/src/ta_CDLLONGLINE.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLLONGLINE_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLLONGLINE_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLLONGLINE( SEXP inOpen, diff --git a/src/ta_CDLMARUBOZU.c b/src/ta_CDLMARUBOZU.c index 846bbf2dd..683e7765b 100644 --- a/src/ta_CDLMARUBOZU.c +++ b/src/ta_CDLMARUBOZU.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLMARUBOZU_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLMARUBOZU_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLMARUBOZU( SEXP inOpen, diff --git a/src/ta_CDLMATCHINGLOW.c b/src/ta_CDLMATCHINGLOW.c index 12cb8ff39..e9463130a 100644 --- a/src/ta_CDLMATCHINGLOW.c +++ b/src/ta_CDLMATCHINGLOW.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLMATCHINGLOW_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLMATCHINGLOW_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLMATCHINGLOW( SEXP inOpen, diff --git a/src/ta_CDLMATHOLD.c b/src/ta_CDLMATHOLD.c index 7332f3f2c..688600798 100644 --- a/src/ta_CDLMATHOLD.c +++ b/src/ta_CDLMATHOLD.c @@ -25,6 +25,38 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLMATHOLD_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInPenetration +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + const double penetration = REAL(optInPenetration)[0]; + + // calculate lookback + const int lookback = TA_CDLMATHOLD_Lookback(penetration); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLMATHOLD( SEXP inOpen, diff --git a/src/ta_CDLMORNINGDOJISTAR.c b/src/ta_CDLMORNINGDOJISTAR.c index dc6217651..0083024fe 100644 --- a/src/ta_CDLMORNINGDOJISTAR.c +++ b/src/ta_CDLMORNINGDOJISTAR.c @@ -25,6 +25,38 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLMORNINGDOJISTAR_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInPenetration +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + const double penetration = REAL(optInPenetration)[0]; + + // calculate lookback + const int lookback = TA_CDLMORNINGDOJISTAR_Lookback(penetration); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLMORNINGDOJISTAR( SEXP inOpen, diff --git a/src/ta_CDLMORNINGSTAR.c b/src/ta_CDLMORNINGSTAR.c index e08d38953..c0d2c97aa 100644 --- a/src/ta_CDLMORNINGSTAR.c +++ b/src/ta_CDLMORNINGSTAR.c @@ -25,6 +25,38 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLMORNINGSTAR_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInPenetration +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + const double penetration = REAL(optInPenetration)[0]; + + // calculate lookback + const int lookback = TA_CDLMORNINGSTAR_Lookback(penetration); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLMORNINGSTAR( SEXP inOpen, diff --git a/src/ta_CDLONNECK.c b/src/ta_CDLONNECK.c index 3788cd921..3b3a7cdbd 100644 --- a/src/ta_CDLONNECK.c +++ b/src/ta_CDLONNECK.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLONNECK_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLONNECK_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLONNECK( SEXP inOpen, diff --git a/src/ta_CDLPIERCING.c b/src/ta_CDLPIERCING.c index 8a8c150fa..adf6bdaff 100644 --- a/src/ta_CDLPIERCING.c +++ b/src/ta_CDLPIERCING.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLPIERCING_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLPIERCING_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLPIERCING( SEXP inOpen, diff --git a/src/ta_CDLRICKSHAWMAN.c b/src/ta_CDLRICKSHAWMAN.c index de0c14010..7ddf2c6cd 100644 --- a/src/ta_CDLRICKSHAWMAN.c +++ b/src/ta_CDLRICKSHAWMAN.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLRICKSHAWMAN_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLRICKSHAWMAN_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLRICKSHAWMAN( SEXP inOpen, diff --git a/src/ta_CDLRISEFALL3METHODS.c b/src/ta_CDLRISEFALL3METHODS.c index 7fdce1d58..0c55c09f7 100644 --- a/src/ta_CDLRISEFALL3METHODS.c +++ b/src/ta_CDLRISEFALL3METHODS.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLRISEFALL3METHODS_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLRISEFALL3METHODS_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLRISEFALL3METHODS( SEXP inOpen, diff --git a/src/ta_CDLSEPARATINGLINES.c b/src/ta_CDLSEPARATINGLINES.c index 57d3820b6..16bcc2945 100644 --- a/src/ta_CDLSEPARATINGLINES.c +++ b/src/ta_CDLSEPARATINGLINES.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLSEPARATINGLINES_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLSEPARATINGLINES_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLSEPARATINGLINES( SEXP inOpen, diff --git a/src/ta_CDLSHOOTINGSTAR.c b/src/ta_CDLSHOOTINGSTAR.c index 9affb530f..72b28e34a 100644 --- a/src/ta_CDLSHOOTINGSTAR.c +++ b/src/ta_CDLSHOOTINGSTAR.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLSHOOTINGSTAR_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLSHOOTINGSTAR_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLSHOOTINGSTAR( SEXP inOpen, diff --git a/src/ta_CDLSHORTLINE.c b/src/ta_CDLSHORTLINE.c index a3e6f8259..f9578a08f 100644 --- a/src/ta_CDLSHORTLINE.c +++ b/src/ta_CDLSHORTLINE.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLSHORTLINE_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLSHORTLINE_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLSHORTLINE( SEXP inOpen, diff --git a/src/ta_CDLSPINNINGTOP.c b/src/ta_CDLSPINNINGTOP.c index 174122fee..c22c8c07a 100644 --- a/src/ta_CDLSPINNINGTOP.c +++ b/src/ta_CDLSPINNINGTOP.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLSPINNINGTOP_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLSPINNINGTOP_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLSPINNINGTOP( SEXP inOpen, diff --git a/src/ta_CDLSTALLEDPATTERN.c b/src/ta_CDLSTALLEDPATTERN.c index 1f1932dfe..8172c2cb5 100644 --- a/src/ta_CDLSTALLEDPATTERN.c +++ b/src/ta_CDLSTALLEDPATTERN.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLSTALLEDPATTERN_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLSTALLEDPATTERN_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLSTALLEDPATTERN( SEXP inOpen, diff --git a/src/ta_CDLSTICKSANDWICH.c b/src/ta_CDLSTICKSANDWICH.c index bfbf8faf3..3f31a9b3c 100644 --- a/src/ta_CDLSTICKSANDWICH.c +++ b/src/ta_CDLSTICKSANDWICH.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLSTICKSANDWICH_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLSTICKSANDWICH_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLSTICKSANDWICH( SEXP inOpen, diff --git a/src/ta_CDLTAKURI.c b/src/ta_CDLTAKURI.c index bbc4b4063..b537a3845 100644 --- a/src/ta_CDLTAKURI.c +++ b/src/ta_CDLTAKURI.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLTAKURI_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLTAKURI_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLTAKURI( SEXP inOpen, diff --git a/src/ta_CDLTASUKIGAP.c b/src/ta_CDLTASUKIGAP.c index b4f3a7f0b..dc3ec6a3b 100644 --- a/src/ta_CDLTASUKIGAP.c +++ b/src/ta_CDLTASUKIGAP.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLTASUKIGAP_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLTASUKIGAP_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLTASUKIGAP( SEXP inOpen, diff --git a/src/ta_CDLTHRUSTING.c b/src/ta_CDLTHRUSTING.c index 1518ce8e9..c01151b7a 100644 --- a/src/ta_CDLTHRUSTING.c +++ b/src/ta_CDLTHRUSTING.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLTHRUSTING_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLTHRUSTING_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLTHRUSTING( SEXP inOpen, diff --git a/src/ta_CDLTRISTAR.c b/src/ta_CDLTRISTAR.c index 974f9b78a..1c0d841f5 100644 --- a/src/ta_CDLTRISTAR.c +++ b/src/ta_CDLTRISTAR.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLTRISTAR_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLTRISTAR_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLTRISTAR( SEXP inOpen, diff --git a/src/ta_CDLUNIQUE3RIVER.c b/src/ta_CDLUNIQUE3RIVER.c index d48f92206..d77b621d9 100644 --- a/src/ta_CDLUNIQUE3RIVER.c +++ b/src/ta_CDLUNIQUE3RIVER.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLUNIQUE3RIVER_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLUNIQUE3RIVER_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLUNIQUE3RIVER( SEXP inOpen, diff --git a/src/ta_CDLUPSIDEGAP2CROWS.c b/src/ta_CDLUPSIDEGAP2CROWS.c index 1fa4e148c..bf86240aa 100644 --- a/src/ta_CDLUPSIDEGAP2CROWS.c +++ b/src/ta_CDLUPSIDEGAP2CROWS.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLUPSIDEGAP2CROWS_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLUPSIDEGAP2CROWS_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLUPSIDEGAP2CROWS( SEXP inOpen, diff --git a/src/ta_CDLXSIDEGAP3METHODS.c b/src/ta_CDLXSIDEGAP3METHODS.c index 0b988b8f6..8b045aa5e 100644 --- a/src/ta_CDLXSIDEGAP3METHODS.c +++ b/src/ta_CDLXSIDEGAP3METHODS.c @@ -24,6 +24,35 @@ #include "shift.h" #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CDLXSIDEGAP3METHODS_lookback( + SEXP inOpen, + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // pointers to input + const double *open_ptr = REAL(inOpen); + const double *high_ptr = REAL(inHigh); + const double *low_ptr = REAL(inLow); + const double *close_ptr = REAL(inClose); + int n = LENGTH(inOpen); + + // calculate lookback + const int lookback = TA_CDLXSIDEGAP3METHODS_Lookback(); + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + + return output; +} + // clang-format off SEXP impl_ta_CDLXSIDEGAP3METHODS( SEXP inOpen, diff --git a/src/ta_CMO.c b/src/ta_CMO.c index c1dc4969d..edcf9a95c 100644 --- a/src/ta_CMO.c +++ b/src/ta_CMO.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CMO_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_CMO_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_CMO( SEXP inReal, diff --git a/src/ta_CORREL.c b/src/ta_CORREL.c index 08476beeb..06a33d427 100644 --- a/src/ta_CORREL.c +++ b/src/ta_CORREL.c @@ -23,6 +23,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_CORREL_lookback( + SEXP inReal0, + SEXP inReal1, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal0' (assumes equal length across input) + int n = LENGTH(inReal0); + + // pointers to input arrays + const double *inReal0_ptr = REAL(inReal0); + const double *inReal1_ptr = REAL(inReal1); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_CORREL_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_CORREL( SEXP inReal0, diff --git a/src/ta_DEMA.c b/src/ta_DEMA.c index b56cd536f..5a9fc1124 100644 --- a/src/ta_DEMA.c +++ b/src/ta_DEMA.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_DEMA_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_DEMA_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_DEMA( SEXP inReal, diff --git a/src/ta_DX.c b/src/ta_DX.c index a031498b1..5c9b12f41 100644 --- a/src/ta_DX.c +++ b/src/ta_DX.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_DX_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_DX_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_DX( SEXP inHigh, diff --git a/src/ta_EMA.c b/src/ta_EMA.c index 02067a543..321f100dc 100644 --- a/src/ta_EMA.c +++ b/src/ta_EMA.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_EMA_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_EMA_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_EMA( SEXP inReal, diff --git a/src/ta_HT_DCPERIOD.c b/src/ta_HT_DCPERIOD.c index 3d72afc46..770af8024 100644 --- a/src/ta_HT_DCPERIOD.c +++ b/src/ta_HT_DCPERIOD.c @@ -21,6 +21,32 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_HT_DCPERIOD_lookback( + SEXP inReal +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // calculate lookback + const int lookback = TA_HT_DCPERIOD_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_HT_DCPERIOD( SEXP inReal, diff --git a/src/ta_HT_DCPHASE.c b/src/ta_HT_DCPHASE.c index a05c7abd0..23461b58d 100644 --- a/src/ta_HT_DCPHASE.c +++ b/src/ta_HT_DCPHASE.c @@ -21,6 +21,32 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_HT_DCPHASE_lookback( + SEXP inReal +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // calculate lookback + const int lookback = TA_HT_DCPHASE_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_HT_DCPHASE( SEXP inReal, diff --git a/src/ta_HT_PHASOR.c b/src/ta_HT_PHASOR.c index 2d73a4854..870af5864 100644 --- a/src/ta_HT_PHASOR.c +++ b/src/ta_HT_PHASOR.c @@ -21,6 +21,32 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_HT_PHASOR_lookback( + SEXP inReal +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // calculate lookback + const int lookback = TA_HT_PHASOR_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_HT_PHASOR( SEXP inReal, diff --git a/src/ta_HT_SINE.c b/src/ta_HT_SINE.c index fe50ba65c..2adcfa2b6 100644 --- a/src/ta_HT_SINE.c +++ b/src/ta_HT_SINE.c @@ -21,6 +21,32 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_HT_SINE_lookback( + SEXP inReal +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // calculate lookback + const int lookback = TA_HT_SINE_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_HT_SINE( SEXP inReal, diff --git a/src/ta_HT_TRENDLINE.c b/src/ta_HT_TRENDLINE.c index 3a05c0f38..5a501f5ea 100644 --- a/src/ta_HT_TRENDLINE.c +++ b/src/ta_HT_TRENDLINE.c @@ -21,6 +21,32 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_HT_TRENDLINE_lookback( + SEXP inReal +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // calculate lookback + const int lookback = TA_HT_TRENDLINE_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_HT_TRENDLINE( SEXP inReal, diff --git a/src/ta_HT_TRENDMODE.c b/src/ta_HT_TRENDMODE.c index 62eaa65cf..e5d025269 100644 --- a/src/ta_HT_TRENDMODE.c +++ b/src/ta_HT_TRENDMODE.c @@ -21,6 +21,32 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_HT_TRENDMODE_lookback( + SEXP inReal +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // calculate lookback + const int lookback = TA_HT_TRENDMODE_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_HT_TRENDMODE( SEXP inReal, diff --git a/src/ta_IMI.c b/src/ta_IMI.c index 10eff2938..457b81d7d 100644 --- a/src/ta_IMI.c +++ b/src/ta_IMI.c @@ -23,6 +23,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_IMI_lookback( + SEXP inOpen, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inOpen' (assumes equal length across input) + int n = LENGTH(inOpen); + + // pointers to input arrays + const double *inOpen_ptr = REAL(inOpen); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_IMI_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_IMI( SEXP inOpen, diff --git a/src/ta_KAMA.c b/src/ta_KAMA.c index bc7ce4716..b2d001d30 100644 --- a/src/ta_KAMA.c +++ b/src/ta_KAMA.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_KAMA_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_KAMA_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_KAMA( SEXP inReal, diff --git a/src/ta_MACD.c b/src/ta_MACD.c index df86ecc44..2bcdb717e 100644 --- a/src/ta_MACD.c +++ b/src/ta_MACD.c @@ -24,6 +24,43 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MACD_lookback( + SEXP inReal, + SEXP optInFastPeriod, + SEXP optInSlowPeriod, + SEXP optInSignalPeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInFastPeriod_value = INTEGER(optInFastPeriod)[0]; + const int optInSlowPeriod_value = INTEGER(optInSlowPeriod)[0]; + const int optInSignalPeriod_value = INTEGER(optInSignalPeriod)[0]; + + // calculate lookback + const int lookback = TA_MACD_Lookback( + optInFastPeriod_value, + optInSlowPeriod_value, + optInSignalPeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MACD( SEXP inReal, diff --git a/src/ta_MACDEXT.c b/src/ta_MACDEXT.c index 275176b6f..2c797183d 100644 --- a/src/ta_MACDEXT.c +++ b/src/ta_MACDEXT.c @@ -27,6 +27,52 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MACDEXT_lookback( + SEXP inReal, + SEXP optInFastPeriod, + SEXP optInFastMAType, + SEXP optInSlowPeriod, + SEXP optInSlowMAType, + SEXP optInSignalPeriod, + SEXP optInSignalMAType +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInFastPeriod_value = INTEGER(optInFastPeriod)[0]; + const TA_MAType optInFastMAType_value = as_MAType(optInFastMAType); + const int optInSlowPeriod_value = INTEGER(optInSlowPeriod)[0]; + const TA_MAType optInSlowMAType_value = as_MAType(optInSlowMAType); + const int optInSignalPeriod_value = INTEGER(optInSignalPeriod)[0]; + const TA_MAType optInSignalMAType_value = as_MAType(optInSignalMAType); + + // calculate lookback + const int lookback = TA_MACDEXT_Lookback( + optInFastPeriod_value, + optInFastMAType_value, + optInSlowPeriod_value, + optInSlowMAType_value, + optInSignalPeriod_value, + optInSignalMAType_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MACDEXT( SEXP inReal, diff --git a/src/ta_MACDFIX.c b/src/ta_MACDFIX.c index f34ce64b0..0bdfc0307 100644 --- a/src/ta_MACDFIX.c +++ b/src/ta_MACDFIX.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MACDFIX_lookback( + SEXP inReal, + SEXP optInSignalPeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInSignalPeriod_value = INTEGER(optInSignalPeriod)[0]; + + // calculate lookback + const int lookback = TA_MACDFIX_Lookback(optInSignalPeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MACDFIX( SEXP inReal, diff --git a/src/ta_MAMA.c b/src/ta_MAMA.c index e8011f613..42dc17b69 100644 --- a/src/ta_MAMA.c +++ b/src/ta_MAMA.c @@ -23,6 +23,39 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MAMA_lookback( + SEXP inReal, + SEXP optInFastLimit, + SEXP optInSlowLimit +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const double optInFastLimit_value = REAL(optInFastLimit)[0]; + const double optInSlowLimit_value = REAL(optInSlowLimit)[0]; + + // calculate lookback + const int lookback = + TA_MAMA_Lookback(optInFastLimit_value, optInSlowLimit_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MAMA( SEXP inReal, diff --git a/src/ta_MAX.c b/src/ta_MAX.c index 6ab70ef6d..a255679d4 100644 --- a/src/ta_MAX.c +++ b/src/ta_MAX.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MAX_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_MAX_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MAX( SEXP inReal, diff --git a/src/ta_MEDPRICE.c b/src/ta_MEDPRICE.c index 26f61945a..e20306160 100644 --- a/src/ta_MEDPRICE.c +++ b/src/ta_MEDPRICE.c @@ -22,6 +22,34 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MEDPRICE_lookback( + SEXP inHigh, + SEXP inLow +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + + // calculate lookback + const int lookback = TA_MEDPRICE_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MEDPRICE( SEXP inHigh, diff --git a/src/ta_MFI.c b/src/ta_MFI.c index f5e102418..3f8e20c04 100644 --- a/src/ta_MFI.c +++ b/src/ta_MFI.c @@ -25,6 +25,42 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MFI_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP inVolume, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + const double *inVolume_ptr = REAL(inVolume); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_MFI_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MFI( SEXP inHigh, diff --git a/src/ta_MIDPRICE.c b/src/ta_MIDPRICE.c index defbb2caf..03f676ceb 100644 --- a/src/ta_MIDPRICE.c +++ b/src/ta_MIDPRICE.c @@ -23,6 +23,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MIDPRICE_lookback( + SEXP inHigh, + SEXP inLow, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_MIDPRICE_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MIDPRICE( SEXP inHigh, diff --git a/src/ta_MIN.c b/src/ta_MIN.c index 89a124f6b..1e72c98dd 100644 --- a/src/ta_MIN.c +++ b/src/ta_MIN.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MIN_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_MIN_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MIN( SEXP inReal, diff --git a/src/ta_MINUS_DI.c b/src/ta_MINUS_DI.c index ae883d4ad..df8be017c 100644 --- a/src/ta_MINUS_DI.c +++ b/src/ta_MINUS_DI.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MINUS_DI_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_MINUS_DI_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MINUS_DI( SEXP inHigh, diff --git a/src/ta_MINUS_DM.c b/src/ta_MINUS_DM.c index 29c65c0dc..2f252234b 100644 --- a/src/ta_MINUS_DM.c +++ b/src/ta_MINUS_DM.c @@ -23,6 +23,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MINUS_DM_lookback( + SEXP inHigh, + SEXP inLow, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_MINUS_DM_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MINUS_DM( SEXP inHigh, diff --git a/src/ta_MOM.c b/src/ta_MOM.c index b381fb6ac..be3793ede 100644 --- a/src/ta_MOM.c +++ b/src/ta_MOM.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_MOM_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_MOM_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_MOM( SEXP inReal, diff --git a/src/ta_NATR.c b/src/ta_NATR.c index 776aa9842..1de11713d 100644 --- a/src/ta_NATR.c +++ b/src/ta_NATR.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_NATR_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_NATR_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_NATR( SEXP inHigh, diff --git a/src/ta_OBV.c b/src/ta_OBV.c index af8cc3778..fa492f170 100644 --- a/src/ta_OBV.c +++ b/src/ta_OBV.c @@ -22,6 +22,34 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_OBV_lookback( + SEXP inReal, + SEXP inVolume +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + const double *inVolume_ptr = REAL(inVolume); + + // calculate lookback + const int lookback = TA_OBV_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_OBV( SEXP inReal, diff --git a/src/ta_PLUS_DI.c b/src/ta_PLUS_DI.c index ee1ebdd12..233b0b23a 100644 --- a/src/ta_PLUS_DI.c +++ b/src/ta_PLUS_DI.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_PLUS_DI_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_PLUS_DI_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_PLUS_DI( SEXP inHigh, diff --git a/src/ta_PLUS_DM.c b/src/ta_PLUS_DM.c index 61bebf77c..199c60944 100644 --- a/src/ta_PLUS_DM.c +++ b/src/ta_PLUS_DM.c @@ -23,6 +23,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_PLUS_DM_lookback( + SEXP inHigh, + SEXP inLow, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_PLUS_DM_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_PLUS_DM( SEXP inHigh, diff --git a/src/ta_PPO.c b/src/ta_PPO.c index d4bee26ff..a21d8ca72 100644 --- a/src/ta_PPO.c +++ b/src/ta_PPO.c @@ -24,6 +24,43 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_PPO_lookback( + SEXP inReal, + SEXP optInFastPeriod, + SEXP optInSlowPeriod, + SEXP optInMAType +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInFastPeriod_value = INTEGER(optInFastPeriod)[0]; + const int optInSlowPeriod_value = INTEGER(optInSlowPeriod)[0]; + const TA_MAType optInMAType_value = as_MAType(optInMAType); + + // calculate lookback + const int lookback = TA_PPO_Lookback( + optInFastPeriod_value, + optInSlowPeriod_value, + optInMAType_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_PPO( SEXP inReal, diff --git a/src/ta_ROC.c b/src/ta_ROC.c index 74e62e7eb..9039fc03b 100644 --- a/src/ta_ROC.c +++ b/src/ta_ROC.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_ROC_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_ROC_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_ROC( SEXP inReal, diff --git a/src/ta_ROCR.c b/src/ta_ROCR.c index b6f4ac3dd..e99925422 100644 --- a/src/ta_ROCR.c +++ b/src/ta_ROCR.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_ROCR_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_ROCR_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_ROCR( SEXP inReal, diff --git a/src/ta_RSI.c b/src/ta_RSI.c index 52f361838..7c32fdfb0 100644 --- a/src/ta_RSI.c +++ b/src/ta_RSI.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_RSI_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_RSI_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_RSI( SEXP inReal, diff --git a/src/ta_SAR.c b/src/ta_SAR.c index db52561a3..899f5a3e3 100644 --- a/src/ta_SAR.c +++ b/src/ta_SAR.c @@ -24,6 +24,41 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_SAR_lookback( + SEXP inHigh, + SEXP inLow, + SEXP optInAcceleration, + SEXP optInMaximum +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + + // extract input values + const double optInAcceleration_value = REAL(optInAcceleration)[0]; + const double optInMaximum_value = REAL(optInMaximum)[0]; + + // calculate lookback + const int lookback = + TA_SAR_Lookback(optInAcceleration_value, optInMaximum_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_SAR( SEXP inHigh, diff --git a/src/ta_SAREXT.c b/src/ta_SAREXT.c index d208e886c..e5ddfe44b 100644 --- a/src/ta_SAREXT.c +++ b/src/ta_SAREXT.c @@ -30,6 +30,64 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_SAREXT_lookback( + SEXP inHigh, + SEXP inLow, + SEXP optInStartValue, + SEXP optInOffsetOnReverse, + SEXP optInAccelerationInitLong, + SEXP optInAccelerationLong, + SEXP optInAccelerationMaxLong, + SEXP optInAccelerationInitShort, + SEXP optInAccelerationShort, + SEXP optInAccelerationMaxShort +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + + // extract input values + const double optInStartValue_value = REAL(optInStartValue)[0]; + const double optInOffsetOnReverse_value = REAL(optInOffsetOnReverse)[0]; + const double optInAccelerationInitLong_value = + REAL(optInAccelerationInitLong)[0]; + const double optInAccelerationLong_value = REAL(optInAccelerationLong)[0]; + const double optInAccelerationMaxLong_value = + REAL(optInAccelerationMaxLong)[0]; + const double optInAccelerationInitShort_value = + REAL(optInAccelerationInitShort)[0]; + const double optInAccelerationShort_value = REAL(optInAccelerationShort)[0]; + const double optInAccelerationMaxShort_value = + REAL(optInAccelerationMaxShort)[0]; + + // calculate lookback + const int lookback = TA_SAREXT_Lookback( + optInStartValue_value, + optInOffsetOnReverse_value, + optInAccelerationInitLong_value, + optInAccelerationLong_value, + optInAccelerationMaxLong_value, + optInAccelerationInitShort_value, + optInAccelerationShort_value, + optInAccelerationMaxShort_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_SAREXT( SEXP inHigh, diff --git a/src/ta_SMA.c b/src/ta_SMA.c index 5c0f2ee2d..f26587231 100644 --- a/src/ta_SMA.c +++ b/src/ta_SMA.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_SMA_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_SMA_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_SMA( SEXP inReal, diff --git a/src/ta_STDDEV.c b/src/ta_STDDEV.c index 8849d5c3b..58b13183f 100644 --- a/src/ta_STDDEV.c +++ b/src/ta_STDDEV.c @@ -23,6 +23,39 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_STDDEV_lookback( + SEXP inReal, + SEXP optInTimePeriod, + SEXP optInNbDev +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + const double optInNbDev_value = REAL(optInNbDev)[0]; + + // calculate lookback + const int lookback = + TA_STDDEV_Lookback(optInTimePeriod_value, optInNbDev_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_STDDEV( SEXP inReal, diff --git a/src/ta_STOCH.c b/src/ta_STOCH.c index 6d0a3dab8..d01551d6c 100644 --- a/src/ta_STOCH.c +++ b/src/ta_STOCH.c @@ -28,6 +28,53 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_STOCH_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInFastK_Period, + SEXP optInSlowK_Period, + SEXP optInSlowK_MAType, + SEXP optInSlowD_Period, + SEXP optInSlowD_MAType +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInFastK_Period_value = INTEGER(optInFastK_Period)[0]; + const int optInSlowK_Period_value = INTEGER(optInSlowK_Period)[0]; + const TA_MAType optInSlowK_MAType_value = as_MAType(optInSlowK_MAType); + const int optInSlowD_Period_value = INTEGER(optInSlowD_Period)[0]; + const TA_MAType optInSlowD_MAType_value = as_MAType(optInSlowD_MAType); + + // calculate lookback + const int lookback = TA_STOCH_Lookback( + optInFastK_Period_value, + optInSlowK_Period_value, + optInSlowK_MAType_value, + optInSlowD_Period_value, + optInSlowD_MAType_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_STOCH( SEXP inHigh, diff --git a/src/ta_STOCHF.c b/src/ta_STOCHF.c index 45411baa5..c66a8229a 100644 --- a/src/ta_STOCHF.c +++ b/src/ta_STOCHF.c @@ -26,6 +26,47 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_STOCHF_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInFastK_Period, + SEXP optInFastD_Period, + SEXP optInFastD_MAType +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInFastK_Period_value = INTEGER(optInFastK_Period)[0]; + const int optInFastD_Period_value = INTEGER(optInFastD_Period)[0]; + const TA_MAType optInFastD_MAType_value = as_MAType(optInFastD_MAType); + + // calculate lookback + const int lookback = TA_STOCHF_Lookback( + optInFastK_Period_value, + optInFastD_Period_value, + optInFastD_MAType_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_STOCHF( SEXP inHigh, diff --git a/src/ta_STOCHRSI.c b/src/ta_STOCHRSI.c index 3f372b33f..7422b8512 100644 --- a/src/ta_STOCHRSI.c +++ b/src/ta_STOCHRSI.c @@ -25,6 +25,46 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_STOCHRSI_lookback( + SEXP inReal, + SEXP optInTimePeriod, + SEXP optInFastK_Period, + SEXP optInFastD_Period, + SEXP optInFastD_MAType +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + const int optInFastK_Period_value = INTEGER(optInFastK_Period)[0]; + const int optInFastD_Period_value = INTEGER(optInFastD_Period)[0]; + const TA_MAType optInFastD_MAType_value = as_MAType(optInFastD_MAType); + + // calculate lookback + const int lookback = TA_STOCHRSI_Lookback( + optInTimePeriod_value, + optInFastK_Period_value, + optInFastD_Period_value, + optInFastD_MAType_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_STOCHRSI( SEXP inReal, diff --git a/src/ta_SUM.c b/src/ta_SUM.c index e6311185c..4b1199b59 100644 --- a/src/ta_SUM.c +++ b/src/ta_SUM.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_SUM_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_SUM_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_SUM( SEXP inReal, diff --git a/src/ta_T3.c b/src/ta_T3.c index 7b1693b8d..f92c92354 100644 --- a/src/ta_T3.c +++ b/src/ta_T3.c @@ -23,6 +23,39 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_T3_lookback( + SEXP inReal, + SEXP optInTimePeriod, + SEXP optInVFactor +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + const double optInVFactor_value = REAL(optInVFactor)[0]; + + // calculate lookback + const int lookback = + TA_T3_Lookback(optInTimePeriod_value, optInVFactor_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_T3( SEXP inReal, diff --git a/src/ta_TEMA.c b/src/ta_TEMA.c index e51ddd0f3..6375382e4 100644 --- a/src/ta_TEMA.c +++ b/src/ta_TEMA.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_TEMA_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_TEMA_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_TEMA( SEXP inReal, diff --git a/src/ta_TRANGE.c b/src/ta_TRANGE.c index 1baf58438..b1dac959a 100644 --- a/src/ta_TRANGE.c +++ b/src/ta_TRANGE.c @@ -23,6 +23,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_TRANGE_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // calculate lookback + const int lookback = TA_TRANGE_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_TRANGE( SEXP inHigh, diff --git a/src/ta_TRIMA.c b/src/ta_TRIMA.c index 2439b6db8..65c5305d2 100644 --- a/src/ta_TRIMA.c +++ b/src/ta_TRIMA.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_TRIMA_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_TRIMA_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_TRIMA( SEXP inReal, diff --git a/src/ta_TRIX.c b/src/ta_TRIX.c index 36db44046..670e60a0c 100644 --- a/src/ta_TRIX.c +++ b/src/ta_TRIX.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_TRIX_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_TRIX_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_TRIX( SEXP inReal, diff --git a/src/ta_TYPPRICE.c b/src/ta_TYPPRICE.c index 68f6bb87b..b548c22fb 100644 --- a/src/ta_TYPPRICE.c +++ b/src/ta_TYPPRICE.c @@ -23,6 +23,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_TYPPRICE_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // calculate lookback + const int lookback = TA_TYPPRICE_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_TYPPRICE( SEXP inHigh, diff --git a/src/ta_ULTOSC.c b/src/ta_ULTOSC.c index f8d7b8342..27316c141 100644 --- a/src/ta_ULTOSC.c +++ b/src/ta_ULTOSC.c @@ -26,6 +26,47 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_ULTOSC_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod1, + SEXP optInTimePeriod2, + SEXP optInTimePeriod3 +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod1_value = INTEGER(optInTimePeriod1)[0]; + const int optInTimePeriod2_value = INTEGER(optInTimePeriod2)[0]; + const int optInTimePeriod3_value = INTEGER(optInTimePeriod3)[0]; + + // calculate lookback + const int lookback = TA_ULTOSC_Lookback( + optInTimePeriod1_value, + optInTimePeriod2_value, + optInTimePeriod3_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_ULTOSC( SEXP inHigh, diff --git a/src/ta_VAR.c b/src/ta_VAR.c index 7a4a863a3..ebf3d6801 100644 --- a/src/ta_VAR.c +++ b/src/ta_VAR.c @@ -23,6 +23,38 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_VAR_lookback( + SEXP inReal, + SEXP optInTimePeriod, + SEXP optInNbDev +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + const double optInNbDev_value = REAL(optInNbDev)[0]; + + // calculate lookback + const int lookback = TA_VAR_Lookback(optInTimePeriod_value, optInNbDev_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_VAR( SEXP inReal, diff --git a/src/ta_WCLPRICE.c b/src/ta_WCLPRICE.c index 00874106a..c22c51170 100644 --- a/src/ta_WCLPRICE.c +++ b/src/ta_WCLPRICE.c @@ -23,6 +23,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_WCLPRICE_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // calculate lookback + const int lookback = TA_WCLPRICE_Lookback(); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_WCLPRICE( SEXP inHigh, diff --git a/src/ta_WILLR.c b/src/ta_WILLR.c index 7e581d889..60040b6b6 100644 --- a/src/ta_WILLR.c +++ b/src/ta_WILLR.c @@ -24,6 +24,40 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_WILLR_lookback( + SEXP inHigh, + SEXP inLow, + SEXP inClose, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inHigh' (assumes equal length across input) + int n = LENGTH(inHigh); + + // pointers to input arrays + const double *inHigh_ptr = REAL(inHigh); + const double *inLow_ptr = REAL(inLow); + const double *inClose_ptr = REAL(inClose); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_WILLR_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_WILLR( SEXP inHigh, diff --git a/src/ta_WMA.c b/src/ta_WMA.c index e6b5fe28e..889a47766 100644 --- a/src/ta_WMA.c +++ b/src/ta_WMA.c @@ -22,6 +22,36 @@ #include #include +// the lookback function +// is exported as a standalone +// function for downstream wrappers +// clang-format off +SEXP impl_ta_WMA_lookback( + SEXP inReal, + SEXP optInTimePeriod +) +// clang-format on +{ + // values + // get length of 'inReal' (assumes equal length across input) + int n = LENGTH(inReal); + + // pointers to input arrays + const double *inReal_ptr = REAL(inReal); + + // extract input values + const int optInTimePeriod_value = INTEGER(optInTimePeriod)[0]; + + // calculate lookback + const int lookback = TA_WMA_Lookback(optInTimePeriod_value); + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + // unprotect output + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_WMA( SEXP inReal, From 0b247e3d1da18bf861ddf3b0bcfca33f09e8d153 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sat, 20 Jun 2026 21:39:01 +0200 Subject: [PATCH 04/12] :fire: lookback-function implemented * The lookback function is a utility/helper function for downstream packages that wants to implement their own wrapper based on {talib} - the function gives a higher degree of freedom in the way the indicators are called and can be used in any custom control flows. --- NAMESPACE | 1 + R/lookback.R | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 R/lookback.R diff --git a/NAMESPACE b/NAMESPACE index 0175c495d..90d8b5b0d 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -841,6 +841,7 @@ export(kicking_baby_length) export(ladder_bottom) export(long_legged_doji) export(long_line) +export(lookback) export(marubozu) export(mat_hold) export(matching_low) diff --git a/R/lookback.R b/R/lookback.R new file mode 100644 index 000000000..749a8d53a --- /dev/null +++ b/R/lookback.R @@ -0,0 +1,60 @@ +#' Calculate lookback period +#' +#' @description +#' The function calculates the lookback period for a given +#' indicator. +#' Its primarily meant as a helper function for downstream packages +#' that wants to use a customized control-flow. +#' +#' @examples +#' ## calculate the lookback +#' ## for the bollinger bands +#' talib::lookback( +#' talib::bollinger_bands, +#' n = 20, +#' x = talib::BTC +#' ) +#' +#' @param FUN A [call] or [function]. +#' @param ... Additional parameters passed into the indicator function. See examples for more details. +#' +#' @returns +#' An [integer] of [length] 1. +#' +#' @export +lookback <- function( + FUN, + ... +) { + ## store {talib} as a namespace + ## so the function can be found + ## (*_lookback is not exported) + ns <- getNamespace( + "talib" + ) + + ## extract the function call + ## as-is + FUN <- substitute( + FUN + ) + + if (is.call(FUN)) { + FUN <- FUN[[length(FUN)]] + } + + fun_name <- paste0(as.character(FUN), "_lookback") + + if (!exists(fun_name, envir = ns, mode = "function", inherits = FALSE)) { + stop( + "No internal function named `", + fun_name, + "` was found.", + call. = FALSE + ) + } + + FUN <- get(fun_name, envir = ns, mode = "function", inherits = FALSE) + + do.call(FUN, args = list(...)) +} From 00a182760315827c7137b7c18e6a2f99e8a1a8c2 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sat, 20 Jun 2026 21:52:22 +0200 Subject: [PATCH 05/12] :fire: Added unit-test on lookbacks * The unit-test tests whether the lookback is equal between the lookback() and attribute. This is mainly to test the lookback() and not the the indicators. They are calculated the same way. --- codegen/generate_unit-tests.sh | 18 ++++++++++++++++++ tests/testthat/test-ta_ACCBANDS.R | 15 +++++++++++++++ tests/testthat/test-ta_AD.R | 18 ++++++++++++++++++ tests/testthat/test-ta_ADOSC.R | 18 ++++++++++++++++++ tests/testthat/test-ta_ADX.R | 15 +++++++++++++++ tests/testthat/test-ta_ADXR.R | 18 ++++++++++++++++++ tests/testthat/test-ta_APO.R | 15 +++++++++++++++ tests/testthat/test-ta_AROON.R | 15 +++++++++++++++ tests/testthat/test-ta_AROONOSC.R | 15 +++++++++++++++ tests/testthat/test-ta_ATR.R | 15 +++++++++++++++ tests/testthat/test-ta_AVGPRICE.R | 15 +++++++++++++++ tests/testthat/test-ta_BBANDS.R | 15 +++++++++++++++ tests/testthat/test-ta_BOP.R | 15 +++++++++++++++ tests/testthat/test-ta_CCI.R | 15 +++++++++++++++ tests/testthat/test-ta_CDL2CROWS.R | 15 +++++++++++++++ tests/testthat/test-ta_CDL3BLACKCROWS.R | 15 +++++++++++++++ tests/testthat/test-ta_CDL3INSIDE.R | 15 +++++++++++++++ tests/testthat/test-ta_CDL3LINESTRIKE.R | 15 +++++++++++++++ tests/testthat/test-ta_CDL3OUTSIDE.R | 15 +++++++++++++++ tests/testthat/test-ta_CDL3STARSINSOUTH.R | 15 +++++++++++++++ tests/testthat/test-ta_CDL3WHITESOLDIERS.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLABANDONEDBABY.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLADVANCEBLOCK.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLBELTHOLD.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLBREAKAWAY.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLCLOSINGMARUBOZU.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLCONCEALBABYSWALL.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLCOUNTERATTACK.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLDARKCLOUDCOVER.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLDOJI.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLDOJISTAR.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLDRAGONFLYDOJI.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLENGULFING.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLEVENINGDOJISTAR.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLEVENINGSTAR.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLGAPSIDESIDEWHITE.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLGRAVESTONEDOJI.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLHAMMER.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLHANGINGMAN.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLHARAMI.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLHARAMICROSS.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLHIGHWAVE.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLHIKKAKE.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLHIKKAKEMOD.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLHOMINGPIGEON.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLIDENTICAL3CROWS.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLINNECK.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLINVERTEDHAMMER.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLKICKING.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLKICKINGBYLENGTH.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLLADDERBOTTOM.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLLONGLEGGEDDOJI.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLLONGLINE.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLMARUBOZU.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLMATCHINGLOW.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLMATHOLD.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLMORNINGDOJISTAR.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLMORNINGSTAR.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLONNECK.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLPIERCING.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLRICKSHAWMAN.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLRISEFALL3METHODS.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLSEPARATINGLINES.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLSHOOTINGSTAR.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLSHORTLINE.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLSPINNINGTOP.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLSTALLEDPATTERN.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLSTICKSANDWICH.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLTAKURI.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLTASUKIGAP.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLTHRUSTING.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLTRISTAR.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLUNIQUE3RIVER.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLUPSIDEGAP2CROWS.R | 15 +++++++++++++++ tests/testthat/test-ta_CDLXSIDEGAP3METHODS.R | 15 +++++++++++++++ tests/testthat/test-ta_CMO.R | 15 +++++++++++++++ tests/testthat/test-ta_DEMA.R | 15 +++++++++++++++ tests/testthat/test-ta_DX.R | 15 +++++++++++++++ tests/testthat/test-ta_EMA.R | 15 +++++++++++++++ tests/testthat/test-ta_HT_DCPERIOD.R | 15 +++++++++++++++ tests/testthat/test-ta_HT_DCPHASE.R | 15 +++++++++++++++ tests/testthat/test-ta_HT_PHASOR.R | 15 +++++++++++++++ tests/testthat/test-ta_HT_SINE.R | 15 +++++++++++++++ tests/testthat/test-ta_HT_TRENDLINE.R | 15 +++++++++++++++ tests/testthat/test-ta_HT_TRENDMODE.R | 15 +++++++++++++++ tests/testthat/test-ta_IMI.R | 15 +++++++++++++++ tests/testthat/test-ta_KAMA.R | 15 +++++++++++++++ tests/testthat/test-ta_MACD.R | 18 ++++++++++++++++++ tests/testthat/test-ta_MACDEXT.R | 18 ++++++++++++++++++ tests/testthat/test-ta_MACDFIX.R | 18 ++++++++++++++++++ tests/testthat/test-ta_MAMA.R | 15 +++++++++++++++ tests/testthat/test-ta_MEDPRICE.R | 15 +++++++++++++++ tests/testthat/test-ta_MFI.R | 15 +++++++++++++++ tests/testthat/test-ta_MIDPRICE.R | 15 +++++++++++++++ tests/testthat/test-ta_MINUS_DI.R | 15 +++++++++++++++ tests/testthat/test-ta_MINUS_DM.R | 15 +++++++++++++++ tests/testthat/test-ta_MOM.R | 15 +++++++++++++++ tests/testthat/test-ta_NATR.R | 15 +++++++++++++++ tests/testthat/test-ta_OBV.R | 15 +++++++++++++++ tests/testthat/test-ta_PLUS_DI.R | 15 +++++++++++++++ tests/testthat/test-ta_PLUS_DM.R | 15 +++++++++++++++ tests/testthat/test-ta_PPO.R | 15 +++++++++++++++ tests/testthat/test-ta_ROC.R | 15 +++++++++++++++ tests/testthat/test-ta_ROCR.R | 15 +++++++++++++++ tests/testthat/test-ta_RSI.R | 15 +++++++++++++++ tests/testthat/test-ta_SAR.R | 15 +++++++++++++++ tests/testthat/test-ta_SAREXT.R | 15 +++++++++++++++ tests/testthat/test-ta_SMA.R | 15 +++++++++++++++ tests/testthat/test-ta_STOCH.R | 15 +++++++++++++++ tests/testthat/test-ta_STOCHF.R | 15 +++++++++++++++ tests/testthat/test-ta_STOCHRSI.R | 15 +++++++++++++++ tests/testthat/test-ta_T3.R | 15 +++++++++++++++ tests/testthat/test-ta_TEMA.R | 15 +++++++++++++++ tests/testthat/test-ta_TRANGE.R | 15 +++++++++++++++ tests/testthat/test-ta_TRIMA.R | 15 +++++++++++++++ tests/testthat/test-ta_TRIX.R | 15 +++++++++++++++ tests/testthat/test-ta_TYPPRICE.R | 15 +++++++++++++++ tests/testthat/test-ta_ULTOSC.R | 15 +++++++++++++++ tests/testthat/test-ta_VOLUME.R | 15 +++++++++++++++ tests/testthat/test-ta_WCLPRICE.R | 15 +++++++++++++++ tests/testthat/test-ta_WILLR.R | 15 +++++++++++++++ tests/testthat/test-ta_WMA.R | 15 +++++++++++++++ 122 files changed, 1851 insertions(+) diff --git a/codegen/generate_unit-tests.sh b/codegen/generate_unit-tests.sh index 685ea702f..9e67e1b24 100755 --- a/codegen/generate_unit-tests.sh +++ b/codegen/generate_unit-tests.sh @@ -232,6 +232,24 @@ testthat::test_that(desc = 'Row names are respected for ', code = { ) }) + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + +output <- attr( + ${FUN}(SPY), + "lookback" +) + +testthat::expect_equal( + object = output, + expected = lookback(FUN = ${FUN}, x = SPY) + ) + +} +) + EOF ## Add plotly methods diff --git a/tests/testthat/test-ta_ACCBANDS.R b/tests/testthat/test-ta_ACCBANDS.R index 2bce7be98..d27f7b6e0 100644 --- a/tests/testthat/test-ta_ACCBANDS.R +++ b/tests/testthat/test-ta_ACCBANDS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + acceleration_bands(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = acceleration_bands, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_AD.R b/tests/testthat/test-ta_AD.R index 28d61d694..aa72aabca 100644 --- a/tests/testthat/test-ta_AD.R +++ b/tests/testthat/test-ta_AD.R @@ -145,6 +145,24 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + chaikin_accumulation_distribution_line(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback( + FUN = chaikin_accumulation_distribution_line, + x = SPY + ) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_ADOSC.R b/tests/testthat/test-ta_ADOSC.R index 9ed88a8d0..02e4e468a 100644 --- a/tests/testthat/test-ta_ADOSC.R +++ b/tests/testthat/test-ta_ADOSC.R @@ -148,6 +148,24 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + chaikin_accumulation_distribution_oscillator(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback( + FUN = chaikin_accumulation_distribution_oscillator, + x = SPY + ) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_ADX.R b/tests/testthat/test-ta_ADX.R index aa0e9f651..ad23c49bd 100644 --- a/tests/testthat/test-ta_ADX.R +++ b/tests/testthat/test-ta_ADX.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + average_directional_movement_index(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = average_directional_movement_index, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_ADXR.R b/tests/testthat/test-ta_ADXR.R index ce5f58cbd..3169fe75a 100644 --- a/tests/testthat/test-ta_ADXR.R +++ b/tests/testthat/test-ta_ADXR.R @@ -148,6 +148,24 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + average_directional_movement_index_rating(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback( + FUN = average_directional_movement_index_rating, + x = SPY + ) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_APO.R b/tests/testthat/test-ta_APO.R index 6a44cfee2..87fe1148a 100644 --- a/tests/testthat/test-ta_APO.R +++ b/tests/testthat/test-ta_APO.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + absolute_price_oscillator(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = absolute_price_oscillator, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_AROON.R b/tests/testthat/test-ta_AROON.R index adfbecc4e..737e5d5ab 100644 --- a/tests/testthat/test-ta_AROON.R +++ b/tests/testthat/test-ta_AROON.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + aroon(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = aroon, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_AROONOSC.R b/tests/testthat/test-ta_AROONOSC.R index 6c96b785b..0fe1ce0cf 100644 --- a/tests/testthat/test-ta_AROONOSC.R +++ b/tests/testthat/test-ta_AROONOSC.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + aroon_oscillator(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = aroon_oscillator, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_ATR.R b/tests/testthat/test-ta_ATR.R index 4745c6a89..abc4294a8 100644 --- a/tests/testthat/test-ta_ATR.R +++ b/tests/testthat/test-ta_ATR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + average_true_range(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = average_true_range, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_AVGPRICE.R b/tests/testthat/test-ta_AVGPRICE.R index a6ae729b2..35525c9d9 100644 --- a/tests/testthat/test-ta_AVGPRICE.R +++ b/tests/testthat/test-ta_AVGPRICE.R @@ -143,3 +143,18 @@ testthat::test_that(desc = 'Row names are respected for ', code = { expected = rownames(indicator) ) }) + + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + average_price(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = average_price, x = SPY) + ) +}) diff --git a/tests/testthat/test-ta_BBANDS.R b/tests/testthat/test-ta_BBANDS.R index 238809d1b..fe9113bce 100644 --- a/tests/testthat/test-ta_BBANDS.R +++ b/tests/testthat/test-ta_BBANDS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + bollinger_bands(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = bollinger_bands, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_BOP.R b/tests/testthat/test-ta_BOP.R index 55707da8f..ab00b9c4e 100644 --- a/tests/testthat/test-ta_BOP.R +++ b/tests/testthat/test-ta_BOP.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + balance_of_power(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = balance_of_power, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CCI.R b/tests/testthat/test-ta_CCI.R index 00ae8c3d0..fb88cdc5f 100644 --- a/tests/testthat/test-ta_CCI.R +++ b/tests/testthat/test-ta_CCI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + commodity_channel_index(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = commodity_channel_index, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDL2CROWS.R b/tests/testthat/test-ta_CDL2CROWS.R index be0fcce24..57e89c099 100644 --- a/tests/testthat/test-ta_CDL2CROWS.R +++ b/tests/testthat/test-ta_CDL2CROWS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + two_crows(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = two_crows, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDL3BLACKCROWS.R b/tests/testthat/test-ta_CDL3BLACKCROWS.R index 3ffbd29c2..ae024da6d 100644 --- a/tests/testthat/test-ta_CDL3BLACKCROWS.R +++ b/tests/testthat/test-ta_CDL3BLACKCROWS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + three_black_crows(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = three_black_crows, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDL3INSIDE.R b/tests/testthat/test-ta_CDL3INSIDE.R index 904d06ff1..b01e35a84 100644 --- a/tests/testthat/test-ta_CDL3INSIDE.R +++ b/tests/testthat/test-ta_CDL3INSIDE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + three_inside(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = three_inside, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDL3LINESTRIKE.R b/tests/testthat/test-ta_CDL3LINESTRIKE.R index 52f5f28ae..d90a2a525 100644 --- a/tests/testthat/test-ta_CDL3LINESTRIKE.R +++ b/tests/testthat/test-ta_CDL3LINESTRIKE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + three_line_strike(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = three_line_strike, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDL3OUTSIDE.R b/tests/testthat/test-ta_CDL3OUTSIDE.R index 1e0d888a8..8bd959af2 100644 --- a/tests/testthat/test-ta_CDL3OUTSIDE.R +++ b/tests/testthat/test-ta_CDL3OUTSIDE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + three_outside(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = three_outside, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDL3STARSINSOUTH.R b/tests/testthat/test-ta_CDL3STARSINSOUTH.R index 4949a6f17..7711c3797 100644 --- a/tests/testthat/test-ta_CDL3STARSINSOUTH.R +++ b/tests/testthat/test-ta_CDL3STARSINSOUTH.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + three_stars_in_the_south(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = three_stars_in_the_south, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDL3WHITESOLDIERS.R b/tests/testthat/test-ta_CDL3WHITESOLDIERS.R index 2fead055e..1090b3a2c 100644 --- a/tests/testthat/test-ta_CDL3WHITESOLDIERS.R +++ b/tests/testthat/test-ta_CDL3WHITESOLDIERS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + three_white_soldiers(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = three_white_soldiers, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLABANDONEDBABY.R b/tests/testthat/test-ta_CDLABANDONEDBABY.R index 8af4d3e6a..a756c7c0a 100644 --- a/tests/testthat/test-ta_CDLABANDONEDBABY.R +++ b/tests/testthat/test-ta_CDLABANDONEDBABY.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + abandoned_baby(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = abandoned_baby, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLADVANCEBLOCK.R b/tests/testthat/test-ta_CDLADVANCEBLOCK.R index 99841b11a..0b2d49de5 100644 --- a/tests/testthat/test-ta_CDLADVANCEBLOCK.R +++ b/tests/testthat/test-ta_CDLADVANCEBLOCK.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + advance_block(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = advance_block, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLBELTHOLD.R b/tests/testthat/test-ta_CDLBELTHOLD.R index cf98c69c9..0925897d7 100644 --- a/tests/testthat/test-ta_CDLBELTHOLD.R +++ b/tests/testthat/test-ta_CDLBELTHOLD.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + belt_hold(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = belt_hold, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLBREAKAWAY.R b/tests/testthat/test-ta_CDLBREAKAWAY.R index bc510b1bf..5d7742f70 100644 --- a/tests/testthat/test-ta_CDLBREAKAWAY.R +++ b/tests/testthat/test-ta_CDLBREAKAWAY.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + break_away(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = break_away, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLCLOSINGMARUBOZU.R b/tests/testthat/test-ta_CDLCLOSINGMARUBOZU.R index d3e9fc72a..fbadbae5c 100644 --- a/tests/testthat/test-ta_CDLCLOSINGMARUBOZU.R +++ b/tests/testthat/test-ta_CDLCLOSINGMARUBOZU.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + closing_marubozu(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = closing_marubozu, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLCONCEALBABYSWALL.R b/tests/testthat/test-ta_CDLCONCEALBABYSWALL.R index 6e5bbf613..01944539c 100644 --- a/tests/testthat/test-ta_CDLCONCEALBABYSWALL.R +++ b/tests/testthat/test-ta_CDLCONCEALBABYSWALL.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + concealing_baby_swallow(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = concealing_baby_swallow, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLCOUNTERATTACK.R b/tests/testthat/test-ta_CDLCOUNTERATTACK.R index 2de3e4319..6b88529b3 100644 --- a/tests/testthat/test-ta_CDLCOUNTERATTACK.R +++ b/tests/testthat/test-ta_CDLCOUNTERATTACK.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + counter_attack(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = counter_attack, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLDARKCLOUDCOVER.R b/tests/testthat/test-ta_CDLDARKCLOUDCOVER.R index df221cf64..887072eeb 100644 --- a/tests/testthat/test-ta_CDLDARKCLOUDCOVER.R +++ b/tests/testthat/test-ta_CDLDARKCLOUDCOVER.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + dark_cloud_cover(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = dark_cloud_cover, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLDOJI.R b/tests/testthat/test-ta_CDLDOJI.R index 67e041f02..9be0ca7a8 100644 --- a/tests/testthat/test-ta_CDLDOJI.R +++ b/tests/testthat/test-ta_CDLDOJI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + doji(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = doji, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLDOJISTAR.R b/tests/testthat/test-ta_CDLDOJISTAR.R index cc48aeddd..3dd27de85 100644 --- a/tests/testthat/test-ta_CDLDOJISTAR.R +++ b/tests/testthat/test-ta_CDLDOJISTAR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + doji_star(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = doji_star, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLDRAGONFLYDOJI.R b/tests/testthat/test-ta_CDLDRAGONFLYDOJI.R index 098c48167..7b5f5fbb1 100644 --- a/tests/testthat/test-ta_CDLDRAGONFLYDOJI.R +++ b/tests/testthat/test-ta_CDLDRAGONFLYDOJI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + dragonfly_doji(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = dragonfly_doji, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLENGULFING.R b/tests/testthat/test-ta_CDLENGULFING.R index fa7e4c09b..b6de41d3d 100644 --- a/tests/testthat/test-ta_CDLENGULFING.R +++ b/tests/testthat/test-ta_CDLENGULFING.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + engulfing(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = engulfing, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLEVENINGDOJISTAR.R b/tests/testthat/test-ta_CDLEVENINGDOJISTAR.R index b4b9b5fc8..e88be9f88 100644 --- a/tests/testthat/test-ta_CDLEVENINGDOJISTAR.R +++ b/tests/testthat/test-ta_CDLEVENINGDOJISTAR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + evening_doji_star(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = evening_doji_star, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLEVENINGSTAR.R b/tests/testthat/test-ta_CDLEVENINGSTAR.R index a8a232d0a..2fd5dd7e4 100644 --- a/tests/testthat/test-ta_CDLEVENINGSTAR.R +++ b/tests/testthat/test-ta_CDLEVENINGSTAR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + evening_star(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = evening_star, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLGAPSIDESIDEWHITE.R b/tests/testthat/test-ta_CDLGAPSIDESIDEWHITE.R index 10e7f8a07..2cede5c71 100644 --- a/tests/testthat/test-ta_CDLGAPSIDESIDEWHITE.R +++ b/tests/testthat/test-ta_CDLGAPSIDESIDEWHITE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + gaps_side_white(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = gaps_side_white, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLGRAVESTONEDOJI.R b/tests/testthat/test-ta_CDLGRAVESTONEDOJI.R index 160936539..e9b9547e7 100644 --- a/tests/testthat/test-ta_CDLGRAVESTONEDOJI.R +++ b/tests/testthat/test-ta_CDLGRAVESTONEDOJI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + gravestone_doji(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = gravestone_doji, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLHAMMER.R b/tests/testthat/test-ta_CDLHAMMER.R index 047e42d2e..89769d5f8 100644 --- a/tests/testthat/test-ta_CDLHAMMER.R +++ b/tests/testthat/test-ta_CDLHAMMER.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + hammer(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = hammer, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLHANGINGMAN.R b/tests/testthat/test-ta_CDLHANGINGMAN.R index da7084715..293d18582 100644 --- a/tests/testthat/test-ta_CDLHANGINGMAN.R +++ b/tests/testthat/test-ta_CDLHANGINGMAN.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + hanging_man(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = hanging_man, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLHARAMI.R b/tests/testthat/test-ta_CDLHARAMI.R index 7ee501a58..ad4d92e73 100644 --- a/tests/testthat/test-ta_CDLHARAMI.R +++ b/tests/testthat/test-ta_CDLHARAMI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + harami(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = harami, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLHARAMICROSS.R b/tests/testthat/test-ta_CDLHARAMICROSS.R index 7a61982b9..366621256 100644 --- a/tests/testthat/test-ta_CDLHARAMICROSS.R +++ b/tests/testthat/test-ta_CDLHARAMICROSS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + harami_cross(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = harami_cross, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLHIGHWAVE.R b/tests/testthat/test-ta_CDLHIGHWAVE.R index d928d8fc6..d8fd29fc3 100644 --- a/tests/testthat/test-ta_CDLHIGHWAVE.R +++ b/tests/testthat/test-ta_CDLHIGHWAVE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + high_wave(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = high_wave, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLHIKKAKE.R b/tests/testthat/test-ta_CDLHIKKAKE.R index a1639124e..8ff701939 100644 --- a/tests/testthat/test-ta_CDLHIKKAKE.R +++ b/tests/testthat/test-ta_CDLHIKKAKE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + hikakke(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = hikakke, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLHIKKAKEMOD.R b/tests/testthat/test-ta_CDLHIKKAKEMOD.R index 82eecd158..f08218c21 100644 --- a/tests/testthat/test-ta_CDLHIKKAKEMOD.R +++ b/tests/testthat/test-ta_CDLHIKKAKEMOD.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + hikakke_mod(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = hikakke_mod, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLHOMINGPIGEON.R b/tests/testthat/test-ta_CDLHOMINGPIGEON.R index c2ea37eca..dcbdcdbde 100644 --- a/tests/testthat/test-ta_CDLHOMINGPIGEON.R +++ b/tests/testthat/test-ta_CDLHOMINGPIGEON.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + homing_pigeon(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = homing_pigeon, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLIDENTICAL3CROWS.R b/tests/testthat/test-ta_CDLIDENTICAL3CROWS.R index c001ea8f4..efc977d05 100644 --- a/tests/testthat/test-ta_CDLIDENTICAL3CROWS.R +++ b/tests/testthat/test-ta_CDLIDENTICAL3CROWS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + three_identical_crows(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = three_identical_crows, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLINNECK.R b/tests/testthat/test-ta_CDLINNECK.R index 17b847b8e..67a0ffc99 100644 --- a/tests/testthat/test-ta_CDLINNECK.R +++ b/tests/testthat/test-ta_CDLINNECK.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + in_neck(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = in_neck, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLINVERTEDHAMMER.R b/tests/testthat/test-ta_CDLINVERTEDHAMMER.R index 5a72d69e9..081a9961a 100644 --- a/tests/testthat/test-ta_CDLINVERTEDHAMMER.R +++ b/tests/testthat/test-ta_CDLINVERTEDHAMMER.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + inverted_hammer(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = inverted_hammer, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLKICKING.R b/tests/testthat/test-ta_CDLKICKING.R index 54e26ba44..0e544cecc 100644 --- a/tests/testthat/test-ta_CDLKICKING.R +++ b/tests/testthat/test-ta_CDLKICKING.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + kicking(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = kicking, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLKICKINGBYLENGTH.R b/tests/testthat/test-ta_CDLKICKINGBYLENGTH.R index 96b3dd158..81efb459d 100644 --- a/tests/testthat/test-ta_CDLKICKINGBYLENGTH.R +++ b/tests/testthat/test-ta_CDLKICKINGBYLENGTH.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + kicking_baby_length(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = kicking_baby_length, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLLADDERBOTTOM.R b/tests/testthat/test-ta_CDLLADDERBOTTOM.R index 75d5b4bc9..74170a8a8 100644 --- a/tests/testthat/test-ta_CDLLADDERBOTTOM.R +++ b/tests/testthat/test-ta_CDLLADDERBOTTOM.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + ladder_bottom(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = ladder_bottom, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLLONGLEGGEDDOJI.R b/tests/testthat/test-ta_CDLLONGLEGGEDDOJI.R index 353ca3b28..0ca3a2d6f 100644 --- a/tests/testthat/test-ta_CDLLONGLEGGEDDOJI.R +++ b/tests/testthat/test-ta_CDLLONGLEGGEDDOJI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + long_legged_doji(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = long_legged_doji, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLLONGLINE.R b/tests/testthat/test-ta_CDLLONGLINE.R index 8982d3e8e..550647bf4 100644 --- a/tests/testthat/test-ta_CDLLONGLINE.R +++ b/tests/testthat/test-ta_CDLLONGLINE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + long_line(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = long_line, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLMARUBOZU.R b/tests/testthat/test-ta_CDLMARUBOZU.R index 2aa85275b..8cfa02440 100644 --- a/tests/testthat/test-ta_CDLMARUBOZU.R +++ b/tests/testthat/test-ta_CDLMARUBOZU.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + marubozu(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = marubozu, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLMATCHINGLOW.R b/tests/testthat/test-ta_CDLMATCHINGLOW.R index cc0b2d134..e340936ee 100644 --- a/tests/testthat/test-ta_CDLMATCHINGLOW.R +++ b/tests/testthat/test-ta_CDLMATCHINGLOW.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + matching_low(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = matching_low, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLMATHOLD.R b/tests/testthat/test-ta_CDLMATHOLD.R index 3061c6f99..19d711cb0 100644 --- a/tests/testthat/test-ta_CDLMATHOLD.R +++ b/tests/testthat/test-ta_CDLMATHOLD.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + mat_hold(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = mat_hold, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLMORNINGDOJISTAR.R b/tests/testthat/test-ta_CDLMORNINGDOJISTAR.R index 4e9d131eb..ec281f228 100644 --- a/tests/testthat/test-ta_CDLMORNINGDOJISTAR.R +++ b/tests/testthat/test-ta_CDLMORNINGDOJISTAR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + morning_doji_star(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = morning_doji_star, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLMORNINGSTAR.R b/tests/testthat/test-ta_CDLMORNINGSTAR.R index fb04a8d47..1701248cf 100644 --- a/tests/testthat/test-ta_CDLMORNINGSTAR.R +++ b/tests/testthat/test-ta_CDLMORNINGSTAR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + morning_star(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = morning_star, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLONNECK.R b/tests/testthat/test-ta_CDLONNECK.R index a18cf4f92..e62388a5e 100644 --- a/tests/testthat/test-ta_CDLONNECK.R +++ b/tests/testthat/test-ta_CDLONNECK.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + on_neck(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = on_neck, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLPIERCING.R b/tests/testthat/test-ta_CDLPIERCING.R index 118b1041a..4734b0de6 100644 --- a/tests/testthat/test-ta_CDLPIERCING.R +++ b/tests/testthat/test-ta_CDLPIERCING.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + piercing(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = piercing, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLRICKSHAWMAN.R b/tests/testthat/test-ta_CDLRICKSHAWMAN.R index 9b5de9900..3e7b17e1c 100644 --- a/tests/testthat/test-ta_CDLRICKSHAWMAN.R +++ b/tests/testthat/test-ta_CDLRICKSHAWMAN.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rickshaw_man(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = rickshaw_man, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLRISEFALL3METHODS.R b/tests/testthat/test-ta_CDLRISEFALL3METHODS.R index 4a9f7fe73..1510aaf78 100644 --- a/tests/testthat/test-ta_CDLRISEFALL3METHODS.R +++ b/tests/testthat/test-ta_CDLRISEFALL3METHODS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rise_fall_3_methods(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = rise_fall_3_methods, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLSEPARATINGLINES.R b/tests/testthat/test-ta_CDLSEPARATINGLINES.R index 7756e474b..e7006563f 100644 --- a/tests/testthat/test-ta_CDLSEPARATINGLINES.R +++ b/tests/testthat/test-ta_CDLSEPARATINGLINES.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + separating_lines(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = separating_lines, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLSHOOTINGSTAR.R b/tests/testthat/test-ta_CDLSHOOTINGSTAR.R index 7af511f6d..3a7010c90 100644 --- a/tests/testthat/test-ta_CDLSHOOTINGSTAR.R +++ b/tests/testthat/test-ta_CDLSHOOTINGSTAR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + shooting_star(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = shooting_star, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLSHORTLINE.R b/tests/testthat/test-ta_CDLSHORTLINE.R index b98f773be..c71da3c59 100644 --- a/tests/testthat/test-ta_CDLSHORTLINE.R +++ b/tests/testthat/test-ta_CDLSHORTLINE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + short_line(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = short_line, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLSPINNINGTOP.R b/tests/testthat/test-ta_CDLSPINNINGTOP.R index 6bd2ec372..848de0884 100644 --- a/tests/testthat/test-ta_CDLSPINNINGTOP.R +++ b/tests/testthat/test-ta_CDLSPINNINGTOP.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + spinning_top(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = spinning_top, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLSTALLEDPATTERN.R b/tests/testthat/test-ta_CDLSTALLEDPATTERN.R index 7e2bdff9f..7a08ac4ca 100644 --- a/tests/testthat/test-ta_CDLSTALLEDPATTERN.R +++ b/tests/testthat/test-ta_CDLSTALLEDPATTERN.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + stalled_pattern(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = stalled_pattern, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLSTICKSANDWICH.R b/tests/testthat/test-ta_CDLSTICKSANDWICH.R index a083b6598..66efd60ab 100644 --- a/tests/testthat/test-ta_CDLSTICKSANDWICH.R +++ b/tests/testthat/test-ta_CDLSTICKSANDWICH.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + stick_sandwich(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = stick_sandwich, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLTAKURI.R b/tests/testthat/test-ta_CDLTAKURI.R index ca4ddf6c1..aa9d1a6de 100644 --- a/tests/testthat/test-ta_CDLTAKURI.R +++ b/tests/testthat/test-ta_CDLTAKURI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + takuri(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = takuri, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLTASUKIGAP.R b/tests/testthat/test-ta_CDLTASUKIGAP.R index 151338573..e652c9127 100644 --- a/tests/testthat/test-ta_CDLTASUKIGAP.R +++ b/tests/testthat/test-ta_CDLTASUKIGAP.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + tasuki_gap(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = tasuki_gap, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLTHRUSTING.R b/tests/testthat/test-ta_CDLTHRUSTING.R index 775b2c9fa..895e33459 100644 --- a/tests/testthat/test-ta_CDLTHRUSTING.R +++ b/tests/testthat/test-ta_CDLTHRUSTING.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + thrusting(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = thrusting, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLTRISTAR.R b/tests/testthat/test-ta_CDLTRISTAR.R index 561cd18de..2bd3d5a70 100644 --- a/tests/testthat/test-ta_CDLTRISTAR.R +++ b/tests/testthat/test-ta_CDLTRISTAR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + tristar(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = tristar, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLUNIQUE3RIVER.R b/tests/testthat/test-ta_CDLUNIQUE3RIVER.R index 59f06585c..48f97a82b 100644 --- a/tests/testthat/test-ta_CDLUNIQUE3RIVER.R +++ b/tests/testthat/test-ta_CDLUNIQUE3RIVER.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + unique_3_river(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = unique_3_river, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLUPSIDEGAP2CROWS.R b/tests/testthat/test-ta_CDLUPSIDEGAP2CROWS.R index cb8d12ad3..982790841 100644 --- a/tests/testthat/test-ta_CDLUPSIDEGAP2CROWS.R +++ b/tests/testthat/test-ta_CDLUPSIDEGAP2CROWS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + upside_gap_2_crows(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = upside_gap_2_crows, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CDLXSIDEGAP3METHODS.R b/tests/testthat/test-ta_CDLXSIDEGAP3METHODS.R index f4b20b9e0..710f3b903 100644 --- a/tests/testthat/test-ta_CDLXSIDEGAP3METHODS.R +++ b/tests/testthat/test-ta_CDLXSIDEGAP3METHODS.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + xside_gap_3_methods(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = xside_gap_3_methods, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_CMO.R b/tests/testthat/test-ta_CMO.R index f4ebea873..dcb4b1891 100644 --- a/tests/testthat/test-ta_CMO.R +++ b/tests/testthat/test-ta_CMO.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + chande_momentum_oscillator(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = chande_momentum_oscillator, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_DEMA.R b/tests/testthat/test-ta_DEMA.R index 6a6ba8e70..6ac122e48 100644 --- a/tests/testthat/test-ta_DEMA.R +++ b/tests/testthat/test-ta_DEMA.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + double_exponential_moving_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = double_exponential_moving_average, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_DX.R b/tests/testthat/test-ta_DX.R index 0ef9a0ec7..06e961326 100644 --- a/tests/testthat/test-ta_DX.R +++ b/tests/testthat/test-ta_DX.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + directional_movement_index(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = directional_movement_index, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_EMA.R b/tests/testthat/test-ta_EMA.R index 9727c2f61..7ce7411a0 100644 --- a/tests/testthat/test-ta_EMA.R +++ b/tests/testthat/test-ta_EMA.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + exponential_moving_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = exponential_moving_average, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_HT_DCPERIOD.R b/tests/testthat/test-ta_HT_DCPERIOD.R index 8ccdab5e0..79bfb9c81 100644 --- a/tests/testthat/test-ta_HT_DCPERIOD.R +++ b/tests/testthat/test-ta_HT_DCPERIOD.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + dominant_cycle_period(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = dominant_cycle_period, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_HT_DCPHASE.R b/tests/testthat/test-ta_HT_DCPHASE.R index d2db18264..8a7338f01 100644 --- a/tests/testthat/test-ta_HT_DCPHASE.R +++ b/tests/testthat/test-ta_HT_DCPHASE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + dominant_cycle_phase(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = dominant_cycle_phase, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_HT_PHASOR.R b/tests/testthat/test-ta_HT_PHASOR.R index f08458d9c..0f4a33f02 100644 --- a/tests/testthat/test-ta_HT_PHASOR.R +++ b/tests/testthat/test-ta_HT_PHASOR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + phasor_components(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = phasor_components, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_HT_SINE.R b/tests/testthat/test-ta_HT_SINE.R index 501aaf0c4..b3e390cc5 100644 --- a/tests/testthat/test-ta_HT_SINE.R +++ b/tests/testthat/test-ta_HT_SINE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + sine_wave(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = sine_wave, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_HT_TRENDLINE.R b/tests/testthat/test-ta_HT_TRENDLINE.R index 2989d5a37..50ab6c80c 100644 --- a/tests/testthat/test-ta_HT_TRENDLINE.R +++ b/tests/testthat/test-ta_HT_TRENDLINE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + trendline(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = trendline, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_HT_TRENDMODE.R b/tests/testthat/test-ta_HT_TRENDMODE.R index d3cdaa2aa..28cd15d77 100644 --- a/tests/testthat/test-ta_HT_TRENDMODE.R +++ b/tests/testthat/test-ta_HT_TRENDMODE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + trend_cycle_mode(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = trend_cycle_mode, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_IMI.R b/tests/testthat/test-ta_IMI.R index 586fd435c..68dc4224c 100644 --- a/tests/testthat/test-ta_IMI.R +++ b/tests/testthat/test-ta_IMI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + intraday_movement_index(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = intraday_movement_index, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_KAMA.R b/tests/testthat/test-ta_KAMA.R index 3aa0f28b2..f91c42f8b 100644 --- a/tests/testthat/test-ta_KAMA.R +++ b/tests/testthat/test-ta_KAMA.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + kaufman_adaptive_moving_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = kaufman_adaptive_moving_average, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_MACD.R b/tests/testthat/test-ta_MACD.R index 36a1ae586..004baf06b 100644 --- a/tests/testthat/test-ta_MACD.R +++ b/tests/testthat/test-ta_MACD.R @@ -145,6 +145,24 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + moving_average_convergence_divergence(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback( + FUN = moving_average_convergence_divergence, + x = SPY + ) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_MACDEXT.R b/tests/testthat/test-ta_MACDEXT.R index 72fb59806..b46ef0ed6 100644 --- a/tests/testthat/test-ta_MACDEXT.R +++ b/tests/testthat/test-ta_MACDEXT.R @@ -154,6 +154,24 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + extended_moving_average_convergence_divergence(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback( + FUN = extended_moving_average_convergence_divergence, + x = SPY + ) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_MACDFIX.R b/tests/testthat/test-ta_MACDFIX.R index dc316ca41..e647d7ee8 100644 --- a/tests/testthat/test-ta_MACDFIX.R +++ b/tests/testthat/test-ta_MACDFIX.R @@ -148,6 +148,24 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + fixed_moving_average_convergence_divergence(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback( + FUN = fixed_moving_average_convergence_divergence, + x = SPY + ) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_MAMA.R b/tests/testthat/test-ta_MAMA.R index 43eefc0ea..bd9c438d0 100644 --- a/tests/testthat/test-ta_MAMA.R +++ b/tests/testthat/test-ta_MAMA.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + mesa_adaptive_moving_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = mesa_adaptive_moving_average, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_MEDPRICE.R b/tests/testthat/test-ta_MEDPRICE.R index a3268f1ec..5d5c02888 100644 --- a/tests/testthat/test-ta_MEDPRICE.R +++ b/tests/testthat/test-ta_MEDPRICE.R @@ -143,3 +143,18 @@ testthat::test_that(desc = 'Row names are respected for ', code = { expected = rownames(indicator) ) }) + + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + median_price(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = median_price, x = SPY) + ) +}) diff --git a/tests/testthat/test-ta_MFI.R b/tests/testthat/test-ta_MFI.R index b6f832c39..c785d3196 100644 --- a/tests/testthat/test-ta_MFI.R +++ b/tests/testthat/test-ta_MFI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + money_flow_index(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = money_flow_index, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_MIDPRICE.R b/tests/testthat/test-ta_MIDPRICE.R index 3b0ff3d34..9ad709206 100644 --- a/tests/testthat/test-ta_MIDPRICE.R +++ b/tests/testthat/test-ta_MIDPRICE.R @@ -143,3 +143,18 @@ testthat::test_that(desc = 'Row names are respected for ', code = { expected = rownames(indicator) ) }) + + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + midpoint_price(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = midpoint_price, x = SPY) + ) +}) diff --git a/tests/testthat/test-ta_MINUS_DI.R b/tests/testthat/test-ta_MINUS_DI.R index a2d444dd9..661051c7d 100644 --- a/tests/testthat/test-ta_MINUS_DI.R +++ b/tests/testthat/test-ta_MINUS_DI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + minus_directional_indicator(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = minus_directional_indicator, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_MINUS_DM.R b/tests/testthat/test-ta_MINUS_DM.R index bd13137d1..567472906 100644 --- a/tests/testthat/test-ta_MINUS_DM.R +++ b/tests/testthat/test-ta_MINUS_DM.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + minus_directional_movement(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = minus_directional_movement, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_MOM.R b/tests/testthat/test-ta_MOM.R index ce5dc95e3..351061be4 100644 --- a/tests/testthat/test-ta_MOM.R +++ b/tests/testthat/test-ta_MOM.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + momentum(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = momentum, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_NATR.R b/tests/testthat/test-ta_NATR.R index 5d3e8d6cf..2e73d0da5 100644 --- a/tests/testthat/test-ta_NATR.R +++ b/tests/testthat/test-ta_NATR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + normalized_average_true_range(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = normalized_average_true_range, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_OBV.R b/tests/testthat/test-ta_OBV.R index e15438b2b..3cf6baa45 100644 --- a/tests/testthat/test-ta_OBV.R +++ b/tests/testthat/test-ta_OBV.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + on_balance_volume(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = on_balance_volume, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_PLUS_DI.R b/tests/testthat/test-ta_PLUS_DI.R index 252e91b89..56bb268d0 100644 --- a/tests/testthat/test-ta_PLUS_DI.R +++ b/tests/testthat/test-ta_PLUS_DI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + plus_directional_indicator(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = plus_directional_indicator, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_PLUS_DM.R b/tests/testthat/test-ta_PLUS_DM.R index 2e960ee99..d3382d5a2 100644 --- a/tests/testthat/test-ta_PLUS_DM.R +++ b/tests/testthat/test-ta_PLUS_DM.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + plus_directional_movement(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = plus_directional_movement, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_PPO.R b/tests/testthat/test-ta_PPO.R index 963cb3bb6..7604a854a 100644 --- a/tests/testthat/test-ta_PPO.R +++ b/tests/testthat/test-ta_PPO.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + percentage_price_oscillator(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = percentage_price_oscillator, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_ROC.R b/tests/testthat/test-ta_ROC.R index 9ac9dff84..be355b32f 100644 --- a/tests/testthat/test-ta_ROC.R +++ b/tests/testthat/test-ta_ROC.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rate_of_change(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = rate_of_change, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_ROCR.R b/tests/testthat/test-ta_ROCR.R index 3224cb183..256862794 100644 --- a/tests/testthat/test-ta_ROCR.R +++ b/tests/testthat/test-ta_ROCR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + ratio_of_change(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = ratio_of_change, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_RSI.R b/tests/testthat/test-ta_RSI.R index 40cc132df..9da8de1a8 100644 --- a/tests/testthat/test-ta_RSI.R +++ b/tests/testthat/test-ta_RSI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + relative_strength_index(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = relative_strength_index, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_SAR.R b/tests/testthat/test-ta_SAR.R index a3e0a58d8..b3d8365b4 100644 --- a/tests/testthat/test-ta_SAR.R +++ b/tests/testthat/test-ta_SAR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + parabolic_stop_and_reverse(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = parabolic_stop_and_reverse, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_SAREXT.R b/tests/testthat/test-ta_SAREXT.R index 3489c4c7f..136e064ff 100644 --- a/tests/testthat/test-ta_SAREXT.R +++ b/tests/testthat/test-ta_SAREXT.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + extended_parabolic_stop_and_reverse(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = extended_parabolic_stop_and_reverse, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_SMA.R b/tests/testthat/test-ta_SMA.R index 3e09822dc..ac374c927 100644 --- a/tests/testthat/test-ta_SMA.R +++ b/tests/testthat/test-ta_SMA.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + simple_moving_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = simple_moving_average, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_STOCH.R b/tests/testthat/test-ta_STOCH.R index 45fcbc33e..ddb54a3d0 100644 --- a/tests/testthat/test-ta_STOCH.R +++ b/tests/testthat/test-ta_STOCH.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + stochastic(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = stochastic, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_STOCHF.R b/tests/testthat/test-ta_STOCHF.R index 6605c6abf..e0bf6cf3f 100644 --- a/tests/testthat/test-ta_STOCHF.R +++ b/tests/testthat/test-ta_STOCHF.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + fast_stochastic(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = fast_stochastic, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_STOCHRSI.R b/tests/testthat/test-ta_STOCHRSI.R index 07f616565..ff690b20f 100644 --- a/tests/testthat/test-ta_STOCHRSI.R +++ b/tests/testthat/test-ta_STOCHRSI.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + stochastic_relative_strength_index(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = stochastic_relative_strength_index, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_T3.R b/tests/testthat/test-ta_T3.R index 49a2ea849..c81eeeccf 100644 --- a/tests/testthat/test-ta_T3.R +++ b/tests/testthat/test-ta_T3.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + t3_exponential_moving_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = t3_exponential_moving_average, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_TEMA.R b/tests/testthat/test-ta_TEMA.R index 2ac581dfb..4e490eb92 100644 --- a/tests/testthat/test-ta_TEMA.R +++ b/tests/testthat/test-ta_TEMA.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + triple_exponential_moving_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = triple_exponential_moving_average, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_TRANGE.R b/tests/testthat/test-ta_TRANGE.R index de90b9169..ce74863af 100644 --- a/tests/testthat/test-ta_TRANGE.R +++ b/tests/testthat/test-ta_TRANGE.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + true_range(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = true_range, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_TRIMA.R b/tests/testthat/test-ta_TRIMA.R index e2eec73a5..5c1325b82 100644 --- a/tests/testthat/test-ta_TRIMA.R +++ b/tests/testthat/test-ta_TRIMA.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + triangular_moving_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = triangular_moving_average, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_TRIX.R b/tests/testthat/test-ta_TRIX.R index 626d53588..54383e07a 100644 --- a/tests/testthat/test-ta_TRIX.R +++ b/tests/testthat/test-ta_TRIX.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + triple_exponential_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = triple_exponential_average, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_TYPPRICE.R b/tests/testthat/test-ta_TYPPRICE.R index d6938c5aa..ff52938ef 100644 --- a/tests/testthat/test-ta_TYPPRICE.R +++ b/tests/testthat/test-ta_TYPPRICE.R @@ -143,3 +143,18 @@ testthat::test_that(desc = 'Row names are respected for ', code = { expected = rownames(indicator) ) }) + + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + typical_price(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = typical_price, x = SPY) + ) +}) diff --git a/tests/testthat/test-ta_ULTOSC.R b/tests/testthat/test-ta_ULTOSC.R index 3ddd6650c..686ced54c 100644 --- a/tests/testthat/test-ta_ULTOSC.R +++ b/tests/testthat/test-ta_ULTOSC.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + ultimate_oscillator(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = ultimate_oscillator, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_VOLUME.R b/tests/testthat/test-ta_VOLUME.R index 2d5ad295f..9cbcd4024 100644 --- a/tests/testthat/test-ta_VOLUME.R +++ b/tests/testthat/test-ta_VOLUME.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + trading_volume(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = trading_volume, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_WCLPRICE.R b/tests/testthat/test-ta_WCLPRICE.R index ab6ad34e9..80cf3aedb 100644 --- a/tests/testthat/test-ta_WCLPRICE.R +++ b/tests/testthat/test-ta_WCLPRICE.R @@ -143,3 +143,18 @@ testthat::test_that(desc = 'Row names are respected for ', code = { expected = rownames(indicator) ) }) + + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + weighted_close_price(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = weighted_close_price, x = SPY) + ) +}) diff --git a/tests/testthat/test-ta_WILLR.R b/tests/testthat/test-ta_WILLR.R index a7e15e63b..1c87c880c 100644 --- a/tests/testthat/test-ta_WILLR.R +++ b/tests/testthat/test-ta_WILLR.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + williams_oscillator(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = williams_oscillator, x = SPY) + ) +}) + + ## -method checks for ## and ## diff --git a/tests/testthat/test-ta_WMA.R b/tests/testthat/test-ta_WMA.R index 22d69882b..c28c67dee 100644 --- a/tests/testthat/test-ta_WMA.R +++ b/tests/testthat/test-ta_WMA.R @@ -145,6 +145,21 @@ testthat::test_that(desc = 'Row names are respected for ', code = { }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + weighted_moving_average(SPY), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = weighted_moving_average, x = SPY) + ) +}) + + ## -method checks for ## and ## From 6ae09e3d03c50e52ab008d3cf344c3dffaa249df Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sat, 20 Jun 2026 22:04:43 +0200 Subject: [PATCH 06/12] :books: Added entries for pkgdown and family tags --- R/lookback.R | 13 +++++++++++-- _pkgdown.yml | 5 +++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/R/lookback.R b/R/lookback.R index 749a8d53a..4e0375073 100644 --- a/R/lookback.R +++ b/R/lookback.R @@ -1,3 +1,6 @@ +#' @export +#' @family Utility +#' #' Calculate lookback period #' #' @description @@ -18,10 +21,16 @@ #' @param FUN A [call] or [function]. #' @param ... Additional parameters passed into the indicator function. See examples for more details. #' +#' @concept finance +#' @concept technical analysis +#' @concept trading +#' @concept algorithmic trading +#' +#' +#' @author Serkan Korkmaz +#' #' @returns #' An [integer] of [length] 1. -#' -#' @export lookback <- function( FUN, ... diff --git a/_pkgdown.yml b/_pkgdown.yml index b2ac7948b..9725b704f 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -76,6 +76,11 @@ reference: Transform raw OHLC prices into derived series. Average Price, Median Price, Typical Price, and Weighted Close Price. - contents: has_concept('Price Transform') +- title: Utility Functions + desc: > + Utility functions used for downstream packages and wrappers that + improves and simplifies the control-flow. +- contents: has_concept('Utility') - title: Financial Data desc: > Built-in OHLCV datasets for examples, testing, and exploration. From ba408f4da8adcac9e01ef6aa759922e124fe0de5 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sat, 20 Jun 2026 22:30:27 +0200 Subject: [PATCH 07/12] :books: Added NEWS-entry --- NEWS.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/NEWS.md b/NEWS.md index 3ef42aab3..f5cca55cb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,22 @@ +# version 0.9-3 + +## improvements + +* A new function for pre-calculating the lookback-period has been implemented. It can be used as follows: + +```R +talib::lookback( + FUN = talib::SMA, + n = 10, + x = talib::BTC +) +``` + +The function returns the minimum required lookback for calculating the indicator. +Its use-case is customized control-flows for downstream wrappers and/or packages that declares dependency on {talib}. + +## bug-fixes + # version 0.9-2 ## improvements From a34ce5a661edd249b8e0f8bfe8709e417f73766d Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sat, 20 Jun 2026 23:16:16 +0200 Subject: [PATCH 08/12] :hammer: Lookback function for ta_VOLUME.c * The function returns the max(MA1, MA2, ..., MAk) when passed - otherwise zero. * The ta_VOLUME.c has gotten some love and refactoring but the underlying logic is the same. --- src/api.h | 1 + src/init.c | 1 + src/ta_VOLUME.c | 118 +++++++++++++++++++++++++++++++----------------- 3 files changed, 78 insertions(+), 42 deletions(-) diff --git a/src/api.h b/src/api.h index 60b94db16..b88475603 100644 --- a/src/api.h +++ b/src/api.h @@ -253,6 +253,7 @@ SEXP impl_ta_ULTOSC_lookback(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTi SEXP impl_ta_ULTOSC(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP optInTimePeriod1, SEXP optInTimePeriod2, SEXP optInTimePeriod3, SEXP na_bridge); SEXP impl_ta_VAR_lookback(SEXP inReal, SEXP optInTimePeriod, SEXP optInNbDev); SEXP impl_ta_VAR(SEXP inReal, SEXP optInTimePeriod, SEXP optInNbDev, SEXP na_bridge); +SEXP impl_ta_VOLUME_lookback(SEXP inReal, SEXP maSpec); SEXP impl_ta_VOLUME(SEXP inReal, SEXP maSpec, SEXP na_rm); SEXP impl_ta_WCLPRICE_lookback(SEXP inHigh, SEXP inLow, SEXP inClose); SEXP impl_ta_WCLPRICE(SEXP inHigh, SEXP inLow, SEXP inClose, SEXP na_bridge); diff --git a/src/init.c b/src/init.c index 03c9a99dd..cc2fe0911 100644 --- a/src/init.c +++ b/src/init.c @@ -259,6 +259,7 @@ static const R_CallMethodDef CallEntries[] = { CALLDEF(impl_ta_ULTOSC, 7), CALLDEF(impl_ta_VAR_lookback, 3), CALLDEF(impl_ta_VAR, 4), + CALLDEF(impl_ta_VOLUME_lookback, 2), CALLDEF(impl_ta_VOLUME, 3), CALLDEF(impl_ta_WCLPRICE_lookback, 3), CALLDEF(impl_ta_WCLPRICE, 4), diff --git a/src/ta_VOLUME.c b/src/ta_VOLUME.c index 2a631aa06..21591773a 100644 --- a/src/ta_VOLUME.c +++ b/src/ta_VOLUME.c @@ -1,14 +1,20 @@ // ta_VOLUME.c // // Parameters -// double inReal -// list maSpec (each element is integer(2): c(period, maType)) +// double inReal +// list maSpec (each element is integer(2): c(period, maType)) +// logical na_rm // // Returns // matrix (n x (1 + length(maSpec))) with columns: // "VOLUME", "" e.g. "SMA7" // +// The "lookback" attribute is the maximum lookback across all maSpec +// entries, and 0 when no maSpec is supplied. The "VOLUME" column itself +// always has a lookback of 0. +// #include "MAType.h" +#include "attributes.h" #include "container.h" #include "lib.h" #include "na.h" @@ -20,6 +26,37 @@ #include #include +// the lookback function is exported as a standalone function for downstream +// wrappers. 'inReal' is unused but kept for call-signature parity with +// impl_ta_VOLUME +// clang-format off +SEXP impl_ta_VOLUME_lookback( + SEXP inReal, + SEXP maSpec +) +// clang-format on +{ + (void)inReal; + + const int n_ma = isNull(maSpec) ? 0 : LENGTH(maSpec); + + // maximum lookback across all maSpec entries (stays 0 when none supplied) + int lookback = 0; + for (int j = 0; j < n_ma; ++j) { + // each specification is integer(2): c(period, maType) + const int *spec = INTEGER(VECTOR_ELT(maSpec, j)); + const int ma_lookback = TA_MA_Lookback(spec[0], (TA_MAType)spec[1]); + if (ma_lookback > lookback) { + lookback = ma_lookback; + } + } + + SEXP output = PROTECT(Rf_ScalarInteger(lookback)); + + UNPROTECT(1); + return output; +} + // clang-format off SEXP impl_ta_VOLUME( SEXP inReal, @@ -45,55 +82,55 @@ SEXP impl_ta_VOLUME( const double *na_arrays[] = {x}; n = build_na_mask(na_mask, n, 1, na_arrays); if (n < n_original) { - double *compact_0 = (double *)R_alloc(n, sizeof(double)); - compact_array(compact_0, x, na_mask, n_original); - x = compact_0; + compact_arrays(na_arrays, 1, na_mask, n_original, n); + x = na_arrays[0]; } else { na_mask = NULL; } } - // determine maSpec input + // one column for 'VOLUME' plus one per moving average const int n_ma = isNull(maSpec) ? 0 : LENGTH(maSpec); const int n_cols = 1 + n_ma; - // output + // the output container is either an INTSXP or REALSXP and returns a + // matrix of on a lookback mismatch - the 'VOLUME' column is always + // valid, so the container lookback is 0 + // see container.h for more details SEXP output; double *output_ptr; - - // the output container is either a INTSXP or - // REALSXP depending on the type and will - // return a matrix with if there is a mismatch - // between lookback and n - // - // see container.h for more details output_container(n, 0, n_cols, &output, &output_ptr, &protection_count); + + // first column is the (NA-compacted) volume itself memcpy(output_ptr, x, (size_t)n * sizeof(double)); - // set initial column name + // column names: "VOLUME" followed by "" const char **colname = (const char **)R_alloc((size_t)n_cols, sizeof(*colname)); colname[0] = "VOLUME"; - // iterate over maSpec - for (int j = 0; j < n_ma; ++j) { - int start_idx = 0; - int end_idx = 0; + // maximum lookback across all maSpec entries (stays 0 when none supplied) + int lookback = 0; - // extract maSpec - // - // specification is a downstream enum - // period is passed in the downstream enum - SEXP specification = VECTOR_ELT(maSpec, j); - const int *specification_ptr = INTEGER(specification); + for (int j = 0; j < n_ma; ++j) { + // each specification is integer(2): c(period, maType) + const int *spec = INTEGER(VECTOR_ELT(maSpec, j)); + const int period = spec[0]; + const TA_MAType ma_type = (TA_MAType)spec[1]; + + // track the largest lookback seen so far + const int ma_lookback = TA_MA_Lookback(period, ma_type); + if (ma_lookback > lookback) { + lookback = ma_lookback; + } - const int period = specification_ptr[0]; - const TA_MAType ma_type = (TA_MAType)specification_ptr[1]; + // moving average is written into column (j + 1) + double *restrict ma = output_ptr + (size_t)(j + 1) * (size_t)n; - double *restrict offset_real = output_ptr + (size_t)(j + 1) * (size_t)n; + int start_idx = 0; + int end_idx = 0; // clang-format off - // calculate moving averages TA_RetCode return_value = TA_MA( 0, n - 1, @@ -102,27 +139,24 @@ SEXP impl_ta_VOLUME( ma_type, &start_idx, &end_idx, - offset_real + ma ); - - // validate output - check_output(return_value, protection_count); // clang-format on + check_output(return_value, protection_count); - // shift the array so it has the same number - // of rows as 'n' - shifted values is replaced - // with + // pad the leading 'start_idx' rows with so the column has 'n' rows // see shift.h for more details - shift_array(offset_real, n, start_idx); + shift_array(ma, n, start_idx); - char *character_buffer = (char *)R_alloc(32, sizeof(char)); - snprintf(character_buffer, 32, "%s%d", _MAType_(ma_type), period); - colname[j + 1] = character_buffer; + char *buffer = (char *)R_alloc(32, sizeof(char)); + snprintf(buffer, 32, "%s%d", _MAType_(ma_type), period); + colname[j + 1] = buffer; } - // set the remaining column names - // see names.h for more details + // set the column names and the (maximum) lookback attribute + // see names.h and attributes.h for more details column_names(output, n_cols, colname); + set_attribute(output, lookback, &protection_count); // re-expand output if NAs were stripped // see na.h for more details From 19539b4e699b29188044a8ab267f4edd56a30e47 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sun, 21 Jun 2026 00:35:47 +0200 Subject: [PATCH 09/12] :hammer: Changed 1D return values and test conditions * as.double() strips all attributes which means that the lookback attribute gets lost in the meatgrinder - an alternative option is to set set the dim(x) <- NULL (which should be a safe alternative) * is.vector() only returns true if the input value if the only attribute is names; this implies (I guess, not tested) that all data containers would return TRUE in some form or the other. A separate test condition is to check whether the output has no dim()-value. --- R/ta_APO.R | 2 +- R/ta_BBANDS.R | 2 +- R/ta_BETA.R | 14 +++++++++++-- R/ta_CMO.R | 2 +- R/ta_CORREL.R | 14 +++++++++++-- R/ta_DEMA.R | 2 +- R/ta_EMA.R | 2 +- R/ta_HT_DCPERIOD.R | 2 +- R/ta_HT_DCPHASE.R | 2 +- R/ta_HT_PHASOR.R | 2 +- R/ta_HT_SINE.R | 2 +- R/ta_HT_TRENDLINE.R | 2 +- R/ta_HT_TRENDMODE.R | 2 +- R/ta_KAMA.R | 2 +- R/ta_MACD.R | 2 +- R/ta_MACDEXT.R | 2 +- R/ta_MACDFIX.R | 2 +- R/ta_MAMA.R | 2 +- R/ta_MAX.R | 14 +++++++++++-- R/ta_MIN.R | 14 +++++++++++-- R/ta_MOM.R | 2 +- R/ta_PPO.R | 2 +- R/ta_ROC.R | 2 +- R/ta_ROCR.R | 2 +- R/ta_RSI.R | 2 +- R/ta_SMA.R | 2 +- R/ta_STDDEV.R | 14 +++++++++++-- R/ta_STOCHRSI.R | 2 +- R/ta_SUM.R | 14 +++++++++++-- R/ta_T3.R | 2 +- R/ta_TEMA.R | 2 +- R/ta_TRIMA.R | 2 +- R/ta_TRIX.R | 2 +- R/ta_VAR.R | 14 +++++++++++-- R/ta_VOLUME.R | 2 +- R/ta_WMA.R | 2 +- codegen/generate_unit-tests.sh | 20 ++++++++++++++++++- .../templates/moving_average_template.R.in | 2 +- codegen/templates/numeric_template.R.in | 2 +- codegen/templates/rolling_template.R.in | 14 +++++++++++-- tests/testthat/test-ta_BETA.R | 16 ++++++++++++++- tests/testthat/test-ta_CORREL.R | 20 ++++++++++++++++++- tests/testthat/test-ta_MAX.R | 16 ++++++++++++++- tests/testthat/test-ta_MIN.R | 16 ++++++++++++++- tests/testthat/test-ta_STDDEV.R | 16 ++++++++++++++- tests/testthat/test-ta_SUM.R | 16 ++++++++++++++- tests/testthat/test-ta_VAR.R | 16 ++++++++++++++- 47 files changed, 255 insertions(+), 55 deletions(-) diff --git a/R/ta_APO.R b/R/ta_APO.R index 918943793..ea308b0ee 100644 --- a/R/ta_APO.R +++ b/R/ta_APO.R @@ -207,7 +207,7 @@ absolute_price_oscillator.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_BBANDS.R b/R/ta_BBANDS.R index d952e445b..c49b9fca5 100644 --- a/R/ta_BBANDS.R +++ b/R/ta_BBANDS.R @@ -219,7 +219,7 @@ bollinger_bands.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_BETA.R b/R/ta_BETA.R index 26ded777b..ee3a6c935 100644 --- a/R/ta_BETA.R +++ b/R/ta_BETA.R @@ -49,8 +49,13 @@ rolling_beta.default <- function( as.logical(na.bridge) ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL @@ -72,8 +77,13 @@ rolling_beta.numeric <- function( na.bridge = na.bridge ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL diff --git a/R/ta_CMO.R b/R/ta_CMO.R index 209d55e0d..56575b837 100644 --- a/R/ta_CMO.R +++ b/R/ta_CMO.R @@ -182,7 +182,7 @@ chande_momentum_oscillator.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_CORREL.R b/R/ta_CORREL.R index 1da8fe771..a4b15df43 100644 --- a/R/ta_CORREL.R +++ b/R/ta_CORREL.R @@ -49,8 +49,13 @@ rolling_correlation.default <- function( as.logical(na.bridge) ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL @@ -72,8 +77,13 @@ rolling_correlation.numeric <- function( na.bridge = na.bridge ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL diff --git a/R/ta_DEMA.R b/R/ta_DEMA.R index c0a1f9777..a52d0f60d 100644 --- a/R/ta_DEMA.R +++ b/R/ta_DEMA.R @@ -164,7 +164,7 @@ double_exponential_moving_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_EMA.R b/R/ta_EMA.R index 19c4be723..c9c285f27 100644 --- a/R/ta_EMA.R +++ b/R/ta_EMA.R @@ -164,7 +164,7 @@ exponential_moving_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_HT_DCPERIOD.R b/R/ta_HT_DCPERIOD.R index 77e712105..4df7ed2e4 100644 --- a/R/ta_HT_DCPERIOD.R +++ b/R/ta_HT_DCPERIOD.R @@ -171,7 +171,7 @@ dominant_cycle_period.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_HT_DCPHASE.R b/R/ta_HT_DCPHASE.R index 75db0a3f4..2b7edbc18 100644 --- a/R/ta_HT_DCPHASE.R +++ b/R/ta_HT_DCPHASE.R @@ -171,7 +171,7 @@ dominant_cycle_phase.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_HT_PHASOR.R b/R/ta_HT_PHASOR.R index 9f0d96434..88acf387a 100644 --- a/R/ta_HT_PHASOR.R +++ b/R/ta_HT_PHASOR.R @@ -171,7 +171,7 @@ phasor_components.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_HT_SINE.R b/R/ta_HT_SINE.R index ad304ce74..c0f4df3d0 100644 --- a/R/ta_HT_SINE.R +++ b/R/ta_HT_SINE.R @@ -171,7 +171,7 @@ sine_wave.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_HT_TRENDLINE.R b/R/ta_HT_TRENDLINE.R index 076497767..ffe15f917 100644 --- a/R/ta_HT_TRENDLINE.R +++ b/R/ta_HT_TRENDLINE.R @@ -171,7 +171,7 @@ trendline.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_HT_TRENDMODE.R b/R/ta_HT_TRENDMODE.R index 34e244dc4..3369c1745 100644 --- a/R/ta_HT_TRENDMODE.R +++ b/R/ta_HT_TRENDMODE.R @@ -171,7 +171,7 @@ trend_cycle_mode.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_KAMA.R b/R/ta_KAMA.R index 7d3f02e82..89af3fc3b 100644 --- a/R/ta_KAMA.R +++ b/R/ta_KAMA.R @@ -164,7 +164,7 @@ kaufman_adaptive_moving_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_MACD.R b/R/ta_MACD.R index eb2822581..d580e6488 100644 --- a/R/ta_MACD.R +++ b/R/ta_MACD.R @@ -207,7 +207,7 @@ moving_average_convergence_divergence.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_MACDEXT.R b/R/ta_MACDEXT.R index 06dc42df5..6c5fa34f6 100644 --- a/R/ta_MACDEXT.R +++ b/R/ta_MACDEXT.R @@ -216,7 +216,7 @@ extended_moving_average_convergence_divergence.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_MACDFIX.R b/R/ta_MACDFIX.R index bc3898a31..2585baeee 100644 --- a/R/ta_MACDFIX.R +++ b/R/ta_MACDFIX.R @@ -183,7 +183,7 @@ fixed_moving_average_convergence_divergence.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_MAMA.R b/R/ta_MAMA.R index 79732d898..f13d758fa 100644 --- a/R/ta_MAMA.R +++ b/R/ta_MAMA.R @@ -183,7 +183,7 @@ mesa_adaptive_moving_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_MAX.R b/R/ta_MAX.R index 3954acbd8..f8f6d4097 100644 --- a/R/ta_MAX.R +++ b/R/ta_MAX.R @@ -46,8 +46,13 @@ rolling_max.default <- function( as.logical(na.bridge) ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL @@ -67,8 +72,13 @@ rolling_max.numeric <- function( na.bridge = na.bridge ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL diff --git a/R/ta_MIN.R b/R/ta_MIN.R index 8d4481e23..50e8693b8 100644 --- a/R/ta_MIN.R +++ b/R/ta_MIN.R @@ -46,8 +46,13 @@ rolling_min.default <- function( as.logical(na.bridge) ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL @@ -67,8 +72,13 @@ rolling_min.numeric <- function( na.bridge = na.bridge ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL diff --git a/R/ta_MOM.R b/R/ta_MOM.R index 24cbaf9bd..71a72cb78 100644 --- a/R/ta_MOM.R +++ b/R/ta_MOM.R @@ -182,7 +182,7 @@ momentum.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_PPO.R b/R/ta_PPO.R index e5efdd757..ef11b663d 100644 --- a/R/ta_PPO.R +++ b/R/ta_PPO.R @@ -207,7 +207,7 @@ percentage_price_oscillator.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_ROC.R b/R/ta_ROC.R index 532d545c8..c050d5464 100644 --- a/R/ta_ROC.R +++ b/R/ta_ROC.R @@ -182,7 +182,7 @@ rate_of_change.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_ROCR.R b/R/ta_ROCR.R index fb2983556..476f46f53 100644 --- a/R/ta_ROCR.R +++ b/R/ta_ROCR.R @@ -182,7 +182,7 @@ ratio_of_change.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_RSI.R b/R/ta_RSI.R index 20e34d81c..b1bec585c 100644 --- a/R/ta_RSI.R +++ b/R/ta_RSI.R @@ -182,7 +182,7 @@ relative_strength_index.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_SMA.R b/R/ta_SMA.R index 513f8f4e9..ce9400d98 100644 --- a/R/ta_SMA.R +++ b/R/ta_SMA.R @@ -164,7 +164,7 @@ simple_moving_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_STDDEV.R b/R/ta_STDDEV.R index 65dbf11d8..21ae6b9af 100644 --- a/R/ta_STDDEV.R +++ b/R/ta_STDDEV.R @@ -50,8 +50,13 @@ rolling_standard_deviation.default <- function( as.logical(na.bridge) ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL @@ -73,8 +78,13 @@ rolling_standard_deviation.numeric <- function( na.bridge = na.bridge ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL diff --git a/R/ta_STOCHRSI.R b/R/ta_STOCHRSI.R index 6b25003a2..04c9fe201 100644 --- a/R/ta_STOCHRSI.R +++ b/R/ta_STOCHRSI.R @@ -209,7 +209,7 @@ stochastic_relative_strength_index.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_SUM.R b/R/ta_SUM.R index ce35bf8cb..f8fc6020f 100644 --- a/R/ta_SUM.R +++ b/R/ta_SUM.R @@ -46,8 +46,13 @@ rolling_sum.default <- function( as.logical(na.bridge) ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL @@ -67,8 +72,13 @@ rolling_sum.numeric <- function( na.bridge = na.bridge ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL diff --git a/R/ta_T3.R b/R/ta_T3.R index 0ca21e85b..5d3d00bf6 100644 --- a/R/ta_T3.R +++ b/R/ta_T3.R @@ -174,7 +174,7 @@ t3_exponential_moving_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_TEMA.R b/R/ta_TEMA.R index b71a3bc8d..ec7832ffe 100644 --- a/R/ta_TEMA.R +++ b/R/ta_TEMA.R @@ -164,7 +164,7 @@ triple_exponential_moving_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_TRIMA.R b/R/ta_TRIMA.R index 5fb5a265b..1884c1a47 100644 --- a/R/ta_TRIMA.R +++ b/R/ta_TRIMA.R @@ -164,7 +164,7 @@ triangular_moving_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_TRIX.R b/R/ta_TRIX.R index 9075af450..c019ef9ac 100644 --- a/R/ta_TRIX.R +++ b/R/ta_TRIX.R @@ -182,7 +182,7 @@ triple_exponential_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_VAR.R b/R/ta_VAR.R index f96cdfc48..4b6e9a010 100644 --- a/R/ta_VAR.R +++ b/R/ta_VAR.R @@ -50,8 +50,13 @@ rolling_variance.default <- function( as.logical(na.bridge) ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL @@ -73,8 +78,13 @@ rolling_variance.numeric <- function( na.bridge = na.bridge ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL diff --git a/R/ta_VOLUME.R b/R/ta_VOLUME.R index 814a59537..e2319d8b1 100644 --- a/R/ta_VOLUME.R +++ b/R/ta_VOLUME.R @@ -197,7 +197,7 @@ trading_volume.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/R/ta_WMA.R b/R/ta_WMA.R index b77865f9d..917817d28 100644 --- a/R/ta_WMA.R +++ b/R/ta_WMA.R @@ -164,7 +164,7 @@ weighted_moving_average.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/codegen/generate_unit-tests.sh b/codegen/generate_unit-tests.sh index 9e67e1b24..df2c28033 100755 --- a/codegen/generate_unit-tests.sh +++ b/codegen/generate_unit-tests.sh @@ -70,11 +70,29 @@ testthat::expect_true( ) testthat::expect_true( - is.vector(output) + is.null(dim(output)) ) }) +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + +output <- attr( + ${FUN}(x = SPY[,1]${ADDITIONAL}), + "lookback" +) + +testthat::expect_equal( + object = output, + expected = lookback(FUN = ${FUN}, x = SPY[,1]${ADDITIONAL}) + ) + +} +) + + EOF exit 0; diff --git a/codegen/templates/moving_average_template.R.in b/codegen/templates/moving_average_template.R.in index 13f375dd9..10ce0dbe6 100644 --- a/codegen/templates/moving_average_template.R.in +++ b/codegen/templates/moving_average_template.R.in @@ -156,7 +156,7 @@ $FUN.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/codegen/templates/numeric_template.R.in b/codegen/templates/numeric_template.R.in index 32d89dbf1..755b20b27 100644 --- a/codegen/templates/numeric_template.R.in +++ b/codegen/templates/numeric_template.R.in @@ -27,7 +27,7 @@ ${FUN}.numeric <- function( ) if (dim(x)[2] == 1L) { - x <- as.double(x) + dim(x) <- NULL } x diff --git a/codegen/templates/rolling_template.R.in b/codegen/templates/rolling_template.R.in index 5418c9829..70683b2f6 100644 --- a/codegen/templates/rolling_template.R.in +++ b/codegen/templates/rolling_template.R.in @@ -45,8 +45,13 @@ ${FUN}.default <- function( as.logical(na.bridge) ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL @@ -67,8 +72,13 @@ ${FUN}.numeric <- function( ) + ## strip dimensions + ## while preserving + ## attributes + dim(x) <- NULL + ## return indicator - as.double(x) + x } #' @usage NULL diff --git a/tests/testthat/test-ta_BETA.R b/tests/testthat/test-ta_BETA.R index 282d80d75..21cf6b532 100644 --- a/tests/testthat/test-ta_BETA.R +++ b/tests/testthat/test-ta_BETA.R @@ -43,6 +43,20 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - is.vector(output) + is.null(dim(output)) + ) +}) + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rolling_beta(x = SPY[, 1], y = SPY[, 2]), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = rolling_beta, x = SPY[, 1], y = SPY[, 2]) ) }) diff --git a/tests/testthat/test-ta_CORREL.R b/tests/testthat/test-ta_CORREL.R index c68b4c942..b4e8d61b1 100644 --- a/tests/testthat/test-ta_CORREL.R +++ b/tests/testthat/test-ta_CORREL.R @@ -43,6 +43,24 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - is.vector(output) + is.null(dim(output)) + ) +}) + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rolling_correlation(x = SPY[, 1], y = SPY[, 2]), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback( + FUN = rolling_correlation, + x = SPY[, 1], + y = SPY[, 2] + ) ) }) diff --git a/tests/testthat/test-ta_MAX.R b/tests/testthat/test-ta_MAX.R index 73163c431..73fccaf5a 100644 --- a/tests/testthat/test-ta_MAX.R +++ b/tests/testthat/test-ta_MAX.R @@ -40,6 +40,20 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - is.vector(output) + is.null(dim(output)) + ) +}) + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rolling_max(x = SPY[, 1]), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = rolling_max, x = SPY[, 1]) ) }) diff --git a/tests/testthat/test-ta_MIN.R b/tests/testthat/test-ta_MIN.R index 2a412137f..c44c6be42 100644 --- a/tests/testthat/test-ta_MIN.R +++ b/tests/testthat/test-ta_MIN.R @@ -40,6 +40,20 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - is.vector(output) + is.null(dim(output)) + ) +}) + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rolling_min(x = SPY[, 1]), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = rolling_min, x = SPY[, 1]) ) }) diff --git a/tests/testthat/test-ta_STDDEV.R b/tests/testthat/test-ta_STDDEV.R index cc0487c5f..41b2dcabb 100644 --- a/tests/testthat/test-ta_STDDEV.R +++ b/tests/testthat/test-ta_STDDEV.R @@ -40,6 +40,20 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - is.vector(output) + is.null(dim(output)) + ) +}) + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rolling_standard_deviation(x = SPY[, 1]), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = rolling_standard_deviation, x = SPY[, 1]) ) }) diff --git a/tests/testthat/test-ta_SUM.R b/tests/testthat/test-ta_SUM.R index 70a64fbbf..4699c4ff5 100644 --- a/tests/testthat/test-ta_SUM.R +++ b/tests/testthat/test-ta_SUM.R @@ -40,6 +40,20 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - is.vector(output) + is.null(dim(output)) + ) +}) + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rolling_sum(x = SPY[, 1]), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = rolling_sum, x = SPY[, 1]) ) }) diff --git a/tests/testthat/test-ta_VAR.R b/tests/testthat/test-ta_VAR.R index 1fe3a18cf..be8014662 100644 --- a/tests/testthat/test-ta_VAR.R +++ b/tests/testthat/test-ta_VAR.R @@ -40,6 +40,20 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - is.vector(output) + is.null(dim(output)) + ) +}) + +## test the output's attribute "lookback" matches +## the lookback() +testthat::test_that(desc = 'Lookback equivalence', code = { + output <- attr( + rolling_variance(x = SPY[, 1]), + "lookback" + ) + + testthat::expect_equal( + object = output, + expected = lookback(FUN = rolling_variance, x = SPY[, 1]) ) }) From 82c5f881bf47b1b87f1cc777bbe69a5e615e95e0 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sun, 21 Jun 2026 08:37:31 +0200 Subject: [PATCH 10/12] :hammer: Added lookback documentation and safeguards * TA-Lib returns -1 for invalid indicator and data pairs; if the lookback is invalid R will return it as . This behaviour has been documented internally and in the roxygen documentation. * lookback() will return max(lookback, 1) to avoid insensible return values like 0 (this is the case for volume without moving averages). --- R/lookback.R | 71 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 7 deletions(-) diff --git a/R/lookback.R b/R/lookback.R index 4e0375073..fabc081bb 100644 --- a/R/lookback.R +++ b/R/lookback.R @@ -30,7 +30,8 @@ #' @author Serkan Korkmaz #' #' @returns -#' An [integer] of [length] 1. +#' The minimum lookback required to calculate the indicator. +#' If the indicator specification and input data are invalid the function returns [NA], otherwise it returns an [integer] of [length] 1. lookback <- function( FUN, ... @@ -48,22 +49,78 @@ lookback <- function( FUN ) + ## important distinction with substitute: + ## pkg::foo() -> call + ## foo -> function if (is.call(FUN)) { FUN <- FUN[[length(FUN)]] } - fun_name <- paste0(as.character(FUN), "_lookback") + ## all exported indicators has + ## a _lookback post-fix which handles + ## the lookback calculation + FUN <- paste0( + as.character(FUN), + "_lookback" + ) + + if (!exists(FUN, envir = ns, mode = "function", inherits = FALSE)) { + ## strip FUN to get + ## the basename of the passed + ## function + FUN <- gsub( + pattern = "_lookback", + replacement = "", + x = FUN + ) - if (!exists(fun_name, envir = ns, mode = "function", inherits = FALSE)) { + ## stop the function with + ## a hard error. + ## TODO: Consider the case for + ## custom indicators, wrapper functions + ## or exported functions that does not have + ## a lookback-calculation. stop( - "No internal function named `", - fun_name, + "No indicator named `", + FUN, "` was found.", call. = FALSE ) } - FUN <- get(fun_name, envir = ns, mode = "function", inherits = FALSE) + FUN <- get( + FUN, + envir = ns, + mode = "function", + inherits = FALSE + ) - do.call(FUN, args = list(...)) + ## upstream returns -1 + ## for invalid input data + ## relative to the indicator; + ## SMA, for example, requires at + ## minimum two data points to calculate + ## given n = 2 - and three, if n = 3. + ## + ## if the indicator and input are not + ## satisfying this constraint upstream + ## returns -1, ie. not applicable. + minimum_lookback <- do.call( + FUN, + args = list(...) + ) + + if (minimum_lookback == -1) { + return(NA) + } + + ## volume, for example, returns + ## a lookback of 0 if calculated without + ## moving averages - wrap the lookback + ## in max() as a safety precaution + max( + minimum_lookback, + 1, + na.rm = TRUE + ) } From ee3d0ba1583ccbbccc18b3e699802d43ec5c9669 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sun, 21 Jun 2026 09:15:17 +0200 Subject: [PATCH 11/12] :hammer: Normalized lookback-period * In 82c5f881bf47b1b87f1cc777bbe69a5e615e95e0 the lookback values were set to minimum 1 for a valid indicator and data pair. This commit reflects this change such that the attributes behaves in a similar way - which also has to be reflected in the parity-tests so the comparision is apples-to-apples. --- codegen/parity/test_parity_template.R | 2 +- src/attributes.c | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/codegen/parity/test_parity_template.R b/codegen/parity/test_parity_template.R index c275a39d8..f7df970ea 100644 --- a/codegen/parity/test_parity_template.R +++ b/codegen/parity/test_parity_template.R @@ -210,7 +210,7 @@ call_r_wrapper <- function(name, btc, snap) { ) { expect_equal( as.integer(lb), - as.integer(snap$lookback), + max(as.integer(snap$lookback), 1), info = paste0(name, ": lookback attribute") ) } diff --git a/src/attributes.c b/src/attributes.c index 61757ad08..affe5bbb4 100644 --- a/src/attributes.c +++ b/src/attributes.c @@ -27,12 +27,21 @@ static inline SEXP ta_lookback(void) { void set_attribute( SEXP output_object, int lookback, - int *protection_count) { - // clang-format on - + int *protection_count +) +// clang-format on +{ + // upstream returns -1 if the indicator and data pairs + // are invalid - -1 is handled on the R side but + // attributes needs to be handled here - some functions + // returns (weighted closing price, for one) returns lookback + // of zero; this has to be normalized to 1 (can't calculate values on nothing) + int normalized_lookback = + lookback < 0 ? lookback : (lookback < 1 ? 1 : lookback); SEXP symbolic_value = ta_lookback(); - SEXP value = PROTECT(Rf_ScalarInteger(lookback)); + SEXP value = PROTECT(Rf_ScalarInteger(normalized_lookback)); + if (protection_count) { (*protection_count)++; } From ede73f2b5433bbfd6e890883e878bcdfa7fc5507 Mon Sep 17 00:00:00 2001 From: serkor1 <77464572+serkor1@users.noreply.github.com> Date: Sun, 21 Jun 2026 09:24:53 +0200 Subject: [PATCH 12/12] :hammer: Test for integer AND doubles * When using `dim() <- NULL`, the storage.mode() is preserved and therefore indicators that returns one-dimensional indicators as vectors fails the as.double() test; it should be safe to test for is.double and is.integer at the same time - if there is any coercions these will be caught by the parity-tests either way. --- codegen/generate_unit-tests.sh | 4 ++-- tests/testthat/test-ta_APO.R | 2 +- tests/testthat/test-ta_BBANDS.R | 2 +- tests/testthat/test-ta_BETA.R | 2 +- tests/testthat/test-ta_CMO.R | 2 +- tests/testthat/test-ta_CORREL.R | 2 +- tests/testthat/test-ta_DEMA.R | 2 +- tests/testthat/test-ta_EMA.R | 2 +- tests/testthat/test-ta_HT_DCPERIOD.R | 2 +- tests/testthat/test-ta_HT_DCPHASE.R | 2 +- tests/testthat/test-ta_HT_PHASOR.R | 2 +- tests/testthat/test-ta_HT_SINE.R | 2 +- tests/testthat/test-ta_HT_TRENDLINE.R | 2 +- tests/testthat/test-ta_HT_TRENDMODE.R | 2 +- tests/testthat/test-ta_KAMA.R | 2 +- tests/testthat/test-ta_MACD.R | 2 +- tests/testthat/test-ta_MACDEXT.R | 2 +- tests/testthat/test-ta_MACDFIX.R | 2 +- tests/testthat/test-ta_MAMA.R | 2 +- tests/testthat/test-ta_MAX.R | 2 +- tests/testthat/test-ta_MIN.R | 2 +- tests/testthat/test-ta_MOM.R | 2 +- tests/testthat/test-ta_PPO.R | 2 +- tests/testthat/test-ta_ROC.R | 2 +- tests/testthat/test-ta_ROCR.R | 2 +- tests/testthat/test-ta_RSI.R | 2 +- tests/testthat/test-ta_SMA.R | 2 +- tests/testthat/test-ta_STDDEV.R | 2 +- tests/testthat/test-ta_STOCHRSI.R | 2 +- tests/testthat/test-ta_SUM.R | 2 +- tests/testthat/test-ta_T3.R | 2 +- tests/testthat/test-ta_TEMA.R | 2 +- tests/testthat/test-ta_TRIMA.R | 2 +- tests/testthat/test-ta_TRIX.R | 2 +- tests/testthat/test-ta_VAR.R | 2 +- tests/testthat/test-ta_WMA.R | 2 +- 36 files changed, 37 insertions(+), 37 deletions(-) diff --git a/codegen/generate_unit-tests.sh b/codegen/generate_unit-tests.sh index df2c28033..9f907b6b2 100755 --- a/codegen/generate_unit-tests.sh +++ b/codegen/generate_unit-tests.sh @@ -66,7 +66,7 @@ output <- ${FUN}( ) testthat::expect_true( - typeof(output) == "double" + typeof(output) == "double" || typeof(output) == "integer" ) testthat::expect_true( @@ -384,7 +384,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_APO.R b/tests/testthat/test-ta_APO.R index 87fe1148a..4c278a1d1 100644 --- a/tests/testthat/test-ta_APO.R +++ b/tests/testthat/test-ta_APO.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_BBANDS.R b/tests/testthat/test-ta_BBANDS.R index fe9113bce..97042ad25 100644 --- a/tests/testthat/test-ta_BBANDS.R +++ b/tests/testthat/test-ta_BBANDS.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_BETA.R b/tests/testthat/test-ta_BETA.R index 21cf6b532..dc0ae3a3d 100644 --- a/tests/testthat/test-ta_BETA.R +++ b/tests/testthat/test-ta_BETA.R @@ -39,7 +39,7 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - typeof(output) == "double" + typeof(output) == "double" || typeof(output) == "integer" ) testthat::expect_true( diff --git a/tests/testthat/test-ta_CMO.R b/tests/testthat/test-ta_CMO.R index dcb4b1891..af02063a1 100644 --- a/tests/testthat/test-ta_CMO.R +++ b/tests/testthat/test-ta_CMO.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_CORREL.R b/tests/testthat/test-ta_CORREL.R index b4e8d61b1..ba2697b70 100644 --- a/tests/testthat/test-ta_CORREL.R +++ b/tests/testthat/test-ta_CORREL.R @@ -39,7 +39,7 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - typeof(output) == "double" + typeof(output) == "double" || typeof(output) == "integer" ) testthat::expect_true( diff --git a/tests/testthat/test-ta_DEMA.R b/tests/testthat/test-ta_DEMA.R index 6ac122e48..c8948ad8b 100644 --- a/tests/testthat/test-ta_DEMA.R +++ b/tests/testthat/test-ta_DEMA.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_EMA.R b/tests/testthat/test-ta_EMA.R index 7ce7411a0..ae062cbd4 100644 --- a/tests/testthat/test-ta_EMA.R +++ b/tests/testthat/test-ta_EMA.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_HT_DCPERIOD.R b/tests/testthat/test-ta_HT_DCPERIOD.R index 79bfb9c81..019049c5d 100644 --- a/tests/testthat/test-ta_HT_DCPERIOD.R +++ b/tests/testthat/test-ta_HT_DCPERIOD.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_HT_DCPHASE.R b/tests/testthat/test-ta_HT_DCPHASE.R index 8a7338f01..119ec638e 100644 --- a/tests/testthat/test-ta_HT_DCPHASE.R +++ b/tests/testthat/test-ta_HT_DCPHASE.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_HT_PHASOR.R b/tests/testthat/test-ta_HT_PHASOR.R index 0f4a33f02..46a40970e 100644 --- a/tests/testthat/test-ta_HT_PHASOR.R +++ b/tests/testthat/test-ta_HT_PHASOR.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_HT_SINE.R b/tests/testthat/test-ta_HT_SINE.R index b3e390cc5..7ddc825a1 100644 --- a/tests/testthat/test-ta_HT_SINE.R +++ b/tests/testthat/test-ta_HT_SINE.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_HT_TRENDLINE.R b/tests/testthat/test-ta_HT_TRENDLINE.R index 50ab6c80c..6ae935009 100644 --- a/tests/testthat/test-ta_HT_TRENDLINE.R +++ b/tests/testthat/test-ta_HT_TRENDLINE.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_HT_TRENDMODE.R b/tests/testthat/test-ta_HT_TRENDMODE.R index 28cd15d77..694549617 100644 --- a/tests/testthat/test-ta_HT_TRENDMODE.R +++ b/tests/testthat/test-ta_HT_TRENDMODE.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_KAMA.R b/tests/testthat/test-ta_KAMA.R index f91c42f8b..f35f4e86e 100644 --- a/tests/testthat/test-ta_KAMA.R +++ b/tests/testthat/test-ta_KAMA.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_MACD.R b/tests/testthat/test-ta_MACD.R index 004baf06b..63353d8c7 100644 --- a/tests/testthat/test-ta_MACD.R +++ b/tests/testthat/test-ta_MACD.R @@ -261,7 +261,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_MACDEXT.R b/tests/testthat/test-ta_MACDEXT.R index b46ef0ed6..4edcfc289 100644 --- a/tests/testthat/test-ta_MACDEXT.R +++ b/tests/testthat/test-ta_MACDEXT.R @@ -270,7 +270,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_MACDFIX.R b/tests/testthat/test-ta_MACDFIX.R index e647d7ee8..027e2d979 100644 --- a/tests/testthat/test-ta_MACDFIX.R +++ b/tests/testthat/test-ta_MACDFIX.R @@ -264,7 +264,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_MAMA.R b/tests/testthat/test-ta_MAMA.R index bd9c438d0..c45b1f38e 100644 --- a/tests/testthat/test-ta_MAMA.R +++ b/tests/testthat/test-ta_MAMA.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_MAX.R b/tests/testthat/test-ta_MAX.R index 73fccaf5a..e4ef3cf38 100644 --- a/tests/testthat/test-ta_MAX.R +++ b/tests/testthat/test-ta_MAX.R @@ -36,7 +36,7 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - typeof(output) == "double" + typeof(output) == "double" || typeof(output) == "integer" ) testthat::expect_true( diff --git a/tests/testthat/test-ta_MIN.R b/tests/testthat/test-ta_MIN.R index c44c6be42..096b20dcb 100644 --- a/tests/testthat/test-ta_MIN.R +++ b/tests/testthat/test-ta_MIN.R @@ -36,7 +36,7 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - typeof(output) == "double" + typeof(output) == "double" || typeof(output) == "integer" ) testthat::expect_true( diff --git a/tests/testthat/test-ta_MOM.R b/tests/testthat/test-ta_MOM.R index 351061be4..5a1ff1760 100644 --- a/tests/testthat/test-ta_MOM.R +++ b/tests/testthat/test-ta_MOM.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_PPO.R b/tests/testthat/test-ta_PPO.R index 7604a854a..1e6f59897 100644 --- a/tests/testthat/test-ta_PPO.R +++ b/tests/testthat/test-ta_PPO.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_ROC.R b/tests/testthat/test-ta_ROC.R index be355b32f..6fbc18b1c 100644 --- a/tests/testthat/test-ta_ROC.R +++ b/tests/testthat/test-ta_ROC.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_ROCR.R b/tests/testthat/test-ta_ROCR.R index 256862794..7db88ff95 100644 --- a/tests/testthat/test-ta_ROCR.R +++ b/tests/testthat/test-ta_ROCR.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_RSI.R b/tests/testthat/test-ta_RSI.R index 9da8de1a8..42f0740d7 100644 --- a/tests/testthat/test-ta_RSI.R +++ b/tests/testthat/test-ta_RSI.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_SMA.R b/tests/testthat/test-ta_SMA.R index ac374c927..3758f8a78 100644 --- a/tests/testthat/test-ta_SMA.R +++ b/tests/testthat/test-ta_SMA.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_STDDEV.R b/tests/testthat/test-ta_STDDEV.R index 41b2dcabb..f29474932 100644 --- a/tests/testthat/test-ta_STDDEV.R +++ b/tests/testthat/test-ta_STDDEV.R @@ -36,7 +36,7 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - typeof(output) == "double" + typeof(output) == "double" || typeof(output) == "integer" ) testthat::expect_true( diff --git a/tests/testthat/test-ta_STOCHRSI.R b/tests/testthat/test-ta_STOCHRSI.R index ff690b20f..00dd50b0f 100644 --- a/tests/testthat/test-ta_STOCHRSI.R +++ b/tests/testthat/test-ta_STOCHRSI.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_SUM.R b/tests/testthat/test-ta_SUM.R index 4699c4ff5..7fc77ecf6 100644 --- a/tests/testthat/test-ta_SUM.R +++ b/tests/testthat/test-ta_SUM.R @@ -36,7 +36,7 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - typeof(output) == "double" + typeof(output) == "double" || typeof(output) == "integer" ) testthat::expect_true( diff --git a/tests/testthat/test-ta_T3.R b/tests/testthat/test-ta_T3.R index c81eeeccf..8f9fd69a5 100644 --- a/tests/testthat/test-ta_T3.R +++ b/tests/testthat/test-ta_T3.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_TEMA.R b/tests/testthat/test-ta_TEMA.R index 4e490eb92..945f44b40 100644 --- a/tests/testthat/test-ta_TEMA.R +++ b/tests/testthat/test-ta_TEMA.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_TRIMA.R b/tests/testthat/test-ta_TRIMA.R index 5c1325b82..e64d69b06 100644 --- a/tests/testthat/test-ta_TRIMA.R +++ b/tests/testthat/test-ta_TRIMA.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_TRIX.R b/tests/testthat/test-ta_TRIX.R index 54383e07a..ead620360 100644 --- a/tests/testthat/test-ta_TRIX.R +++ b/tests/testthat/test-ta_TRIX.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else { diff --git a/tests/testthat/test-ta_VAR.R b/tests/testthat/test-ta_VAR.R index be8014662..35182f887 100644 --- a/tests/testthat/test-ta_VAR.R +++ b/tests/testthat/test-ta_VAR.R @@ -36,7 +36,7 @@ testthat::test_that(desc = 'Output type', code = { ) testthat::expect_true( - typeof(output) == "double" + typeof(output) == "double" || typeof(output) == "integer" ) testthat::expect_true( diff --git a/tests/testthat/test-ta_WMA.R b/tests/testthat/test-ta_WMA.R index c28c67dee..3ec6ccb77 100644 --- a/tests/testthat/test-ta_WMA.R +++ b/tests/testthat/test-ta_WMA.R @@ -258,7 +258,7 @@ testthat::test_that(desc = ' methods', code = { target_length <- length(BTC[[1]]) if (NCOL(x) == 1L) { - testthat::expect_true(is.double(x)) + testthat::expect_true(is.double(x) || is.integer(x)) testthat::expect_false(is.matrix(x)) testthat::expect_equal(length(x), target_length) } else {