Learn R Programming

cryptoQuotes (version 1.3.0)

alma: Add Arnaud Legoux 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

alma(price = "close", n = 9, offset = 0.85, sigma = 6, internal = list(), ...)

Value

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

Arguments

price

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

n

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

offset

Percentile at which the center of the distribution should occur.

sigma

Standard deviation of the distribution.

internal

An empty list. Used for internal purposes. Ignore.

...

any other passthrough parameters

See Also

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

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

Examples

Run this code
# 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;

Run the code above in your browser using DataLab