Skip to contents

ledgr_ind_ttr_outputs() is an authoring convenience for multi-column TTR functions such as BBands, MACD, ATR, aroon, and DonchianChannel. It returns a ledgr_indicator_bundle containing ordinary single-output ledgr_indicator objects. The bundle is flattened before runtime feature computation, so strategies still read scalar feature IDs. Default bundle IDs are shorter than equivalent hand-written ledgr_ind_ttr(output = ...) IDs; use naming or hand-written single-output calls when exact legacy IDs matter.

Usage

ledgr_ind_ttr_outputs(
  ttr_fn,
  input,
  ...,
  outputs = NULL,
  prefix = ledgr_ttr_id_token(ttr_fn),
  naming = NULL,
  requires_bars = NULL,
  stable_after = requires_bars
)

Arguments

ttr_fn

TTR function name, for example "BBands" or "MACD".

input

ledgr input shape. Supported values are "close", "hl", "hlc", "ohlc", and "hlcv".

...

Explicit arguments forwarded to the TTR function.

outputs

Optional character vector of backend output columns to keep. NULL keeps all discovered outputs. For MACD, ledgr also exposes a derived histogram output.

prefix

Feature-ID prefix. The default derives a normalized prefix from ttr_fn, for example "BBands" becomes bbands_. Use a character scalar such as "bb" for concise IDs, or NULL to opt into raw output names.

naming

Optional advanced rename escape hatch. Supply a named character vector whose names are backend outputs and whose values are feature IDs. naming renames selected outputs; it does not filter outputs. Use outputs = names(naming) when renaming a subset.

requires_bars

Explicit warmup length. Required for unknown TTR functions. For known functions this is inferred from explicit arguments.

stable_after

First stable row. Defaults to requires_bars.

Value

A ledgr_indicator_bundle object.

Articles

Indicators, feature IDs, and warmup: vignette("indicators", package = "ledgr") system.file("doc", "indicators.html", package = "ledgr")

Examples

if (requireNamespace("TTR", quietly = TRUE)) {
  bb <- ledgr_ind_ttr_outputs("BBands", input = "close", n = 20)
  ledgr_feature_id(bb)

  bb_short <- ledgr_ind_ttr_outputs(
    "BBands",
    input = "close",
    outputs = c("dn", "up"),
    prefix = "bb",
    n = 20
  )
  ledgr_feature_id(bb_short)
}
#> [1] "bb_dn" "bb_up"