addVLine: Add vertical line to a quantmod chart

Description Usage Arguments Details Value Note References See Also Examples

View source: R/addVLine.R

Description

Adds a vertical line to the current quantmod chart

Usage

1
  addVLine(dtlist, on = -1, col = "blue", ...)

Arguments

dtlist

Plots a vertical line at given index. Alternatively, this can be one of the following strings: “secs”, “seconds”, “mins”, “minutes”, “hours”, “days”, “weeks”, “months”, “years”

on

panel to add vertical line on

col

color of the line

...

parameters to pass to addTA. (e.g. 'border=NA')

Details

If dtlist is a character string, a vertical line will be drawn at the end of the periods specified by dtlist which will be used as the on argument in a call to endpoints. (Not to be confused with the on argument of this function which is used to indicate which panel to plot the vertical line(s) on.) Therefore, if dtlist is character, it must be a valid value for the on argument of the endpoints function which (from endpoints help) include: “us” (microseconds), “microseconds”, “ms” (milliseconds), “milliseconds”, “secs” (seconds), “seconds”, “mins” (minutes), “minutes”, “hours”, “days”, “weeks”, “months”, “quarters”, and “years”.

Value

used for its side effect.

Note

Currently, this function is sort of a hack. It does not update the chob. So, if you use this function, then you will no longer be able to do things like zoomChart. There are a few variations of this function in the works.

References

https://stat.ethz.ch/pipermail/r-sig-finance/2009q2/004018.html

See Also

chartSeries, addTA

Examples

1
2
3
4
5
6
7
## Not run: 
getSymbols('SPY', src='yahoo', from='2011-01-01', to='2012-08-01')
chartSeries(SPY)
addVLine('months')
addVLine(index(SPY['2011-05-20::2011-05-25']))

## End(Not run)

qmao documentation built on May 2, 2019, 4:54 p.m.