dema {cryptoQuotes}R Documentation

Add Double Exponential Moving Average to the chart

Description

[Experimental]

A high-level plotly::add_lines()-wrapper function that interacts with TTR's moving average family of functions.

Usage

dema(
  price = "close",
  n = 10,
  v = 1,
  wilder = FALSE,
  ratio = NULL,
  internal = list()
)

Arguments

price

A character-vector of length 1. Close by default. The name of the vector to passed into TTR::DEMA

n

Number of periods to average over. Must be between 1 and nrow(x), inclusive.

v

The 'volume factor' (a number in [0,1]). See Notes.

wilder

logical; if TRUE, a Welles Wilder type EMA will be calculated; see notes.

ratio

A smoothing/decay ratio. ratio overrides wilder in EMA.

internal

An empty list. Used for internal purposes. Ignore.

Value

A plotly::plot_ly()-object wrapped in rlang::expr().

See Also

Other chart indicators: add_event(), alma(), bollinger_bands(), chart(), ema(), evwma(), fgi(), hma(), lsr(), macd(), rsi(), sma(), volume(), vwap(), wma(), zlema()

Other moving average indicators: alma(), ema(), evwma(), hma(), sma(), wma(), zlema()

Examples

# script: scr_charting
# date: 2023-10-25
# author: Serkan Korkmaz, serkor1@duck.com
# objective: Charting in general
# script start;

## charting the klines
## with indicators as
## subcharts
chart(
  ticker     = BTC,
  main       = kline(),
  sub        = list(
    volume(),
    macd()
  ),
  indicator = list(
    bollinger_bands(),
    sma(),
    alma()
  ),
  options = list(
    dark = TRUE,
    deficiency = FALSE
  )
)

## charting the MACD-indicator
## with klines as subcharts
chart(
  ticker     = BTC,
  main       = macd(),
  sub        = list(
    volume(),
    kline()
  ),
  indicator = list(
    bollinger_bands(),
    sma()
  ),
  options = list(
    dark = TRUE,
    deficiency = FALSE
  )
)

# script end;

[Package cryptoQuotes version 1.3.0 Index]