Displaying 20 results from an estimated 2000 matches similar to: "Convenience-at-the-expense-of-clarity (was: quantmod's addTA plotting functions)"
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
2012 Dec 06
1
Fuction Error
I'm calling a list of symbols and then using a function to build a data
frame from that symbol list. It works great until I introduce this index
symbol from yahoo '^GSPC'. When and index symbol is introduced I get and
error which is below.
> Data <- symbolFrame(symbols)
Error in get(S) : object '^GSPC' not found
Since R does not like the ^ in front of a name it
2009 Aug 03
3
Help with data type
Hi there,
Using a quantmod function, I calculate the daily change between two points
in a time series. However, I don't think I am using the data correctly.
Code:
getSymbols("^GSPC", src="yahoo")
CloseData <- Cl(GSPC)
Delta <- diff(CloseData, lag=1)
for (i in 3:length(Delta)) {
if (Delta[i]>Delta[i-1]) sum <- sum + Delta
}
I can't seem to use the Delta
2012 Jul 27
1
Working with quantmod chartSeries and plot.zoo
Hi all,
I'm a newbie to R and it has been very helpful to use your website.
Unfortunately I've been struggling with my code now for two days so I wanted
to ask few questions. I've been trying to create nice graphs to put into a
pdf sheet but I'm having little problems with all the packages I've been
using. So what I want to accomplish is create one pdf sheet with three
graphs
2010 Mar 16
1
Simple for-loop runs out of memory
I have the following simple for-loop, which makes R crash every time. The
length of the vectors is about 1200 rows, 1 column.
n = max(length(GSPC),length(FTSE))
for(i in 1:1000)
{
if (row.names(GSPC)[i]==row.names(FTSE)[i]){
} else {
if (row.names(GSPC)[i]>row.names(FTSE)[i]){
GSPC<-rbind(GSPC[1:(i-1),],GSPC[(i-1):length(GSPC),])
row.names(GSPC)[i]=row.names(FTSE)[i]
} else {
2008 Sep 25
3
OHLC Plot with EMA in it
Hi there
I have some timeseries data which I plot in a OHLC Plot. In the same
plot I'd like to have the EMA of this timeseries. I tried to add the
EMA point to OHLC with lines(), but this doesn't work. Has anyone an
idea how to handle it?
Regards, Michael Zak
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 Jun 03
2
tkrplot Newbie
Hello,
I am trying to write a tcltk based program that plots/manipulates
xts/xoo time series objects.
I have the code I used from
## http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/tkrplot.html :
##
require(quantmod)
require(tcltk)
library(tkrplot)
Sys.setenv(TZ="GMT")
getSymbols("^GSPC", from = "1960-01-01")
Myhscale <- 2.5 # Horizontal scaling
2011 Nov 10
2
Error in axis ????
I did an update of both rstudio and my packages. I had some trouble but was
able to move a lot of the packages so most troubles seem to be behind me.
But having a problem with code that previously ran fine. See below:
require(quantmod)
Loading required package: quantmod
Loading required package: Defaults
Loading required package: xts
Loading required package: zoo
Attaching package: ?zoo?
The
2011 Apr 29
3
why doesn't ifelse work ?
I have the following lines of code:
ind <- rollapply(GSPC, 200, mean)
signal <- ifelse(diff(ind, 5) > 0 , 1 , -1)
signal[is.na(signal)] <- 0
I never get a value of -1 for signal even though I know diff(ind , 5) is
less than zero frequently. It looks like when diff(ind , 5) is less than
zero, signal gets set to 0 instead of - 1. Any ideas why ? Here's some
information on ind and
2010 Dec 02
1
Downloading quote data from yahoo finance
Hi R users,
Thanks in advance.
I am using R 2.12.0 on Windows XP.
May I request you to assist me in the following please.
1. I am getting error while downloading quote data from yahoo finance.
The example code is below (taken from tseries help):
library(tseries)
con <- url("http://quote.yahoo.com")
if(!inherits(try(open(con), silent = TRUE), "try-error")) {
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
2000 Feb 28
1
Parser Bug Somewhere.... (PR#460)
Full_Name: John P Cavanaugh
Version: .99
OS: linux
Submission from: (NULL) (24.116.10.99)
dataset$ema12 <- EMA (dataset$Close,12)
dataset$ema26 <- EMA (dataset$Close,26)
dataset$MACD_fast <- dataset$ema26 - dataset$ema12
dataset$MACD_slow <- EMA(dataset$MACD_fast,9)
dataset$MACD_hist <- dataset$MACD_fast - dataset$MACD_slow # This line doesnt
work!!!
But... if I does work if I
2012 May 21
1
Need help in doing EMA(Exponential Mean Average).
Can somebody help me in finding package/Example in R which could do
EMA(Exponential Mean Average).
I installed "TTR" package but the 'EMA" function which I was trying to use
is giving the following error.
Error: Could not find function "EMA"
Thanks & Regards,
Thomas
[[alternative HTML version deleted]]
2009 Jun 19
1
(FULL) Need help to optimize a piece of code involving zoo objects
(Sorry, sent the message before I finished it)
Hello, everyone
I have a long script that uses zoo objects. In this script I used
simple moving averages and these I can very efficiently calculate with
filter() functions.
Now, I have to use special "exponential" moving averages, and the only
way I could write the code was with a for-loop, which makes everything
extremely slow.
I don't
2012 Apr 05
1
is parallel computing possible for 'rollapplyr' job?
Hi,
The code below does exactly what I want in sequential mode. But, it is slow and I want to run it in parallel mode. I examined some windows version packages (parallel, snow, snowfall,..) but could not solve my specific problem. As far as I understood, either I have to write a new function like sfRollapplyr or I have to change my code in a way that it utilizes lapply, or sapply instead of
2009 Jun 19
1
Need help to optimize a piece of code involving zoo objects
Hello, everyone
I have a long script that uses zoo objects. In this script I used
simple moving averages and these I can very efficiently calculate with
filter() functions.
Now, I have to use special "exponential" moving averages, and the only
way I could write the code was with a for-loop, which makes everything
extremely slow.
I don't know how to optimize the code, but I need to
2012 Dec 12
1
EMA Package
Hi,
I'm currently using EMA package to make clustering and heatmaps.
The online doc concerning the package gives the following example code:
data(marty)
c<-clustering(marty, metric="pearson", method="ward")
clustering.plot(c, title="Hierarchical Clustering\nPearson-Ward")
which is working perfectly,
However, when I'm changing the method to
2007 Feb 08
1
Re : Re: setting a number of values to NA over a data.frame.
Hi again,
Awfully sorry John, I should have been sleeping and did not see your
full post....
here is a way, unless I miss the point again :
fake<-as.data.frame(cbind(seq(1,10,by=1),c(rep(1,4),rep(0,4),rep(2,2))))
# from my previous post
# one moree column this time !
fake3<-cbind(fake,fake$V2)
index<-c(2,3)
fake3[,index][fake3[,index]==0]<-NA
not nice, but seems to do the job.
2012 Mar 10
1
Generating abnormal returns in R
Hello
This is my first post on this forum and I hope someone can help me out.
I have a datafile (weeklyR) with returns of +- 100 companies.
I acquired this computing the following code:
library("tseries");
tickers = c("GSPC" , "BP" , "TOT" , "ENI.MI" , "VOW.BE" , "CS.PA" ,
"DAI.DE" , "ALV.DE" ,