taFactory: Technical analysis indicator factory

View source: R/TAIndicator.R

taFactoryR Documentation

Technical analysis indicator factory

Description

Constructor to instantiate object(s) of class 'TAIndicator'. It maps the indicator definition to the class properties.

Usage

taFactory(ind)

Arguments

ind

Indicator definition.

Value

An object of class 'TAIndicator'.

Examples

# Call the factory with SMA setup.
json <- '{
  "label": "SMA",
  "method": "TTR::SMA",
  "columns": [{"x": ["Close"]}]
}'
ind <- jsonlite::fromJSON(json)
ta <- taFactory(ind)

# Call the factory with ATR setup.
json <- '{
  "label": "ATR",
  "method": "TTR::ATR",
  "columns": [{"HLC": ["High", "Low", "Close"]}],
  "args": [{"n": 14, "maType": "EMA"}]
}'
ind <- jsonlite::fromJSON(json)
ta <- taFactory(ind)


n0Trader/TDI documentation built on July 30, 2023, 7:48 p.m.