Learn R Programming

cryptoQuotes (version 1.3.0)

bollinger_bands: Add Bollinger Bands to the chart

Description

[Experimental]

Bollinger Bands provide a visual representation of price volatility and are widely used by traders and investors to assess potential price reversals and trade opportunities in various financial markets, including stocks, forex, and commodities.

Usage

bollinger_bands(n = 20, sd = 2, maType = "SMA", internal = list(), ...)

Value

Invisbly returns a plotly object.

Arguments

n

Number of periods for moving average.

sd

The number of standard deviations to use.

maType

A function or a string naming the function to be called.

internal

An empty list. Used for internal purposes. Ignore.

...

Other arguments to be passed to the maType function.

See Also

Other chart indicators: add_event(), alma(), chart(), dema(), ema(), evwma(), fgi(), hma(), lsr(), macd(), rsi(), sma(), volume(), vwap(), 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