diff --git a/NAMESPACE b/NAMESPACE
index 343639a2..ae92cf28 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -1,5 +1,7 @@
# Generated by roxygen2: do not edit by hand
+S3method("$",chart_theme)
+S3method(.DollarNames,chart_theme)
S3method(abandoned_baby,data.frame)
S3method(abandoned_baby,default)
S3method(abandoned_baby,matrix)
@@ -202,6 +204,7 @@ S3method(in_neck,data.frame)
S3method(in_neck,default)
S3method(in_neck,matrix)
S3method(in_neck,plotly)
+S3method(indicator,"function")
S3method(intraday_movement_index,data.frame)
S3method(intraday_movement_index,default)
S3method(intraday_movement_index,matrix)
@@ -754,6 +757,7 @@ export(rolling_standard_deviation)
export(rolling_sum)
export(rolling_variance)
export(separating_lines)
+export(set_theme)
export(shooting_star)
export(short_line)
export(simple_moving_average)
@@ -791,4 +795,5 @@ export(weighted_close_price)
export(weighted_moving_average)
export(williams_oscillator)
export(xside_gap_3_methods)
+importFrom(utils,.DollarNames)
useDynLib(talib, .registration = TRUE)
diff --git a/R/chart.R b/R/chart.R
index 76f6533b..51437cd5 100644
--- a/R/chart.R
+++ b/R/chart.R
@@ -43,8 +43,8 @@ chart <- function(
## without passing 'x'
if (missing(x)) {
rm(
- list = ls(envir = .plotting_environment, all.names = TRUE),
- envir = .plotting_environment
+ list = ls(envir = .chart_environment, all.names = TRUE),
+ envir = .chart_environment
)
return(invisible(NULL))
@@ -88,10 +88,10 @@ chart.default <- function(
chart_title <- title
}
.color_values <- .chart_theme()
- .plotting_environment$sub <- .plotting_environment$chart <- list()
+ .chart_environment$sub <- .chart_environment$chart <- list()
## convert input to data.frame object
- ## and store in the .plotting_environment
+ ## and store in the .chart_environment
## to avoid having to pass OHLC on every call
##
## NOTE: it is also a hard requirement on
@@ -113,8 +113,8 @@ chart.default <- function(
} else {
idx
}
- .plotting_environment$x <- data_frame <- x
- .plotting_environment$idx <- list(
+ .chart_environment$x <- data_frame <- x
+ .chart_environment$idx <- list(
label = x$idx,
index = seq_along(x$idx)
)
@@ -128,52 +128,67 @@ chart.default <- function(
assert(is.character(type) && length(type) == 1)
assert(type %in% c("candlestick", "ohlc"))
- price_chart <- plotly::plot_ly(
+ candle_style <- function(
+ bull_candle,
+ bear_candle,
+ line_width,
+ alpha = 1
+ ) {
+ side <- function(col) {
+ list(
+ line = list(
+ color = col,
+ width = line_width
+ ),
+ fillcolor = plotly::toRGB(
+ col,
+ alpha = alpha
+ )
+ )
+ }
+
+ list(
+ increasing = side(bull_candle),
+ decreasing = side(bear_candle)
+ )
+ }
+
+ base <- plotly::plot_ly(
data = data_frame,
- type = type,
x = ~idx,
open = ~open,
close = ~close,
high = ~high,
low = ~low,
+ showlegend = FALSE,
+ ...
+ )
- ## colors of bullish
- ## and bearish candles/bars
- ##
- ## NOTE: if fillcolor is NULL
- ## the candles are hollow.
- ## If there is eventual demand this can be changed
- increasing = list(
- line = list(
- color = .color_values$bull_color,
- width = 3 - 1.75
- ),
- fillcolor = plotly::toRGB(
- x = .color_values$bull_color,
- alpha = 1 ## This should be controlled from .chart_theme()
+ border_chart <- do.call(
+ plotly::add_trace,
+ c(
+ list(p = base, type = type),
+ candle_style(
+ .chart_variables$bullish_border,
+ .chart_variables$bearish_border,
+ line_width = 2
)
- ),
- decreasing = list(
- line = list(
- color = .color_values$bear_color,
- width = 3 - 1.75
- ),
+ )
+ )
- fillcolor = plotly::toRGB(
- x = .color_values$bear_color,
- alpha = 1 ## This should be controlled from .chart_theme()
+ price_chart <- do.call(
+ plotly::add_trace,
+ c(
+ list(
+ p = border_chart,
+ type = type
+ ),
+ candle_style(
+ .chart_variables$bullish_body,
+ .chart_variables$bearish_body,
+ line_width = 1
)
- ),
-
- ## remove legend
- ## there is no reason to display
- ## it in the legend.
- ##
- ## If there is demand for it we can
- ## implement a heuristic to determine intervals
- ## for 1h, 2h, etc. Similar to {cryptoQuotes}
- showlegend = FALSE,
- ...
+ )
)
## construct chart meta data
@@ -181,22 +196,22 @@ chart.default <- function(
## There is no relevant information in the range 1:N
## so if the rownames only contrains integers the chart will
## skip it
- if (is.integer(.plotting_environment$idx$label)) {
+ if (is.integer(.chart_environment$idx$label)) {
title_text <- sprintf(
- fmt = "Ticker: %s N: %d ",
+ fmt = "%s N: %d ",
chart_title,
nrow(x)
)
} else {
title_text <- sprintf(
- fmt = "Ticker: %s N: %d Period: %s",
+ fmt = "%s N: %d Period: %s",
chart_title,
nrow(x),
paste(
- .plotting_environment$idx$label[1],
+ .chart_environment$idx$label[1],
"-",
- .plotting_environment$idx$label[length(
- .plotting_environment$idx$label
+ .chart_environment$idx$label[length(
+ .chart_environment$idx$label
)]
)
)
@@ -216,16 +231,22 @@ chart.default <- function(
},
function(p) layout_font(p),
function(p) layout_legend(p),
- function(p) add_last_value(p, data = data_frame, remove_cols = "volume")
+ function(p) {
+ add_last_value(
+ p,
+ data = data_frame
+ )
+ },
+ function(p) layout_color(p)
)
- .plotting_environment$main <- Reduce(
+ .chart_environment$main <- Reduce(
f = function(p, f) f(p),
x = fns,
init = price_chart
)
layout_settings(
- .plotting_environment$main
+ .chart_environment$main
)
}
diff --git a/R/chart_elements.R b/R/chart_elements.R
index 91209b9b..716264a7 100644
--- a/R/chart_elements.R
+++ b/R/chart_elements.R
@@ -13,7 +13,7 @@ add_title <- function(
yref = "paper",
showarrow = FALSE,
font = list(
- size = 16 *
+ size = 14 *
getOption(
"talib.chart.scale",
default = 1
@@ -37,7 +37,7 @@ add_limit <- function(
add_last_value <- function(
p,
data,
- remove_cols = NULL
+ values_to_extract = c("open", "high", "low", "close")
) {
## construct last value
## text
@@ -45,21 +45,26 @@ add_last_value <- function(
nrow(data),
grep(
x = colnames(data),
- pattern = paste(
- c("idx", remove_cols),
- collapse = "|"
- ),
+ pattern = paste0(values_to_extract, collapse = "|"),
value = TRUE,
- invert = TRUE,
+ invert = FALSE,
ignore.case = TRUE
- )
+ ),
+ drop = FALSE
]
- value_text <- paste0(
- "",
- colnames(last_values),
- ": ",
+ ## extract values
+ ## and names
+ values <- vapply(
last_values,
+ function(col) col[[1]],
+ numeric(1)
+ )
+
+ ohlc <- names(values)
+
+ value_text <- paste(
+ sprintf("%s: %.2f", ohlc, values),
collapse = " "
)
diff --git a/R/chart_indicator.R b/R/chart_indicator.R
index d549f890..dfba993c 100644
--- a/R/chart_indicator.R
+++ b/R/chart_indicator.R
@@ -15,7 +15,13 @@
#' @example man/examples/indicator.R
#'
#' @author Serkan Korkmaz
+#' @export
indicator <- function(FUN, ...) {
+ UseMethod("indicator")
+}
+
+#' @export
+indicator.function <- function(FUN, ...) {
## resolve function name of no
## title have been passed
title <- input_name(
@@ -42,7 +48,7 @@ indicator <- function(FUN, ...) {
## locate the main chart
## NOTE: if its not there we might need
## to initialize a new
- plt <- .plotting_environment$main
+ plt <- .chart_environment$main
if (is.null(plt)) {
chart_called <- FALSE
@@ -70,7 +76,7 @@ indicator <- function(FUN, ...) {
)
}
- .plotting_environment$idx$label <- idx
+ .chart_environment$idx$label <- idx
}
## construct {plotly}-object
@@ -102,7 +108,7 @@ indicator <- function(FUN, ...) {
}
if (chart_called) {
- panels <- c(list(.plotting_environment$main), .plotting_environment$sub)
+ panels <- c(list(.chart_environment$main), .chart_environment$sub)
n <- length(panels)
main_h <- getOption("talib.chart.main", 0.7)
heights <- if (n > 1) {
@@ -125,10 +131,10 @@ indicator <- function(FUN, ...) {
tickmode = "auto"
)
)
- .plotting_environment$chart <- fig
+ .chart_environment$chart <- fig
return(
- layout_settings(fig)
+ layout_axis(layout_color(layout_settings(fig)))
)
}
@@ -140,5 +146,5 @@ indicator <- function(FUN, ...) {
# idx = if (is.null(idx)) 1:nrow(data) else idx
# )
- layout_settings(outcome)
+ layout_axis(layout_color(layout_settings(outcome)))
}
diff --git a/R/chart_layout.R b/R/chart_layout.R
index 10429e34..01c598e9 100644
--- a/R/chart_layout.R
+++ b/R/chart_layout.R
@@ -17,13 +17,13 @@ layout_background <- function(
## apply colors
plotly::layout(
p = p,
- paper_bgcolor = paper_bgcolor,
- plot_bgcolor = plot_bgcolor,
+ paper_bgcolor = .chart_variables$background_color,
+ plot_bgcolor = .chart_variables$background_color,
yaxis = list(
- gridcolor = grid_color
+ gridcolor = .chart_variables$gridcolor
),
xaxis = list(
- gridcolor = grid_color
+ gridcolor = .chart_variables$gridcolor
)
)
}
@@ -42,18 +42,30 @@ layout_axis <- function(
plotly::layout(
p = p,
yaxis = list(
- title = ''
+ title = '',
+ side = "right",
+ showline = TRUE,
+ mirror = TRUE,
+ linecolor = .chart_variables$foreground_color,
+ linewidth = 0.1,
+ zerolinewidth = 0.1,
+ zeroline = FALSE,
+ zerolinecolor = .chart_variables$foreground_color,
+ tickformat = "~s"
),
xaxis = list(
title = '',
tickvals = seq_along(idx),
tickmode = "auto",
- ticktext = idx
+ ticktext = idx,
+ showline = TRUE,
+ mirror = "allticks",
+ color = .chart_variables$foreground_color,
+ linewidth = 0.1
)
)
}
-
layout_annotate <- function(
p,
text,
@@ -77,16 +89,22 @@ layout_title <- function(
...
) {
## apply layout
- plotly::layout(
+ plotly::add_annotations(
p = p,
- title = list(
- text = title,
- x = 0,
- y = 1,
- xref = "paper",
- yref = "paper",
- xanchor = "left",
- yanchor = "bottom"
+ text = title,
+ x = 0,
+ y = 1,
+ xref = "paper",
+ yref = "paper",
+ xanchor = "left",
+ yanchor = "bottom",
+ showarrow = FALSE,
+ font = list(
+ size = 14 *
+ getOption(
+ "talib.chart.scale",
+ default = 1
+ )
)
)
}
@@ -97,7 +115,7 @@ layout_font <- function(
theme_element = layout_theme()
) {
## font color and scale
- font_color <- theme_element$font_color
+ font_color <- .chart_variables$text_color
font_scale <- getOption(
"talib.chart.scale",
default = 1
@@ -108,17 +126,17 @@ layout_font <- function(
p = p,
title = list(
font = list(
- 20 * font_scale
+ 14 * font_scale
)
),
font = list(
- size = 14 * font_scale,
- color = font_color
+ size = 10 * font_scale,
+ color = .chart_variables$text_color
),
legend = list(
title = list(
font = list(
- size = 16 * font_scale
+ size = 14 * font_scale
)
)
)
@@ -173,12 +191,17 @@ layout_settings <- function(p) {
visible = range_slider,
thickness = range_slider_size
)
- ),
- margin = list(
- l = 0,
- b = 0,
- pad = 0
)
+ ## TODO: Understand how this
+ ## actually works. Its still a
+ ## black box.
+ # margin = list(
+ # r = 5,
+ # t = 5,
+ # l = 5,
+ # b = 0,
+ # pad = 0
+ # )
)
## configurations
@@ -203,3 +226,10 @@ layout_settings <- function(p) {
displaylogo = FALSE
)
}
+
+layout_color <- function(p) {
+ plotly::layout(
+ p = p,
+ colorway = .chart_variables$colorway
+ )
+}
diff --git a/R/chart_options.R b/R/chart_options.R
index 1be3a600..9efca111 100644
--- a/R/chart_options.R
+++ b/R/chart_options.R
@@ -5,8 +5,8 @@ layout_theme <- .chart_theme <- function() {
bull_color = "#5d8ca8"
bear_color = "#d3ba68"
} else {
- bull_color = "#65a479"
- bear_color = "#d5695d"
+ bull_color = "#4D4D4D"
+ bear_color = "#A9A9A9"
}
if (getOption("talib.chart.dark", default = TRUE)) {
@@ -21,11 +21,11 @@ layout_theme <- .chart_theme <- function() {
)
} else {
list(
- paper_bgcolor = '#E3E3E3',
- plot_bgcolor = '#E3E3E3',
- font_color = '#A3A3A3',
- threshold_color = '#8A8C90',
- grid_color = '#D3D3D3',
+ paper_bgcolor = '#FFFFFF',
+ plot_bgcolor = '#FFFFFF',
+ font_color = '#333333',
+ threshold_color = '##333333',
+ grid_color = '#FFFFFF',
bull_color = bull_color,
bear_color = bear_color
)
diff --git a/R/chart_theme.R b/R/chart_theme.R
new file mode 100644
index 00000000..32f121a8
--- /dev/null
+++ b/R/chart_theme.R
@@ -0,0 +1,198 @@
+#' Chart themes
+#'
+#' Set the active chart color theme used by the package's chart rendering
+#' functions.
+#'
+#' @details
+#' Themes **mutate** the package-level theme state stored in `.chart_variables`.
+#'
+#' @return Invisibly returns `.chart_variables` after modification.
+#' @family Chart Themes
+#' @name chart_themes
+NULL
+
+## available themes
+.theme_registry <- list(
+ hawks_and_doves = list(
+ ## candle-colors
+ bearish_body = "#A9A9A9",
+ bearish_wick = "#8A8A8A",
+ bearish_border = "#7A7A7A",
+ bullish_body = "#4D4D4D",
+ bullish_wick = "#505050",
+ bullish_border = "#3D3D3D",
+
+ ## general-colors
+ background_color = "#FFFFFF",
+ foreground_color = "#333333",
+ text_color = "#333333",
+
+ ## colorway
+ colorway = c(
+ "#b8b0ac",
+ "#5778a4",
+ "#85b6b2",
+ "#6a9f58",
+ "#a87c9f",
+ "#967662",
+ "#e49444",
+ "#d1615d",
+ "#f1a2a9",
+ "#e7ca60"
+ ),
+
+ ## grid
+ gridcolor = "#E6E6E6"
+ ),
+
+ payout = list(
+ ## candle-colors
+ bearish_body = "#2F4F4F",
+ bearish_wick = "#2F4F4F",
+ bearish_border = "#2F4F4F",
+ bullish_body = "#008080",
+ bullish_wick = "#5F9EA0",
+ bullish_border = "#5F9EA0",
+
+ ## general-colors
+ background_color = "#1A1A1A",
+ foreground_color = "#CFCFCF",
+ text_color = "#CFCFCF",
+
+ ## colorway
+ colorway = c(
+ "#008080",
+ "#EF553B",
+ "#636EFA",
+ "#AB63FA",
+ "#FFA15A",
+ "#19D3F3",
+ "#FF6692",
+ "#B6E880",
+ "#FF97FF",
+ "#FECB52"
+ ),
+
+ ## grid
+ gridcolor = "#2B2B2B"
+ ),
+
+ tp_slapped = list(
+ ## candle-colors
+ bearish_body = "#e74c3c",
+ bearish_wick = "#c0392b",
+ bearish_border = "#c0392b",
+ bullish_body = "#1abc9c",
+ bullish_wick = "#16a085",
+ bullish_border = "#16a085",
+
+ ## general-colors
+ background_color = "#ecf0f1",
+ foreground_color = "#2c3e50",
+ text_color = "#2c3e50",
+
+ ## colorway
+ colorway = c(
+ "#1abc9c",
+ "#2ecc71",
+ "#3498db",
+ "#9b59b6",
+ "#f1c40f",
+ "#f39c12",
+ "#e67e22",
+ "#e74c3c",
+ "#34495e",
+ "#95a5a6"
+ ),
+
+ ## grid
+ gridcolor = "#D7DDE0"
+ ),
+
+ trust_the_process = list(
+ ## candle-colors
+ bearish_body = "#A9A9A9",
+ bearish_wick = "#696969",
+ bearish_border = "#B0B0B0",
+ bullish_body = "#808080",
+ bullish_wick = "#696969",
+ bullish_border = "#707070",
+
+ ## general-colors
+ background_color = "#F5F5F5",
+ foreground_color = "#333333",
+ text_color = "#333333",
+
+ ## colorway
+ colorway = c(
+ "#272E31",
+ "#6C514D",
+ "#5C6F5F",
+ "#6E8785",
+ "#756F6D",
+ "#AF804B",
+ "#B3B186",
+ "#D9BDA5",
+ "#E0C9A6",
+ "#D16014"
+ ),
+
+ ## grid
+ gridcolor = "#E6E6E6"
+ )
+)
+
+.apply_chart_theme <- function(spec) {
+ if (is.environment(.chart_variables)) {
+ for (nm in names(spec)) {
+ assign(nm, spec[[nm]], envir = .chart_variables)
+ }
+ } else {
+ for (nm in names(spec)) {
+ .chart_variables[[nm]] <- spec[[nm]]
+ }
+ }
+ invisible(.chart_variables)
+}
+
+.make_theme_fn <- function(spec) {
+ force(spec)
+ function() .apply_chart_theme(spec)
+}
+
+#' Theme accessor
+#'
+#' Access theme setters via `$`.
+#'
+#' @details
+#' Example: `set_theme$theme_tp_slapped()` or `set_theme()$theme_tp_slapped()`.
+#'
+#' @return Returns itself (so `set_theme()` is chainable with `$`).
+#' @family Chart Themes
+#' @export
+set_theme <- local({
+ f <- function() f
+ class(f) <- c("chart_theme", class(f))
+ f
+})
+
+#' @export
+`$.chart_theme` <- function(x, name) {
+ specs <- .theme_registry
+ if (!nzchar(name) || is.null(specs[[name]])) {
+ stop(
+ "Unknown theme '",
+ name,
+ "'. Available: ",
+ paste(names(specs), collapse = ", "),
+ call. = FALSE
+ )
+ }
+ .make_theme_fn(specs[[name]])
+}
+
+#' @importFrom utils .DollarNames
+#' @export
+.DollarNames.chart_theme <- function(x, pattern = "") {
+ grep(pattern, names(.theme_registry), value = TRUE)
+}
diff --git a/R/helper.R b/R/helper.R
index 1d98509b..11d9efa3 100644
--- a/R/helper.R
+++ b/R/helper.R
@@ -34,7 +34,7 @@ rebuild_formula <- function(
add_idx <- function(x) {
## store idx
- idx <- .plotting_environment$idx$label
+ idx <- .chart_environment$idx$label
if (!is.null(idx)) {
idx[
diff --git a/R/series.R b/R/series.R
index a6a125eb..1a715b2f 100644
--- a/R/series.R
+++ b/R/series.R
@@ -37,7 +37,7 @@ series.plotly <- function(
# If caller didn't provide data=..., default to the chart's data
if (!("data" %in% dn)) {
- dotsQ$data <- quote(.plotting_environment$x)
+ dotsQ$data <- quote(.chart_environment$x)
}
out <- as.data.frame(
diff --git a/R/ta_ACCBANDS.R b/R/ta_ACCBANDS.R
index 826b436c..17e879d8 100644
--- a/R/ta_ACCBANDS.R
+++ b/R/ta_ACCBANDS.R
@@ -171,9 +171,23 @@ acceleration_bands.plotly <- function(
)
traces <- list(
- list(y = ~UpperBand, name = "Upper Band"),
- list(y = ~MiddleBand, name = "Middle Band", fill = "tonexty"),
- list(y = ~LowerBand, name = "Lower Band", fill = "tonexty")
+ list(
+ y = ~UpperBand,
+ name = "Upper Acceleration Band",
+ showlegend = FALSE
+ ),
+ list(
+ y = ~MiddleBand,
+ name = "SMA",
+ fill = "tonexty",
+ showlegend = TRUE
+ ),
+ list(
+ y = ~LowerBand,
+ name = "Lower Acceleration Band",
+ fill = "tonexty",
+ showlegend = FALSE
+ )
)
traces <- modify_traces(
@@ -188,8 +202,8 @@ acceleration_bands.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = traces,
decorators = list(),
name = get0(
diff --git a/R/ta_AD.R b/R/ta_AD.R
index 9b3a6d4e..7efe9d51 100644
--- a/R/ta_AD.R
+++ b/R/ta_AD.R
@@ -149,6 +149,12 @@ chaikin_accumulation_distribution_line.plotly <- function(
)
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -163,27 +169,31 @@ chaikin_accumulation_distribution_line.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Chaikin A/D Line"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Chaikin A/D Line"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_ADOSC.R b/R/ta_ADOSC.R
index 7045f83b..36fb9726 100644
--- a/R/ta_ADOSC.R
+++ b/R/ta_ADOSC.R
@@ -169,6 +169,12 @@ chaikin_accumulation_distribution_oscillator.plotly <- function(
slow = slow
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -183,27 +189,31 @@ chaikin_accumulation_distribution_oscillator.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Chaikin A/D Oscillator"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Chaikin A/D Oscillator"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_ADX.R b/R/ta_ADX.R
index 8e4d66eb..0453c6f9 100644
--- a/R/ta_ADX.R
+++ b/R/ta_ADX.R
@@ -160,6 +160,12 @@ average_directional_movement_index.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -184,27 +190,31 @@ average_directional_movement_index.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Average Directional Movement Index"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Average Directional Movement Index"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_ADXR.R b/R/ta_ADXR.R
index ba76df4e..3945a799 100644
--- a/R/ta_ADXR.R
+++ b/R/ta_ADXR.R
@@ -160,6 +160,12 @@ average_directional_movement_index_rating.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -184,27 +190,31 @@ average_directional_movement_index_rating.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Average Directional Movement Index Rating"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Average Directional Movement Index Rating"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_APO.R b/R/ta_APO.R
index 8fa08cc6..4ead4ed9 100644
--- a/R/ta_APO.R
+++ b/R/ta_APO.R
@@ -223,6 +223,12 @@ absolute_price_oscillator.plotly <- function(
ma = ma
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -244,27 +250,31 @@ absolute_price_oscillator.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Absolute Price Oscillator"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Absolute Price Oscillator"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_AROON.R b/R/ta_AROON.R
index 314482b2..68f91e8c 100644
--- a/R/ta_AROON.R
+++ b/R/ta_AROON.R
@@ -156,6 +156,12 @@ aroon.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -189,27 +195,31 @@ aroon.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Aroon"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Aroon"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_AROONOSC.R b/R/ta_AROONOSC.R
index 89243167..0a056e1f 100644
--- a/R/ta_AROONOSC.R
+++ b/R/ta_AROONOSC.R
@@ -156,6 +156,12 @@ aroon_oscillator.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -175,27 +181,31 @@ aroon_oscillator.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Aroon Oscillator"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Aroon Oscillator"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_ATR.R b/R/ta_ATR.R
index f568a2be..14bba96d 100644
--- a/R/ta_ATR.R
+++ b/R/ta_ATR.R
@@ -157,6 +157,12 @@ average_true_range.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -171,27 +177,31 @@ average_true_range.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Average True Range"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Average True Range"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_BBANDS.R b/R/ta_BBANDS.R
index e3ef7972..7d59d6c1 100644
--- a/R/ta_BBANDS.R
+++ b/R/ta_BBANDS.R
@@ -264,9 +264,22 @@ bollinger_bands.plotly <- function(
}
traces <- list(
- list(y = ~UpperBand, name = "Upper Band"),
- list(y = ~MiddleBand, name = "Middle Band", fill = "tonexty"),
- list(y = ~LowerBand, name = "Lower Band", fill = "tonexty")
+ list(
+ y = ~UpperBand,
+ name = paste("Upper Bollinger Band", paste0("+", sd_up, " sd")),
+ showlegend = FALSE
+ ),
+ list(
+ y = ~MiddleBand,
+ name = sub("\\(.*$", "", input_name(substitute(ma)), perl = TRUE),
+ fill = "tonexty"
+ ),
+ list(
+ y = ~LowerBand,
+ name = paste("Lower Bollinger Band", paste0("-", sd_down, " sd")),
+ fill = "tonexty",
+ showlegend = FALSE
+ )
)
traces <- modify_traces(
@@ -281,8 +294,8 @@ bollinger_bands.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = traces,
decorators = list(),
name = get0(
diff --git a/R/ta_BOP.R b/R/ta_BOP.R
index 735d7845..b0b9706b 100644
--- a/R/ta_BOP.R
+++ b/R/ta_BOP.R
@@ -149,6 +149,12 @@ balance_of_power.plotly <- function(
)
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -174,27 +180,31 @@ balance_of_power.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Balance of Power"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Balance of Power"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_CCI.R b/R/ta_CCI.R
index 2cf3cfe2..3f43ea22 100644
--- a/R/ta_CCI.R
+++ b/R/ta_CCI.R
@@ -176,8 +176,8 @@ commodity_channel_index.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = traces,
decorators = list(),
name = get0(
diff --git a/R/ta_CDL2CROWS.R b/R/ta_CDL2CROWS.R
index 08ef94cd..ff34f7f7 100644
--- a/R/ta_CDL2CROWS.R
+++ b/R/ta_CDL2CROWS.R
@@ -170,8 +170,8 @@ two_crows.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDL3BLACKCROWS.R b/R/ta_CDL3BLACKCROWS.R
index ef7634d6..92d4fa2b 100644
--- a/R/ta_CDL3BLACKCROWS.R
+++ b/R/ta_CDL3BLACKCROWS.R
@@ -170,8 +170,8 @@ three_black_crows.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDL3INSIDE.R b/R/ta_CDL3INSIDE.R
index 34f96a08..08b287d5 100644
--- a/R/ta_CDL3INSIDE.R
+++ b/R/ta_CDL3INSIDE.R
@@ -170,8 +170,8 @@ three_inside.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDL3LINESTRIKE.R b/R/ta_CDL3LINESTRIKE.R
index b1fafd42..9c4c71db 100644
--- a/R/ta_CDL3LINESTRIKE.R
+++ b/R/ta_CDL3LINESTRIKE.R
@@ -170,8 +170,8 @@ three_line_strike.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDL3OUTSIDE.R b/R/ta_CDL3OUTSIDE.R
index 912e91d4..42a4112a 100644
--- a/R/ta_CDL3OUTSIDE.R
+++ b/R/ta_CDL3OUTSIDE.R
@@ -170,8 +170,8 @@ three_outside.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDL3STARSINSOUTH.R b/R/ta_CDL3STARSINSOUTH.R
index 2fee2e0d..682024a7 100644
--- a/R/ta_CDL3STARSINSOUTH.R
+++ b/R/ta_CDL3STARSINSOUTH.R
@@ -170,8 +170,8 @@ three_stars_in_the_south.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDL3WHITESOLDIERS.R b/R/ta_CDL3WHITESOLDIERS.R
index 54f52aec..dd419ab0 100644
--- a/R/ta_CDL3WHITESOLDIERS.R
+++ b/R/ta_CDL3WHITESOLDIERS.R
@@ -170,8 +170,8 @@ three_white_soldiers.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLABANDONEDBABY.R b/R/ta_CDLABANDONEDBABY.R
index e788075c..7e6038fb 100644
--- a/R/ta_CDLABANDONEDBABY.R
+++ b/R/ta_CDLABANDONEDBABY.R
@@ -177,8 +177,8 @@ abandoned_baby.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLADVANCEBLOCK.R b/R/ta_CDLADVANCEBLOCK.R
index 94aea4d2..87efe789 100644
--- a/R/ta_CDLADVANCEBLOCK.R
+++ b/R/ta_CDLADVANCEBLOCK.R
@@ -170,8 +170,8 @@ advance_block.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLBELTHOLD.R b/R/ta_CDLBELTHOLD.R
index 97106f3a..253f3497 100644
--- a/R/ta_CDLBELTHOLD.R
+++ b/R/ta_CDLBELTHOLD.R
@@ -170,8 +170,8 @@ belt_hold.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLBREAKAWAY.R b/R/ta_CDLBREAKAWAY.R
index 210e1824..1eb6dd27 100644
--- a/R/ta_CDLBREAKAWAY.R
+++ b/R/ta_CDLBREAKAWAY.R
@@ -170,8 +170,8 @@ break_away.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLCLOSINGMARUBOZU.R b/R/ta_CDLCLOSINGMARUBOZU.R
index fd0bd2c0..f63da4a3 100644
--- a/R/ta_CDLCLOSINGMARUBOZU.R
+++ b/R/ta_CDLCLOSINGMARUBOZU.R
@@ -170,8 +170,8 @@ closing_marubozu.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLCONCEALBABYSWALL.R b/R/ta_CDLCONCEALBABYSWALL.R
index ce077afe..df8fef02 100644
--- a/R/ta_CDLCONCEALBABYSWALL.R
+++ b/R/ta_CDLCONCEALBABYSWALL.R
@@ -170,8 +170,8 @@ concealing_baby_swallow.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLCOUNTERATTACK.R b/R/ta_CDLCOUNTERATTACK.R
index 5f70e496..0ecae5ac 100644
--- a/R/ta_CDLCOUNTERATTACK.R
+++ b/R/ta_CDLCOUNTERATTACK.R
@@ -170,8 +170,8 @@ counter_attack.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLDARKCLOUDCOVER.R b/R/ta_CDLDARKCLOUDCOVER.R
index 8cf9aea7..4001cb5e 100644
--- a/R/ta_CDLDARKCLOUDCOVER.R
+++ b/R/ta_CDLDARKCLOUDCOVER.R
@@ -177,8 +177,8 @@ dark_cloud_cover.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLDOJI.R b/R/ta_CDLDOJI.R
index 105fb798..55b3c352 100644
--- a/R/ta_CDLDOJI.R
+++ b/R/ta_CDLDOJI.R
@@ -170,8 +170,8 @@ doji.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLDOJISTAR.R b/R/ta_CDLDOJISTAR.R
index 6100f35a..4df34196 100644
--- a/R/ta_CDLDOJISTAR.R
+++ b/R/ta_CDLDOJISTAR.R
@@ -170,8 +170,8 @@ doji_star.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLDRAGONFLYDOJI.R b/R/ta_CDLDRAGONFLYDOJI.R
index 486b4027..a254f4b8 100644
--- a/R/ta_CDLDRAGONFLYDOJI.R
+++ b/R/ta_CDLDRAGONFLYDOJI.R
@@ -170,8 +170,8 @@ dragonfly_doji.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLENGULFING.R b/R/ta_CDLENGULFING.R
index f851601d..2ce4f094 100644
--- a/R/ta_CDLENGULFING.R
+++ b/R/ta_CDLENGULFING.R
@@ -170,8 +170,8 @@ engulfing.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLEVENINGDOJISTAR.R b/R/ta_CDLEVENINGDOJISTAR.R
index 6caa3159..1fc0bc6c 100644
--- a/R/ta_CDLEVENINGDOJISTAR.R
+++ b/R/ta_CDLEVENINGDOJISTAR.R
@@ -177,8 +177,8 @@ evening_doji_star.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLEVENINGSTAR.R b/R/ta_CDLEVENINGSTAR.R
index 20e608a3..a8f6c0c6 100644
--- a/R/ta_CDLEVENINGSTAR.R
+++ b/R/ta_CDLEVENINGSTAR.R
@@ -177,8 +177,8 @@ evening_star.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLGAPSIDESIDEWHITE.R b/R/ta_CDLGAPSIDESIDEWHITE.R
index b2f0ecf0..f40f73d6 100644
--- a/R/ta_CDLGAPSIDESIDEWHITE.R
+++ b/R/ta_CDLGAPSIDESIDEWHITE.R
@@ -170,8 +170,8 @@ gaps_side_white.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLGRAVESTONEDOJI.R b/R/ta_CDLGRAVESTONEDOJI.R
index 0fc16b43..76675616 100644
--- a/R/ta_CDLGRAVESTONEDOJI.R
+++ b/R/ta_CDLGRAVESTONEDOJI.R
@@ -170,8 +170,8 @@ gravestone_doji.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLHAMMER.R b/R/ta_CDLHAMMER.R
index 999f169b..16451c62 100644
--- a/R/ta_CDLHAMMER.R
+++ b/R/ta_CDLHAMMER.R
@@ -170,8 +170,8 @@ hammer.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLHANGINGMAN.R b/R/ta_CDLHANGINGMAN.R
index 333ae3a9..69bac652 100644
--- a/R/ta_CDLHANGINGMAN.R
+++ b/R/ta_CDLHANGINGMAN.R
@@ -170,8 +170,8 @@ hanging_man.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLHARAMI.R b/R/ta_CDLHARAMI.R
index 49171097..ad097cd2 100644
--- a/R/ta_CDLHARAMI.R
+++ b/R/ta_CDLHARAMI.R
@@ -170,8 +170,8 @@ harami.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLHARAMICROSS.R b/R/ta_CDLHARAMICROSS.R
index b620b28e..d78d79cc 100644
--- a/R/ta_CDLHARAMICROSS.R
+++ b/R/ta_CDLHARAMICROSS.R
@@ -170,8 +170,8 @@ harami_cross.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLHIGHWAVE.R b/R/ta_CDLHIGHWAVE.R
index 3d40efe3..e83f2722 100644
--- a/R/ta_CDLHIGHWAVE.R
+++ b/R/ta_CDLHIGHWAVE.R
@@ -170,8 +170,8 @@ high_wave.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLHIKKAKE.R b/R/ta_CDLHIKKAKE.R
index 03b6862f..e2fca338 100644
--- a/R/ta_CDLHIKKAKE.R
+++ b/R/ta_CDLHIKKAKE.R
@@ -170,8 +170,8 @@ hikakke.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLHIKKAKEMOD.R b/R/ta_CDLHIKKAKEMOD.R
index 78d5e3bd..00685cbd 100644
--- a/R/ta_CDLHIKKAKEMOD.R
+++ b/R/ta_CDLHIKKAKEMOD.R
@@ -170,8 +170,8 @@ hikakke_mod.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLHOMINGPIGEON.R b/R/ta_CDLHOMINGPIGEON.R
index cf559f68..9cfa9d34 100644
--- a/R/ta_CDLHOMINGPIGEON.R
+++ b/R/ta_CDLHOMINGPIGEON.R
@@ -170,8 +170,8 @@ homing_pigeon.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLIDENTICAL3CROWS.R b/R/ta_CDLIDENTICAL3CROWS.R
index 9f4562cc..2a5c1024 100644
--- a/R/ta_CDLIDENTICAL3CROWS.R
+++ b/R/ta_CDLIDENTICAL3CROWS.R
@@ -170,8 +170,8 @@ three_identical_crows.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLINNECK.R b/R/ta_CDLINNECK.R
index 988c2ede..53527d19 100644
--- a/R/ta_CDLINNECK.R
+++ b/R/ta_CDLINNECK.R
@@ -170,8 +170,8 @@ in_neck.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLINVERTEDHAMMER.R b/R/ta_CDLINVERTEDHAMMER.R
index dc72a2d7..5a4b883d 100644
--- a/R/ta_CDLINVERTEDHAMMER.R
+++ b/R/ta_CDLINVERTEDHAMMER.R
@@ -170,8 +170,8 @@ inverted_hammer.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLKICKING.R b/R/ta_CDLKICKING.R
index 18a26e66..efc2367e 100644
--- a/R/ta_CDLKICKING.R
+++ b/R/ta_CDLKICKING.R
@@ -170,8 +170,8 @@ kicking.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLKICKINGBYLENGTH.R b/R/ta_CDLKICKINGBYLENGTH.R
index 356cb50f..03817acc 100644
--- a/R/ta_CDLKICKINGBYLENGTH.R
+++ b/R/ta_CDLKICKINGBYLENGTH.R
@@ -170,8 +170,8 @@ kicking_baby_length.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLLADDERBOTTOM.R b/R/ta_CDLLADDERBOTTOM.R
index 93796738..88985031 100644
--- a/R/ta_CDLLADDERBOTTOM.R
+++ b/R/ta_CDLLADDERBOTTOM.R
@@ -170,8 +170,8 @@ ladder_bottom.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLLONGLEGGEDDOJI.R b/R/ta_CDLLONGLEGGEDDOJI.R
index 77e94414..bf4c69f7 100644
--- a/R/ta_CDLLONGLEGGEDDOJI.R
+++ b/R/ta_CDLLONGLEGGEDDOJI.R
@@ -170,8 +170,8 @@ long_legged_doji.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLLONGLINE.R b/R/ta_CDLLONGLINE.R
index f364b2eb..ea01dbfd 100644
--- a/R/ta_CDLLONGLINE.R
+++ b/R/ta_CDLLONGLINE.R
@@ -170,8 +170,8 @@ long_line.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLMARUBOZU.R b/R/ta_CDLMARUBOZU.R
index e1212ac4..931fd3f3 100644
--- a/R/ta_CDLMARUBOZU.R
+++ b/R/ta_CDLMARUBOZU.R
@@ -170,8 +170,8 @@ marubozu.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLMATCHINGLOW.R b/R/ta_CDLMATCHINGLOW.R
index 655b489f..842bac97 100644
--- a/R/ta_CDLMATCHINGLOW.R
+++ b/R/ta_CDLMATCHINGLOW.R
@@ -170,8 +170,8 @@ matching_low.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLMATHOLD.R b/R/ta_CDLMATHOLD.R
index f33f19f2..a71602dd 100644
--- a/R/ta_CDLMATHOLD.R
+++ b/R/ta_CDLMATHOLD.R
@@ -177,8 +177,8 @@ mat_hold.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLMORNINGDOJISTAR.R b/R/ta_CDLMORNINGDOJISTAR.R
index 644c617e..4768d29e 100644
--- a/R/ta_CDLMORNINGDOJISTAR.R
+++ b/R/ta_CDLMORNINGDOJISTAR.R
@@ -177,8 +177,8 @@ morning_doji_star.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLMORNINGSTAR.R b/R/ta_CDLMORNINGSTAR.R
index 11351497..80d5ca0d 100644
--- a/R/ta_CDLMORNINGSTAR.R
+++ b/R/ta_CDLMORNINGSTAR.R
@@ -177,8 +177,8 @@ morning_star.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLONNECK.R b/R/ta_CDLONNECK.R
index 4db8f97d..067864a2 100644
--- a/R/ta_CDLONNECK.R
+++ b/R/ta_CDLONNECK.R
@@ -170,8 +170,8 @@ on_neck.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLPIERCING.R b/R/ta_CDLPIERCING.R
index fc1c6d25..f2445ba4 100644
--- a/R/ta_CDLPIERCING.R
+++ b/R/ta_CDLPIERCING.R
@@ -170,8 +170,8 @@ piercing.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLRICKSHAWMAN.R b/R/ta_CDLRICKSHAWMAN.R
index 802059de..11d9b596 100644
--- a/R/ta_CDLRICKSHAWMAN.R
+++ b/R/ta_CDLRICKSHAWMAN.R
@@ -170,8 +170,8 @@ rickshaw_man.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLRISEFALL3METHODS.R b/R/ta_CDLRISEFALL3METHODS.R
index b237de22..555a53cb 100644
--- a/R/ta_CDLRISEFALL3METHODS.R
+++ b/R/ta_CDLRISEFALL3METHODS.R
@@ -170,8 +170,8 @@ rise_fall_3_methods.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLSEPARATINGLINES.R b/R/ta_CDLSEPARATINGLINES.R
index d38d70fa..45ea9149 100644
--- a/R/ta_CDLSEPARATINGLINES.R
+++ b/R/ta_CDLSEPARATINGLINES.R
@@ -170,8 +170,8 @@ separating_lines.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLSHOOTINGSTAR.R b/R/ta_CDLSHOOTINGSTAR.R
index 667e1007..13ba3575 100644
--- a/R/ta_CDLSHOOTINGSTAR.R
+++ b/R/ta_CDLSHOOTINGSTAR.R
@@ -170,8 +170,8 @@ shooting_star.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLSHORTLINE.R b/R/ta_CDLSHORTLINE.R
index 2f922bc2..878cf873 100644
--- a/R/ta_CDLSHORTLINE.R
+++ b/R/ta_CDLSHORTLINE.R
@@ -170,8 +170,8 @@ short_line.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLSPINNINGTOP.R b/R/ta_CDLSPINNINGTOP.R
index c0912c6f..ca7e5ce6 100644
--- a/R/ta_CDLSPINNINGTOP.R
+++ b/R/ta_CDLSPINNINGTOP.R
@@ -170,8 +170,8 @@ spinning_top.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLSTALLEDPATTERN.R b/R/ta_CDLSTALLEDPATTERN.R
index a2d41e7e..207e7542 100644
--- a/R/ta_CDLSTALLEDPATTERN.R
+++ b/R/ta_CDLSTALLEDPATTERN.R
@@ -170,8 +170,8 @@ stalled_pattern.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLSTICKSANDWICH.R b/R/ta_CDLSTICKSANDWICH.R
index a905ca67..44399ba8 100644
--- a/R/ta_CDLSTICKSANDWICH.R
+++ b/R/ta_CDLSTICKSANDWICH.R
@@ -170,8 +170,8 @@ stick_sandwich.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLTAKURI.R b/R/ta_CDLTAKURI.R
index ed8b4cfc..3368a80b 100644
--- a/R/ta_CDLTAKURI.R
+++ b/R/ta_CDLTAKURI.R
@@ -170,8 +170,8 @@ takuri.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLTASUKIGAP.R b/R/ta_CDLTASUKIGAP.R
index 47de66b0..c5ec300b 100644
--- a/R/ta_CDLTASUKIGAP.R
+++ b/R/ta_CDLTASUKIGAP.R
@@ -170,8 +170,8 @@ tasuki_gap.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLTHRUSTING.R b/R/ta_CDLTHRUSTING.R
index 516d8297..eaa38882 100644
--- a/R/ta_CDLTHRUSTING.R
+++ b/R/ta_CDLTHRUSTING.R
@@ -170,8 +170,8 @@ thrusting.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLTRISTAR.R b/R/ta_CDLTRISTAR.R
index 2874948c..c1518590 100644
--- a/R/ta_CDLTRISTAR.R
+++ b/R/ta_CDLTRISTAR.R
@@ -170,8 +170,8 @@ tristar.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLUNIQUE3RIVER.R b/R/ta_CDLUNIQUE3RIVER.R
index daf8865c..5701a503 100644
--- a/R/ta_CDLUNIQUE3RIVER.R
+++ b/R/ta_CDLUNIQUE3RIVER.R
@@ -170,8 +170,8 @@ unique_3_river.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLUPSIDEGAP2CROWS.R b/R/ta_CDLUPSIDEGAP2CROWS.R
index bf4774e6..d05cd83b 100644
--- a/R/ta_CDLUPSIDEGAP2CROWS.R
+++ b/R/ta_CDLUPSIDEGAP2CROWS.R
@@ -170,8 +170,8 @@ upside_gap_2_crows.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CDLXSIDEGAP3METHODS.R b/R/ta_CDLXSIDEGAP3METHODS.R
index 863fe7a6..147eca18 100644
--- a/R/ta_CDLXSIDEGAP3METHODS.R
+++ b/R/ta_CDLXSIDEGAP3METHODS.R
@@ -170,8 +170,8 @@ xside_gap_3_methods.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- pattern(
- p = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- pattern(
+ p = .chart_environment[["main"]],
x = constructed_indicator,
high = constructed_series[[2]],
low = constructed_series[[3]],
diff --git a/R/ta_CMO.R b/R/ta_CMO.R
index 7694c190..3141ee00 100644
--- a/R/ta_CMO.R
+++ b/R/ta_CMO.R
@@ -200,6 +200,12 @@ chande_momentum_oscillator.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -228,27 +234,31 @@ chande_momentum_oscillator.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Chande Momentum Oscillator"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Chande Momentum Oscillator"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_DEMA.R b/R/ta_DEMA.R
index ab1d55b7..19246aec 100644
--- a/R/ta_DEMA.R
+++ b/R/ta_DEMA.R
@@ -206,8 +206,8 @@ double_exponential_moving_average.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = list(
list(
y = ~ constructed_indicator[["DEMA"]][
diff --git a/R/ta_DX.R b/R/ta_DX.R
index 311c570e..30a09154 100644
--- a/R/ta_DX.R
+++ b/R/ta_DX.R
@@ -157,6 +157,12 @@ directional_movement_index.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -180,27 +186,31 @@ directional_movement_index.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Directional Movement Index"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Directional Movement Index"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_EMA.R b/R/ta_EMA.R
index e2fa3c60..a8f0cc7d 100644
--- a/R/ta_EMA.R
+++ b/R/ta_EMA.R
@@ -206,8 +206,8 @@ exponential_moving_average.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = list(
list(
y = ~ constructed_indicator[["EMA"]][
diff --git a/R/ta_HT_DCPERIOD.R b/R/ta_HT_DCPERIOD.R
index fbefa877..eb441d47 100644
--- a/R/ta_HT_DCPERIOD.R
+++ b/R/ta_HT_DCPERIOD.R
@@ -187,6 +187,12 @@ dominant_cycle_period.plotly <- function(
)
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -210,27 +216,31 @@ dominant_cycle_period.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Hilbert Transform - Dominant Cycle Period"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Hilbert Transform - Dominant Cycle Period"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_HT_DCPHASE.R b/R/ta_HT_DCPHASE.R
index 4fa2cbd0..fdc38006 100644
--- a/R/ta_HT_DCPHASE.R
+++ b/R/ta_HT_DCPHASE.R
@@ -187,6 +187,12 @@ dominant_cycle_phase.plotly <- function(
)
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -210,27 +216,31 @@ dominant_cycle_phase.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Hilbert Transform - Dominant Cycle Phase"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Hilbert Transform - Dominant Cycle Phase"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_HT_PHASOR.R b/R/ta_HT_PHASOR.R
index 7033d9cf..760d320c 100644
--- a/R/ta_HT_PHASOR.R
+++ b/R/ta_HT_PHASOR.R
@@ -187,6 +187,12 @@ phasor_components.plotly <- function(
)
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -218,27 +224,31 @@ phasor_components.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Hilbert Transform - Phasor Components"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Hilbert Transform - Phasor Components"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_HT_SINE.R b/R/ta_HT_SINE.R
index ae2c6161..5a9ef3df 100644
--- a/R/ta_HT_SINE.R
+++ b/R/ta_HT_SINE.R
@@ -187,6 +187,12 @@ sine_wave.plotly <- function(
)
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -216,27 +222,31 @@ sine_wave.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Hilbert Transform - SineWave"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Hilbert Transform - SineWave"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_HT_TRENDLINE.R b/R/ta_HT_TRENDLINE.R
index bf6c2c95..85a285bd 100644
--- a/R/ta_HT_TRENDLINE.R
+++ b/R/ta_HT_TRENDLINE.R
@@ -199,8 +199,8 @@ trendline.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = traces,
decorators = list(),
name = get0(
diff --git a/R/ta_HT_TRENDMODE.R b/R/ta_HT_TRENDMODE.R
index b91c6f97..f28f414e 100644
--- a/R/ta_HT_TRENDMODE.R
+++ b/R/ta_HT_TRENDMODE.R
@@ -187,6 +187,12 @@ trend_cycle_mode.plotly <- function(
)
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -209,27 +215,31 @@ trend_cycle_mode.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Hilbert Transform - Trend vs Cycle Mode"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Hilbert Transform - Trend vs Cycle Mode"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_IMI.R b/R/ta_IMI.R
index e862202e..47244680 100644
--- a/R/ta_IMI.R
+++ b/R/ta_IMI.R
@@ -156,6 +156,12 @@ intraday_movement_index.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -175,27 +181,31 @@ intraday_movement_index.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Intraday Movement Index"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Intraday Movement Index"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_KAMA.R b/R/ta_KAMA.R
index e7a09fad..38732206 100644
--- a/R/ta_KAMA.R
+++ b/R/ta_KAMA.R
@@ -206,8 +206,8 @@ kaufman_adaptive_moving_average.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = list(
list(
y = ~ constructed_indicator[["KAMA"]][
diff --git a/R/ta_MACD.R b/R/ta_MACD.R
index 783f82a0..0dd3b8bf 100644
--- a/R/ta_MACD.R
+++ b/R/ta_MACD.R
@@ -223,6 +223,12 @@ moving_average_convergence_divergence.plotly <- function(
signal = signal
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -252,8 +258,8 @@ moving_average_convergence_divergence.plotly <- function(
y = ~MACDHist,
color = ~direction,
colors = c(
- chart_theme$bull_color,
- chart_theme$bear_color
+ .chart_variables$bullish_body,
+ .chart_variables$bearish_body
),
type = 'bar',
mode = NULL,
@@ -279,27 +285,31 @@ moving_average_convergence_divergence.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Moving Average Convergence Divergence"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Moving Average Convergence Divergence"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_MACDEXT.R b/R/ta_MACDEXT.R
index 070c1728..09d19e66 100644
--- a/R/ta_MACDEXT.R
+++ b/R/ta_MACDEXT.R
@@ -229,6 +229,12 @@ extended_moving_average_convergence_divergence.plotly <- function(
signal = signal
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -258,8 +264,8 @@ extended_moving_average_convergence_divergence.plotly <- function(
y = ~MACDHist,
color = ~direction,
colors = c(
- chart_theme$bull_color,
- chart_theme$bear_color
+ .chart_variables$bullish_body,
+ .chart_variables$bearish_body
),
type = 'bar',
mode = NULL,
@@ -285,27 +291,31 @@ extended_moving_average_convergence_divergence.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Moving Average Convergence Divergence (Extended)"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Moving Average Convergence Divergence (Extended)"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_MACDFIX.R b/R/ta_MACDFIX.R
index 9f9d046a..7b109511 100644
--- a/R/ta_MACDFIX.R
+++ b/R/ta_MACDFIX.R
@@ -199,6 +199,12 @@ fixed_moving_average_convergence_divergence.plotly <- function(
signal = signal
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -226,8 +232,8 @@ fixed_moving_average_convergence_divergence.plotly <- function(
y = ~MACDHist,
color = ~direction,
colors = c(
- chart_theme$bull_color,
- chart_theme$bear_color
+ .chart_variables$bullish_body,
+ .chart_variables$bearish_body
),
type = 'bar',
mode = NULL,
@@ -253,27 +259,31 @@ fixed_moving_average_convergence_divergence.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Moving Average Convergence Divergence (Fixed)"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Moving Average Convergence Divergence (Fixed)"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_MAMA.R b/R/ta_MAMA.R
index df458b9c..adf50e0f 100644
--- a/R/ta_MAMA.R
+++ b/R/ta_MAMA.R
@@ -206,8 +206,8 @@ mesa_adaptive_moving_average.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = list(
list(
y = ~ constructed_indicator[["MAMA"]][
diff --git a/R/ta_MFI.R b/R/ta_MFI.R
index 0dffa5b3..bc46691f 100644
--- a/R/ta_MFI.R
+++ b/R/ta_MFI.R
@@ -160,6 +160,12 @@ money_flow_index.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -179,27 +185,31 @@ money_flow_index.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Money Flow Index"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Money Flow Index"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_MINUS_DI.R b/R/ta_MINUS_DI.R
index 204fce36..b5943539 100644
--- a/R/ta_MINUS_DI.R
+++ b/R/ta_MINUS_DI.R
@@ -157,6 +157,12 @@ minus_directional_indicator.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -171,27 +177,31 @@ minus_directional_indicator.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Minus Directional Indicator"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Minus Directional Indicator"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_MINUS_DM.R b/R/ta_MINUS_DM.R
index bb1afd3f..970b498a 100644
--- a/R/ta_MINUS_DM.R
+++ b/R/ta_MINUS_DM.R
@@ -156,6 +156,12 @@ minus_directional_movement.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -170,27 +176,31 @@ minus_directional_movement.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Minus Directional Movement"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Minus Directional Movement"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_MOM.R b/R/ta_MOM.R
index 9c1e4c95..bbe8b207 100644
--- a/R/ta_MOM.R
+++ b/R/ta_MOM.R
@@ -198,6 +198,12 @@ momentum.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -215,27 +221,31 @@ momentum.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Momentum"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Momentum"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_NATR.R b/R/ta_NATR.R
index 4904202c..e6080d97 100644
--- a/R/ta_NATR.R
+++ b/R/ta_NATR.R
@@ -157,6 +157,12 @@ normalized_average_true_range.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -170,27 +176,31 @@ normalized_average_true_range.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Normalized Average True Range"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Normalized Average True Range"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_OBV.R b/R/ta_OBV.R
index 2bbd302f..7679c39e 100644
--- a/R/ta_OBV.R
+++ b/R/ta_OBV.R
@@ -147,6 +147,12 @@ on_balance_volume.plotly <- function(
)
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -158,27 +164,31 @@ on_balance_volume.plotly <- function(
traces <- list(list(y = ~OBV))
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "On-Balance Volume"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "On-Balance Volume"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_PLUS_DI.R b/R/ta_PLUS_DI.R
index 048b039e..7fbd5c89 100644
--- a/R/ta_PLUS_DI.R
+++ b/R/ta_PLUS_DI.R
@@ -157,6 +157,12 @@ plus_directional_indicator.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -171,27 +177,31 @@ plus_directional_indicator.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Plus Directional Indicator"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Plus Directional Indicator"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_PLUS_DM.R b/R/ta_PLUS_DM.R
index fd97d398..66134875 100644
--- a/R/ta_PLUS_DM.R
+++ b/R/ta_PLUS_DM.R
@@ -156,6 +156,12 @@ plus_directional_movement.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -170,27 +176,31 @@ plus_directional_movement.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Plus Directional Movement"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Plus Directional Movement"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_PPO.R b/R/ta_PPO.R
index a4d2dcd7..803f4b43 100644
--- a/R/ta_PPO.R
+++ b/R/ta_PPO.R
@@ -223,6 +223,12 @@ percentage_price_oscillator.plotly <- function(
ma = ma
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -241,27 +247,31 @@ percentage_price_oscillator.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Percentage Price Oscillator"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Percentage Price Oscillator"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_ROC.R b/R/ta_ROC.R
index 7ec926a1..29c1c89e 100644
--- a/R/ta_ROC.R
+++ b/R/ta_ROC.R
@@ -198,6 +198,12 @@ rate_of_change.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -217,27 +223,31 @@ rate_of_change.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Rate of Change"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Rate of Change"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_ROCR.R b/R/ta_ROCR.R
index 5d5f9efc..40c5f32f 100644
--- a/R/ta_ROCR.R
+++ b/R/ta_ROCR.R
@@ -198,6 +198,12 @@ ratio_of_change.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -217,27 +223,31 @@ ratio_of_change.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Ratio of Change"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Ratio of Change"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_RSI.R b/R/ta_RSI.R
index d312942a..e1cbfad0 100644
--- a/R/ta_RSI.R
+++ b/R/ta_RSI.R
@@ -200,6 +200,12 @@ relative_strength_index.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -223,27 +229,31 @@ relative_strength_index.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Relative Strength Index"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Relative Strength Index"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_SAR.R b/R/ta_SAR.R
index af5fb6c2..775a1e4f 100644
--- a/R/ta_SAR.R
+++ b/R/ta_SAR.R
@@ -175,38 +175,46 @@ parabolic_stop_and_reverse.plotly <- function(
## splice:plotly-assembly:start
## identify bullish
## signals
- bull <- (constructed_indicator$SAR < as.numeric(constructed_series[[2L]]))
+ bull <- (constructed_indicator$SAR[
+ -c(1:attr(constructed_indicator, "lookback"))
+ ] <
+ as.numeric(
+ constructed_series[[2L]][
+ -c(1:attr(constructed_indicator, "lookback"))
+ ]
+ ))
chart_theme <- .chart_theme()
## determine colors
##
colors <- ifelse(
bull,
- plotly::toRGB(chart_theme$bull_color, alpha = 0.8),
- plotly::toRGB(chart_theme$bear_color, alpha = 0.8)
+ plotly::toRGB(.chart_variables$bullish_body, alpha = 0.8),
+ plotly::toRGB(.chart_variables$bearish_body <- "#A9A9A9", alpha = 0.8)
)
## constuct chart
## element
- name <- "SAR"
+ name <- "Parabolic Stop and Reverse"
traces <- list(
list(
y = ~SAR,
type = "scatter",
mode = "markers",
+ color = colors,
marker = list(
size = 5,
color = colors,
line = list(
color = "black",
- width = 1
+ width = 0.75
)
)
)
)
## splice:plotly-assembly:end
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = traces,
decorators = list(),
name = get0(
diff --git a/R/ta_SAREXT.R b/R/ta_SAREXT.R
index 530dd5cb..2b527abc 100644
--- a/R/ta_SAREXT.R
+++ b/R/ta_SAREXT.R
@@ -235,38 +235,46 @@ extended_parabolic_stop_and_reverse.plotly <- function(
## splice:plotly-assembly:start
## identify bullish
## signals
- bull <- (constructed_indicator$SAR < as.numeric(constructed_series[[2L]]))
+ bull <- (constructed_indicator$SAR[
+ -c(1:attr(constructed_indicator, "lookback"))
+ ] <
+ as.numeric(
+ constructed_series[[2L]][
+ -c(1:attr(constructed_indicator, "lookback"))
+ ]
+ ))
chart_theme <- .chart_theme()
## determine colors
##
colors <- ifelse(
bull,
- plotly::toRGB(chart_theme$bull_color, alpha = 0.8),
- plotly::toRGB(chart_theme$bear_color, alpha = 0.8)
+ plotly::toRGB(.chart_variables$bullish_body, alpha = 0.8),
+ plotly::toRGB(.chart_variables$bearish_body <- "#A9A9A9", alpha = 0.8)
)
## constuct chart
## element
- name <- "SAR"
+ name <- "Parabolic Stop and Reverse (Extended)"
traces <- list(
list(
y = ~SAREXT,
type = "scatter",
mode = "markers",
+ color = colors,
marker = list(
size = 5,
color = colors,
line = list(
color = "black",
- width = 1
+ width = 0.75
)
)
)
)
## splice:plotly-assembly:end
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = traces,
decorators = list(),
name = get0(
diff --git a/R/ta_SMA.R b/R/ta_SMA.R
index 04d279cc..389f3e71 100644
--- a/R/ta_SMA.R
+++ b/R/ta_SMA.R
@@ -206,8 +206,8 @@ simple_moving_average.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = list(
list(
y = ~ constructed_indicator[["SMA"]][
diff --git a/R/ta_STOCH.R b/R/ta_STOCH.R
index a74ddb79..61f80786 100644
--- a/R/ta_STOCH.R
+++ b/R/ta_STOCH.R
@@ -182,6 +182,12 @@ stochastic.plotly <- function(
slowd = slowd
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -206,27 +212,31 @@ stochastic.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Stochastic"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Stochastic"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_STOCHF.R b/R/ta_STOCHF.R
index bcd4f560..31f8caad 100644
--- a/R/ta_STOCHF.R
+++ b/R/ta_STOCHF.R
@@ -171,6 +171,12 @@ fast_stochastic.plotly <- function(
fastd = fastd
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -193,27 +199,31 @@ fast_stochastic.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Fast Stochastic"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Fast Stochastic"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_STOCHRSI.R b/R/ta_STOCHRSI.R
index 2aa24a37..ef9f5752 100644
--- a/R/ta_STOCHRSI.R
+++ b/R/ta_STOCHRSI.R
@@ -190,6 +190,12 @@ stochastic_relative_strength_index.plotly <- function(
fastd = fastd
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -197,7 +203,7 @@ stochastic_relative_strength_index.plotly <- function(
## construct {plotly}-object
## splice:plotly-assembly:start
- name <- ""
+ name <- "Stochastic Relative Strength Index"
decorators <- list(
function(p) add_limit(p, y_range = c(0, 100))
@@ -206,32 +212,36 @@ stochastic_relative_strength_index.plotly <- function(
traces <- list(
plotly_line(lower_bound),
plotly_line(upper_bound),
- list(y = ~FastK),
- list(y = ~FastD)
+ list(y = ~FastK, name = "Fast %K"),
+ list(y = ~FastD, name = "Fast %D")
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Stochastic Relative Strength Index"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Stochastic Relative Strength Index"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_T3.R b/R/ta_T3.R
index ea2fd171..b1295507 100644
--- a/R/ta_T3.R
+++ b/R/ta_T3.R
@@ -206,8 +206,8 @@ t3_exponential_moving_average.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = list(
list(
y = ~ constructed_indicator[["T3"]][
diff --git a/R/ta_TEMA.R b/R/ta_TEMA.R
index 0d6c7f0f..5fd4285c 100644
--- a/R/ta_TEMA.R
+++ b/R/ta_TEMA.R
@@ -206,8 +206,8 @@ triple_exponential_moving_average.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = list(
list(
y = ~ constructed_indicator[["TEMA"]][
diff --git a/R/ta_TRANGE.R b/R/ta_TRANGE.R
index e6d66595..70c54f3a 100644
--- a/R/ta_TRANGE.R
+++ b/R/ta_TRANGE.R
@@ -148,6 +148,12 @@ true_range.plotly <- function(
)
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -162,27 +168,31 @@ true_range.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "True Range"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "True Range"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_TRIMA.R b/R/ta_TRIMA.R
index 45325890..3803a0e8 100644
--- a/R/ta_TRIMA.R
+++ b/R/ta_TRIMA.R
@@ -206,8 +206,8 @@ triangular_moving_average.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = list(
list(
y = ~ constructed_indicator[["TRIMA"]][
diff --git a/R/ta_TRIX.R b/R/ta_TRIX.R
index e3c73eee..d3814acd 100644
--- a/R/ta_TRIX.R
+++ b/R/ta_TRIX.R
@@ -198,6 +198,12 @@ triple_exponential_average.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -212,27 +218,31 @@ triple_exponential_average.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Triple Exponential Average"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Triple Exponential Average"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_ULTOSC.R b/R/ta_ULTOSC.R
index 8b5bef85..3ab88451 100644
--- a/R/ta_ULTOSC.R
+++ b/R/ta_ULTOSC.R
@@ -161,6 +161,12 @@ ultimate_oscillator.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -186,27 +192,31 @@ ultimate_oscillator.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Ultimate Oscillator"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Ultimate Oscillator"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_VOLUME.R b/R/ta_VOLUME.R
index 011f34af..912cd80e 100644
--- a/R/ta_VOLUME.R
+++ b/R/ta_VOLUME.R
@@ -206,6 +206,12 @@ trading_volume.plotly <- function(
ma = ma
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -242,7 +248,14 @@ trading_volume.plotly <- function(
y = stats::as.formula(
paste0("~", col)
),
- name = col
+
+ ## reformat extract SMA17 as SMA(17)
+ name = sub(
+ "^([A-Za-z]+)([0-9]+)$",
+ "\\1(\\2)",
+ col,
+ perl = TRUE
+ )
)
}
)
@@ -251,34 +264,39 @@ trading_volume.plotly <- function(
## assuming its volume
traces[[1]]$color <- ~direction
traces[[1]]$colors = c(
- chart_theme$bull_color,
- chart_theme$bear_color
+ .chart_variables$bullish_body,
+ .chart_variables$bearish_body
)
+ traces[[1]]$showlegend <- FALSE
traces[[1]]$type <- 'bar'
traces[[1]]["mode"] <- list(NULL)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Trading Volume"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Trading Volume"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_WILLR.R b/R/ta_WILLR.R
index 199a635b..3697b309 100644
--- a/R/ta_WILLR.R
+++ b/R/ta_WILLR.R
@@ -159,6 +159,12 @@ williams_oscillator.plotly <- function(
n = n
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -179,27 +185,31 @@ williams_oscillator.plotly <- function(
)
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
- init = plotly_init(),
- traces = traces,
- decorators = get0(
- x = "decorators",
- ifnotfound = list()
- ),
- name = get0(
- x = "name",
- ifnotfound = NULL
+ plotly_object <- add_last_value(
+ build_plotly(
+ init = plotly_init(),
+ traces = traces,
+ decorators = get0(
+ x = "decorators",
+ ifnotfound = list()
+ ),
+ name = get0(
+ x = "name",
+ ifnotfound = NULL
+ ),
+ data = constructed_indicator,
+ title = if (missing(title)) {
+ "Williams %R"
+ } else {
+ title
+ }
),
- data = constructed_indicator,
- title = if (missing(title)) {
- "Williams %R"
- } else {
- title
- }
+ data = constructed_indicator[, values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
)
- .plotting_environment$sub <- c(
- .plotting_environment$sub,
+ .chart_environment$sub <- c(
+ .chart_environment$sub,
list(plotly_object)
)
diff --git a/R/ta_WMA.R b/R/ta_WMA.R
index 83daaa75..cf4eca68 100644
--- a/R/ta_WMA.R
+++ b/R/ta_WMA.R
@@ -206,8 +206,8 @@ weighted_moving_average.plotly <- function(
)
## construct {plotly}-object
- plotly_object <- .plotting_environment[["main"]] <- build_plotly(
- init = .plotting_environment[["main"]],
+ plotly_object <- .chart_environment[["main"]] <- build_plotly(
+ init = .chart_environment[["main"]],
traces = list(
list(
y = ~ constructed_indicator[["WMA"]][
diff --git a/R/zzz.R b/R/zzz.R
index f06a82cf..6963ed2b 100644
--- a/R/zzz.R
+++ b/R/zzz.R
@@ -6,10 +6,47 @@
## initialize plotting
## environment
-.plotting_environment <- new.env(
+.chart_environment <- new.env(
parent = emptyenv()
)
+## initialize theme
+## environment
+.chart_variables <- new.env(
+ parent = emptyenv()
+)
+
+## set default theme
+## candle-colors
+.chart_variables$bearish_body <- "#4682B4"
+.chart_variables$bearish_wick <- "#4682B4"
+.chart_variables$bearish_border <- "#3B6A93"
+.chart_variables$bullish_body <- "#E0FFFF"
+.chart_variables$bullish_wick <- "#E0FFFF"
+.chart_variables$bullish_border <- "#C0D9D9"
+
+## general-colors
+.chart_variables$background_color <- "#141414"
+.chart_variables$foreground_color <- "#E0FFFF"
+.chart_variables$text_color <- "#E0FFFF"
+
+## colorway
+.chart_variables$colorway <- c(
+ "#E0FFFF",
+ "#B5F3FF",
+ "#7DD3FC",
+ "#5BC0EB",
+ "#4682B4",
+ "#2E86AB",
+ "#00B3B8",
+ "#44D7B6",
+ "#C792EA",
+ "#F6C177"
+)
+
+## gridcolor
+.chart_variables$gridcolor <- "#232A30"
+
## actions on attach
## and load
.onAttach <- function(
@@ -23,6 +60,17 @@
"initialize_ta_lib",
PACKAGE = pkgname
)
+
+ ## startup message when
+ ## library(talib)
+ packageStartupMessage(
+ paste0(
+ "Loading {",
+ utils::packageName(),
+ "} v",
+ utils::packageVersion(pkgname)
+ )
+ )
}
.onLoad <- function(
diff --git a/_pkgdown.yml b/_pkgdown.yml
index 6eafe464..f328b4ef 100644
--- a/_pkgdown.yml
+++ b/_pkgdown.yml
@@ -44,6 +44,10 @@ reference:
contents:
- chart
- indicator
+- title: Chart Themes
+ desc: |
+ Charting Themes
+ contents: has_concept('Chart Themes')
- title: Rolling Statistics
desc: |
The collection of Rolling Statistics.
diff --git a/man-roxygen/description.R b/man-roxygen/description.R
index c953deab..a2cbbe5e 100644
--- a/man-roxygen/description.R
+++ b/man-roxygen/description.R
@@ -10,6 +10,12 @@
#' `<%= tolower(.fun) %>()` also accepts a [double] vector in which case the indicator is calculated 'as-is' without passing through [model.frame]. `<%= tolower(.fun) %>()` returns an `n` by `k` [matrix] computed in C by default. When `k = 1`, the result is simplified to a [double] vector; for `k > 1`, the full `n` by `k` [matrix] is returned.
#'
<% } %>
+#'
+#' ## Handling of -values
+#'
+#' `<%= tolower(.fun) %>()` iterates over valid values, and returns `NA` for the remaing part of series.
+#'
+#'
#' @param x An OHLC-V series that is coercible to [data.frame].
<% if (n_vars == 1) { %>
#' Alternatively, `x` may also be supplied as a [double] vector.
diff --git a/man-roxygen/rolling_description.R b/man-roxygen/rolling_description.R
index 08b1c90b..805c413f 100644
--- a/man-roxygen/rolling_description.R
+++ b/man-roxygen/rolling_description.R
@@ -1,6 +1,11 @@
#' @description
#' The `<%= tolower(.fun) %>()` is a generic S3 function that builds upon 'type-safe'-esque workflows limited to classes in in base `R`, and the package-wide dependencies. Ie. [class] in, [class] out.
#'
+#' ## Handling of -values
+#'
+#' `<%= tolower(.fun) %>()` iterates over valid values, and returns `NA` for the remaing part of series.
+#'
+#'
<%
if (all(c("x","y") %in% names(formals(.fun))))
{ %>
diff --git a/man/figures/README-charting-1.png b/man/figures/README-charting-1.png
index da47efb1..0ea5062d 100644
Binary files a/man/figures/README-charting-1.png and b/man/figures/README-charting-1.png differ
diff --git a/tests/testthat/test-charting.R b/tests/testthat/test-charting.R
index b2748fc8..9451658d 100644
--- a/tests/testthat/test-charting.R
+++ b/tests/testthat/test-charting.R
@@ -32,3 +32,35 @@ testthat::test_that(desc = "Charting", code = {
}
)
})
+
+## test charting with themes
+testthat::test_that(desc = "Charting with Themes", code = {
+ ## 1) test chart with set_theme()
+ testthat::expect_no_error(
+ {
+ set_theme$hawks_and_doves()
+ chart(SPY)
+ }
+ )
+
+ testthat::expect_no_error(
+ {
+ set_theme$payout()
+ chart(SPY)
+ }
+ )
+
+ testthat::expect_no_error(
+ {
+ set_theme$tp_slapped()
+ chart(SPY)
+ }
+ )
+
+ testthat::expect_no_error(
+ {
+ set_theme$trust_the_process()
+ chart(SPY)
+ }
+ )
+})
diff --git a/tests/testthat/test-pkg.R b/tests/testthat/test-pkg.R
index 35d0f546..6acbba48 100644
--- a/tests/testthat/test-pkg.R
+++ b/tests/testthat/test-pkg.R
@@ -2,7 +2,7 @@
## unloads
testthat::test_that(desc = "TA-Lib unloads without error", code = {
## 1) unload without error
- testthat::expect_no_condition(
+ testthat::expect_no_error(
detach("package:talib")
)
})
@@ -11,7 +11,9 @@ testthat::test_that(desc = "TA-Lib unloads without error", code = {
## loads (NOTE: The order matters here because the package is already loaded when the tests are run, and gets unloaded above)
testthat::test_that(desc = "TA-Lib loads without error", code = {
## 1) load without error
- testthat::expect_no_condition(
- library("talib")
+ testthat::expect_no_error(
+ suppressPackageStartupMessages(
+ library("talib")
+ )
)
})
diff --git a/tools/templates/plotly_subchart_template.R.in b/tools/templates/plotly_subchart_template.R.in
index 460eca01..57cf52d5 100644
--- a/tools/templates/plotly_subchart_template.R.in
+++ b/tools/templates/plotly_subchart_template.R.in
@@ -39,6 +39,12 @@ ${FUN}.plotly <- function(
${PPARGS}
)
+ ## the constructed indicator
+ ## always returns excpected
+ ## columns which can be passed
+ ## down to add_last_values()
+ values_to_extract <- colnames(constructed_indicator)
+
## add conditional idx
constructed_indicator[["idx"]] <- add_idx(
constructed_series
@@ -49,7 +55,8 @@ ${FUN}.plotly <- function(
## initial scaffold
## splice:plotly-assembly:end
- plotly_object <- build_plotly(
+ plotly_object <- add_last_value(
+ build_plotly(
init = plotly_init(),
traces = traces,
decorators = get0(
@@ -62,7 +69,10 @@ ${FUN}.plotly <- function(
),
data = constructed_indicator,
title = if (missing(title)) {"${TITLE}"} else {title}
- )
+ ),
+ data = constructed_indicator[,values_to_extract, drop = FALSE],
+ values_to_extract = values_to_extract
+ )
.plotting_environment$sub <- c(
.plotting_environment$sub,