pq_addti: adding technical indicators

Description Usage Arguments Examples

Description

pq_addti creates technical indicators on provided datasets use TTR package.

Usage

1

Arguments

dt

a list/dataframe of time series datasets.

...

list of technical indicator parameters: sma = list(n=50), macd = list().

  1. There are four types of parameters.

    • set by default and do not required, such as 'OHLC', 'HLC', 'HL' and 'volume'.

    • set by default and can be modified, such as 'price', 'prices', 'x'. Its default value is 'close' or 'value' column.

    • always required, such as 'y', 'w'.

    • numeric parameters, such as 'n', 'sd', 'v', 'nFast', 'nSlow', 'nSig', 'accel'. These parameters should be provided, otherwise using default values in corresponding function.

  2. TTR functions are summarised in below. See TTR package's help document for more detailed parameters.

    • moving averages: SMA, EMA, DEMA, WMA, EVWMA, ZLEMA, VWAP, VMA, HMA, ALMA, GMMA

    • rolling functions: runMin, runMax, runMean, runMedian; runCov, runCor; runVar, runSD, runMAD; runSum, wilderSum

    • bands / channels: BBands, PBands, DonchianChannel

    • SAR, ZigZag

    • trend direction/strength: aroon, CCI, ADX, TDI, VHF, EMV

    • volatility measures: ATR, chaikinVolatility, volatility, SNR

    • money flowing into/out: OBV, chaikinAD, CLV, CMF, MFI, williamsAD

    • rate of change / momentum: ROC, momentum, KST, TRIX

    • oscillator: MACD, DPO, DVI, ultimateOscillator; RSI, CMO; stoch, SMI, WPR

Examples

1
2
3
4
5
6
7
8
# load data
dt = md_stock("^000001", source='163', date_range = 'max')

# add technical indicators
dt_ti1 = pq_addti(dt, sma=list(n=20), sma=list(n=50), macd = list())

# only technical indicators
dt_ti2 = pq_addti(dt, sma=list(n=20), sma=list(n=50), macd = list(), col_kp = FALSE)

pedquant documentation built on May 27, 2019, 5:02 p.m.