Moving averages are versatile tools used by traders and analysts in various timeframes, from short-term intraday trading to long-term investing. They help smooth out noise in price data and provide valuable information for decision-making in financial markets.
Usage
addMA(chart, FUN = TTR::SMA, ...)Arguments
- chart
- FUN
A named function calculating MAs. Has to be explicitly called. See
TTR::SMA()for more information.- ...
See
TTR::SMA()
Details
The function supports all moving averages calculated
by the TTR library. See TTR::SMA() for more information.
See also
Other chart indicators:
addBBands(),
addEvents(),
addFGIndex(),
addLSRatio(),
addMACD(),
addRSI(),
addVolume(),
chart()
Examples
# script: scr_charting
# date: 2023-10-25
# author: Serkan Korkmaz, serkor1@duck.com
# objective: Charting in general
# script start;
# library
library(cryptoQuotes)
# charting klines
# with various indicators
chart(
chart = kline(
ATOMUSDT
) %>% addVolume() %>% addMA(
FUN = TTR::SMA,
n = 7
) %>% addMA(
FUN = TTR::SMA,
n = 14
) %>%
addBBands() %>%
addMACD() %>%
addRSI()
)
# script end;
