Questions tagged [r]

An open source programming language and software environment for statistical computing and graphics.

R is available on a wide variety of UNIX platforms, Windows and MacOS, and can be downloaded from CRAN. It is an implementation of the S programming language combined with lexical scoping semantics inspired by Scheme. R was created by Ross Ihaka and Robert Gentleman and is now developed by the R Development Core Team. It is easily extended through a packaging system on CRAN.

262 questions
6
votes
2 answers

how do I loop through all the stocks with quantmod and ttr?

I just started with quantmod package. If I want to select stocks based on their recent performance, then I need to loop through all the stocks in, say, NYSE. So I need: get all the stock symbols select those symbols that do have data loop through…
breezeintopl
  • 255
  • 2
  • 3
  • 7
4
votes
2 answers

ROC: difference between discrete and continuous?

Using the ROC function in the R package TTR, there is a choice between continuous (the default) and discrete, but with no guidance on which you choose when. In the code the difference is: roc <- x/lag(x) - 1 versus: roc <- diff(log(x)) I admit my…
Darren Cook
  • 1,427
  • 1
  • 17
  • 26
3
votes
0 answers

Backtest pair trade strategy in R

I am looking for some tips on how to run a simple backtest on a pairtrading strategy intraday using eg. 30minute bars. I have calculated the spread, beta(=ratio/hedgeweight), and standard deviation. I tried treating the spread as a simple instrument…
nikke
  • 39
  • 1
  • 2
3
votes
1 answer

How can I get intra-day prices via API into R?

I am able to retrieve prices for IVV using this code library(quantmod) getSymbols("IVV") names(IVV) [1] "IVV.Open" "IVV.High" "IVV.Low" "IVV.Close" "IVV.Volume" [6] "IVV.Adjusted" Is it possible to use other…
userJT
  • 131
  • 2
3
votes
1 answer

Are all stocks and stock indexes just white noise

In the paper Super-Whiteness of Returns Spectra from Erhard Reschenhofer of University of Vienna it is commented the following "Until the late 70’s the spectral densities of stock returns and stock index returns exhibited a type of non-constancy…
Barnaby
  • 436
  • 5
  • 11
3
votes
1 answer

How to get a list of stocks symbol of a specific exchange?

Possible Duplicate: Where to download list of all common stocks traded on NYSE, NASDAQ and AMEX? Is it possible to download a list of stocks that belong to a specific exchange (e.g. NASDAQ, AMEX, NYSE)? The tseries package has a function to…
Dail
  • 389
  • 1
  • 3
  • 11
2
votes
0 answers

Issues with +100 symbols in Quantstrat, Erratic Trades

I've tested my code against individual symbols and very small groups of symbols. I'm finding the more symbols I add the fewer trades I get. For instance, if I just include the first five symbols, all of them seem to have at least one trade. If I…
timtrice
  • 121
  • 2
2
votes
0 answers

Ibrokers: reqMktData extremely slow when adding tickers

I am trying to snap prices in R for the latest price for a list of stocks (around 150). When I snap them for 2 stocks, it's almost instantaneous: tickers<- c("YHOO","AAPL") library("IBrokers") t_start<-Sys.time() tws <- twsConnect() …
1
vote
2 answers

Fractals indicator (Bill Williams) R Quantstrat

Hi has anyone seen or know how to create an indicator for fractals in quantstrat? fractals explained http://forex-indicators.net/bill-williams/fractals example code (only interested in type 1 fractal) http://forexsb.com/forum/topic/68/fractals/
GeV 126
  • 121
  • 3
1
vote
0 answers

comparison of speech signal processing and financial data

I have read that in speech signal processing analysis when voice is segmented in brief temporary segments the series segments transitions from being non stationary to stationary. My question is if this is also the case for financial data when this…
Barnaby
  • 436
  • 5
  • 11
1
vote
0 answers

R TTR/RSI does not behave like a Bloomberg RSI

The implementation of TTR:RSI differs slightly from the RSI calculated in Bloomberg, see more details here. I use in TTR the SMA, which simply calculates the mean, that is a walking window of: Sum of gains and losses over the 14 days (assuming…
Datageek
  • 521
  • 2
  • 8
  • 12