我正在使用整洁的包来绘制唐奇安的高低。低值看起来不正确。我可能没有正确调用 donchian 函数,因为 donchian_100_low 是该行的最大值。我不知道如何解决它。
library(tidyverse)
library(tidyquant)
library(ggthemes)
startdt <- "2021-02-01"
AMC <- tq_get(
"AMC",
get = "stock.prices",
from = startdt
)
AMC_values <- AMC %>%
mutate(
# EMA_20 = EMA(close, n = 20),
# EMA_50 = EMA(close, n = 50),
Don_100=DonchianChannel(high,low)
) %>%
na.omit()
head(AMC_values)
结果:
head(AMC_values)
# A tibble: 6 x 9
symbol date open high low close volume adjusted Don_100[,"high"] [,"mid"] [,"low"]
<chr> <date> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 AMC 2021-02-17 5.58 5.62 5.32 5.55 38849000 5.55 17.2 11.4 5.62
2 AMC 2021-02-18 5.84 6.25 5.46 5.51 130540800 5.51 10.1 7.86 5.62
3 AMC 2021-02-19 5.54 5.77 5.51 5.7 40249100 5.7 9.77 7.70 5.62
4 AMC 2021-02-22 5.93 6.68 5.75 6.55 173409000 6.55 8.74 7.18 5.62
5 AMC 2021-02-23 6.97 7.86 6.01 7.7 264876400 7.7 8.27 6.94 5.62
6 AMC 2021-02-24 7.23 9.83 6.99 9.09 376881800 9.09 9.83 7.72 5.62