Displaying 20 results from an estimated 600 matches similar to: "Working with quantmod chartSeries and plot.zoo"
2011 May 05
1
quantmod's addTA plotting functions
Hi,
I'm having trouble with quantmod's addTA plotting functions. They seem to
work fine when run from the command line. But when run inside a function,
only the last one run is visible. Here's an example.
test.addTA <- function(from = "2010-06-01") {
getSymbols("^GSPC", from = from)
GSPC.close <- GSPC[,"GSPC.Close"]
GSPC.EMA.3
2011 Dec 22
1
Trying to use chartSeries in quantmod
> colnames = c("date","price")
> data = read.csv(file="data.csv", sep=",", header=F, nrows=261, skip=5, col.names=colnames)
> library(quantmod)
> data
date price
1 2011-12-18 13.7825
2 2011-12-11 13.5500
...
...
...
259 2007-01-07 10.8256
260 2006-12-31 10.8531
261 2006-12-24 10.8169
# Here's where I would like to use
2011 May 07
2
Convenience-at-the-expense-of-clarity (was: quantmod's addTA plotting functions)
Thanks, Writing plot(addTA()) worked fine.
I find myself with such mixed feelings about R. After finding that addTA
worked fine at the command line but not in a function, I puzzled for a long
time about what kind of virtual machine structure could possibly account for
that. I couldn't think of any.
It turns out that this isn't due to an R virtual machine structure. The
reason addTA adds
2010 Nov 21
1
abline(h=whatever) not working in candleChart() (in quantmod)?
Hello, all--
I am having some fun playing with the graphing in quantmod-- very nice! I am
writing a function to calculate (and hopefully plot) support and resistance
lines, but the usual plot call of "abline(h=value)" does not seem to work.
Here's my code:
require(quantmod)
AAPL<-getYahooData("AAPL")
candleChart(AAPL,subset="last 3
2016 Apr 09
1
Quantmod abline and axis configuration
Hi all,
I have this code
I want to add two ablines like this
abline(h=2400, lty=3, col="lightgrey")
abline(h=400, lty=3, col="lightgrey")
But doesnt wotk.
I alo try to set ylim from 0 to max "Foa"+1000 but I?m not able ?Is it
posible?
require(latticeExtra)
require(ggplot2)
require(reshape2)
suppressPackageStartupMessages(require(googleVis))
require(quantmod)
2011 Oct 20
4
quantmod package
i am new to the quantmod package . so if the answer is trivial please excuse
me. i want to study stock values within a day. i get current stock updates
using getQuotes and then want to produce usual quantmod graphs with that
values. also the graph should be able of adding technical indicators. please
help. in addition it will be helpful if anyone suggests how to run that code
continuously to get
2011 Apr 29
1
Handling of irregular time series in lineChart
Hi,
I realized that when I have irregular series to feed into lineChart,
the interval of each point in the chart does not seem to take care of
irregular time interval I specified in my input xts time series. But
rather, lineChart seems to take each point as equal spaced time
series. For example, I have the following code:
library(quantmod)
options(digits.sec=3)
t0 <-
2010 Nov 14
0
problem with chartSeries
Hi All,
I came across some trouble with this function when trying to plot intraday
data. I can't manage to plot candelsticks I get a line instead and I don't
understand why. I put below data sample and code.
> head(x)
open high low close
2010-10-27 08:59:59 13821 13824 13818 13824
2010-10-27 09:05:00 13823 13830 13823 13830
2010-10-27 09:09:59
2011 Nov 20
2
Continuasly Compunded Returns with quantmod-data
Hey guys,
i want to calculate the continuasly compounded returns for stock prices.
Formula for CCR:
R_t = ln(P_t/P_{t-1})*100
With R:
First i have to modify the vectors, so that they have the same length
and we start at the second observation.
log(GOOG1[-1]/GOOG1[1:length(GOOG1)-1])*100
That does work with normal vectors.
My Questions:
1) I want to use this for stock prices.
so i
2010 Nov 18
1
Accessing variables inside a namespace
Hello Group,
I am trying to see if there is way to access data that is inside another
namespace.
For e.g. the addATR function in the quantmod package calculates the ATR
using the TTR package and then plots it to the graph.
Now since it has already calculated the info that I need, can I access that
data which if I look at the function code is stored in a variable called
"atr"
2010 Aug 15
2
Adding colored background area to a time series plot
Hi,
I am trying to add a rectangular colored background area to a plot of a time series of relative price changes. I believe that what I'm trying to do is very similar to the question and example given here:
http://www.mail-archive.com/r-help at stat.math.ethz.ch/msg73948.html
http://www.mayin.org/ajayshah/KB/R/html/g5.html
My problem/difference is that my time series looks like so:
>
2011 Jul 26
1
intraday plot and gaps in data
Hi,
I have an intraday timeseries of financial data (see below) which has gaps
due to market opening and closing hours. I am trying to plot it, but the
time gap is always visible in the plot. I tried converting data to xts, zoo,
timeSeries and plotting it with different functions i.e. plot.xts, plot.zoo.
The only way to make it work was with function 'chartSeries' in the quantmod
package
2007 Mar 07
3
Plotting a broken line?
Hi,
Is there a smart way in the R graphs to create a line that is broken in
intervals based on the indicator given below.
following is a small test graph
Location,indicator,otherinfo
1.2,1,2.2
2.5,1,2.5
3.7,1,2.3
20.1,2,4.3
22.5,2,5.2
25.0,2,3.4
27.3,2,2.2
35.1,3,3.4
37.0,3,7.2
38.0,3,6.1
40.1,3,5.4
52.9,3,3.3
Right now in the plot the line is continuous, but I would like to have
it broken
2012 Sep 04
1
Producing a SMA signal when closing price is above the moving average for 3 days
I have loaded price data for GE and then calculated a 50 day simple moving
average. Then I have a created a ifelse statement that produce a 1 when
GE's closing price is above the simple moving average and a 0 when GE
Closing price is below the 50 day simple moving average.
However, what I really want to do is to produce a 1 for when the price is
above the simple moving average for 3 days
2008 Apr 18
1
ts.plot() labeling x-axis
Hello,
I have tried a few variants of a solution from the previous posts, but
perhaps my syntax is wrong. I am using ts.plot(data_as_columns) and
would like the label the x axis using some labels (in my case minutes
after 9am).
Any ideas how to use the plot params and the Axis function to accomplish
this?
Any help is very appreciated.
Regards,
Tom
2012 Oct 14
0
Asking help about drawing and saving candle chart automatically....
Hello,
I have trouble with saving and showing candlestick graph.
I want to draw daily 1-minute candle chart per each day and save it
repeatedly.
The data I saved and is used in my code is as the following format:
-----------------------------------------------------
Index,Open,High,Low,Close # header
2011-11-01 9:00:00 ,248.50,248.95,248.20,248.70
...
2011-11-01 15:15:00
2008 Mar 22
2
intraday OHLC plot
I want to create a open/high/low/last plot of intraday data.
I try to use the function plotOHLC from the tsteries package. I create
my own multiple time series and then try to plot it.
raw Data Format (file eurusd2.csv):
"Date (GMT)" "Open" "High" "Low" "Last"
17-03-2008 00:00:00 1,5764 1,5766 1,5747 1,5750
17-03-2008 00:05:00 1,5749 1,5750 1,5741
2018 Jan 18
0
Split charts with ggplot2, tidyquant
Hi Charlie,
I am comfortable to put the data in any way that works best. Here are two
possibilities: an xts and a data frame.
library(quantmod)
quantmod::getSymbols("SPY") # creates xts variable SPY
SPYxts <- SPY[,c("SPY.Close","SPY.Volume")]
SPYdf <- data.frame(Date=index(SPYxts),close=as.numeric(SPYxts$SPY.Close),
2011 Jun 23
1
Saved EPS does not match screen when using bquote(.(i))
Here's a fairly minimal-case example in which the saved EPS does not match
the screen. The error comes when using bquote(.(i)) instead of bquote(1), as
demonstrated by the two minimally different cases below. Very strange. Any
clues as to why?
#---------------- begin -------------------
# Version A. X axis labels have subscripts as constants. EPS is correct.
windows()
layout( matrix( 1:2 ,
2018 Jan 18
3
Split charts with ggplot2, tidyquant
Could you provide some information on your data structure (e.g., are the
two time series in separate columns in the data)? The solution is fairly
straightforward once you have the data in the right structure. And I do
not think tidyquant is necessary for what you want.
Best,
Charlie
--
Charles Redmon
GRA, Center for Research Methods and Data Analysis
PhD Student, Department of Linguistics