Re: [R] Getting previous day data and implementing it for quantstrat

2015-08-12 Thread boredstoog via R-help
Sorry Joshua,
I just want diverse solutions for this answer. Sorry  for causing any
trouble or inconvenience for you. I am withdrawing my question from this
forum.



--
View this message in context: 
http://r.789695.n4.nabble.com/Getting-previous-day-data-and-implementing-it-for-quantstrat-tp4710978p4711014.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Getting previous day data and implementing it for quantstrat

2015-08-11 Thread boredstoog via R-help
I am a newbie and trying to create my own bactesting code after going through
demo(). I am using a *candle engulfing pattern* strategy and this is the
formula

buy=(close(1)  close) and (high(1)  high) and (low(1)  low)
sell=(close(1)  close) and (high(1)  high) and (low(1)  low)
**(1) represents previous day data*

How should i get previous day data for close,high and open for the previous
day?
How should i add indicators,rules and signals to this strategy.

This is my idea first create a signal using sig Formula and then add the
rules like this

BUYING
#adding signal
 strat1-add.signal(strat1,
 name=sigFormula,
 arguments = list(columns=c(Close,High,Low),
  formula = (close(1)  close) and (high(1)  high) and
(low(1)  low),
  label=trigger,
  cross=TRUE),
 label=Bullish engulfing)
#adding rule
strat1 - add.rule(strat1, name=ruleSignal,
arguments=list(sigcol=trigger, sigval=TRUE, orderqty=100,
ordertype=market, orderside=long, pricemethod=market), type=enter)

is this correct!

The biggest problem is how i get previous day data for close, high and low





--
View this message in context: 
http://r.789695.n4.nabble.com/Getting-previous-day-data-and-implementing-it-for-quantstrat-tp4710978.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] inbuilt crossover function for backtesting

2015-08-10 Thread boredstoog via R-help
Thanks Joshua for the quick reply to the mail and once more sorry for
bothering with another doubt. So i have modified your code :) for
backtesting and this is the code

*
library(quantmod)
library(tseries)
require(quantstrat)
library(PerformanceAnalytics)
sym - get(getSymbols('SPY'))[2013::]
sym$sma10 - SMA(Cl(sym),10) 
sym$sma30 - SMA(Cl(sym),30)
buy - sigCrossover(buy, SPY, c(sma10,sma30), gt) 
sell - sigCrossover(sell, SPY, c(sma30,sma10), lt) 
if (buy==TRUE){
sym$pos-1
} else if (sell==TRUE){
   sym$pos--1
} 
myReturn - lag(sym$pos) * dailyReturn(sym)
charts.PerformanceSummary(cbind(dailyReturn(sym),myReturn))*


But the above code is returing this error

*Error in if (buy == TRUE) { : missing value where TRUE/FALSE needed
In addition: Warning message:
In if (buy == TRUE) { :
  the condition has length  1 and only the first element will be used
 myReturn - lag(sym$pos) * dailyReturn(sym)
Error in hasTsp(x) : attempt to set an attribute on NULL
 charts.PerformanceSummary(cbind(dailyReturn(sym),myReturn))
Warning message:
In to_period(xx, period = on.opts[[period]], ...) :
  missing values removed from data*

Any idea what is hapennning



--
View this message in context: 
http://r.789695.n4.nabble.com/inbuilt-crossover-function-for-backtesting-tp4710918p4710949.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] inbuilt crossover function for backtesting

2015-08-10 Thread boredstoog via R-help
Josh,
I have found other demos on demo().. any way thanks for the help and for
supporting this project :)

boredstog



--
View this message in context: 
http://r.789695.n4.nabble.com/inbuilt-crossover-function-for-backtesting-tp4710918p4710962.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] inbuilt crossover function for backtesting

2015-08-10 Thread boredstoog via R-help
Hey thanks josh,
I was looking for such a demo programme can you point to some more such demo
programmes if available




--
View this message in context: 
http://r.789695.n4.nabble.com/inbuilt-crossover-function-for-backtesting-tp4710918p4710961.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Automatically updating a WordPress blog from R

2015-08-09 Thread boredstoog via R-help
I dont know whether this will help you because even I am also pretty new to R
but have some experience in web development. I would recommend you to read
about cron jobs . cron jobs automate your request and execute according to
your execution parameters (1 minute, 3.5 days etc)



--
View this message in context: 
http://r.789695.n4.nabble.com/Automatically-updating-a-WordPress-blog-from-R-tp4710914p4710919.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] inbuilt crossover function for backtesting

2015-08-09 Thread boredstoog via R-help
I am trying to built a simple moving average cross over strategy for
backtesting. I have installed TTR and quantmod, quantstrat for that purpose.
From TTR package we can get functions for sma,bolinger band and other
indicators. I want to know whether any inbuilt crossover function (not
greater '' or lesser '') is available for R.

Example

sma10-SMA(close,10)
sma30-SMA(close,30)

buy-Crossover(sma10,sma30)
sell-Crossover(sma30,sma10)






--
View this message in context: 
http://r.789695.n4.nabble.com/inbuilt-crossover-function-for-backtesting-tp4710918.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Cant upgrade R in ubuntu 14.04

2015-08-07 Thread boredstoog via R-help

I am trying to install R programming language and able to install rbase
using this code without adding repository in *source.list*

sudo apt-get install r-base

After that i tried to upgrade it using this code

sudo add-apt-repository ‘deb
http://star-www.st-andrews.ac.uk/cran/bin/linux/ubuntu/trusty/’
sudo apt-get update
sudo apt-get upgrade

But when i tried the first code

sudo add-apt-repository ‘deb
http://star-www.st-andrews.ac.uk/cran/bin/linux/ubuntu/trusty/’

its giving this error

Error: need a single repository as argument





--
View this message in context: 
http://r.789695.n4.nabble.com/Cant-upgrade-R-in-ubuntu-14-04-tp4710885.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.