Skip to content

New to R and Finance, backtest etc.

10 messages · G See, julien cuisinier, Alex Grund +5 more

#
Hi Julien,

thank you for the link to Brian Peterson's work. I played around with
the code, but some things do not work correctly.
Maybe you know, how to fix them:

The main problem is caused by this line:

`  out <- try(applyStrategy(strategy='s' , portfolios='faber'))

which, obviously, is the most important line :-) The error message I get is:

`  Error in if (length(j) == 0 || (length(j) == 1 && j == 0)) { :
`  Fehlender Wert, wo TRUE/FALSE n?tig ist (translates to: "Missing
value, where TRUE/FALSE is required")

Since I did not modify the code from the PDF I think this may be a bug
in the software or a missing line of code in the PDF.
However, help is really appreciated!

"tradeStats('faber')" of course, returns NULL.
"chart.Posn('faber')" gives this error:
`  Fehler in .Internal(get(x, envir, mode, inherits)) : 'x' fehlt
(translates to: error in ~: 'x' missing)

However, I have a veriable called x in my workspace, which is
displayed with "ls()", and it's non-empty:

`  > x[1]
`             XLU.Open XLU.High XLU.Low XLU.Close XLU.Volume XLU.Adjusted
`  1998-12-31    30.25    30.83   29.64     30.23     162900        20.12


Thank you very much!

Alex.


2011/6/19 julien cuisinier <J_Cuisinier at hotmail.com>:
#
The slide code should work, but the full Faber demo is available with
either

demo('faber')

or you can find the file in the demos directory or here:

https://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/quantstrat/demo/faber.R?root=blotter

If you have problems with the demo code, we'll try to sort it out.

Regards,

   - Brian
On Sun, 2011-06-19 at 13:40 +0200, Alex Grund wrote:

  
    
Me
#
Alex

once you have developed a strategy in 'quantstrat' and if you feel
adventurous and want to use it for live trading, I can (shamelessly)
recommend that you have a look at my 'qsiblive' download here.

http://censix.com

It may be of interest.

regards

Soren

  
    
#
A few years back (!) I was testing the then current implementation of
IBrokers for throughput.  At the time on a laptop I could see 10k+
messages a second in R max throughput.  Within the context of IB, that
is more than sufficient to handle the incoming data (given symbol
limits and IB's snapshot data approach (300ms or so aggregations on
'mkt data').

This would push a single core to a pretty high cpu utilization, but
easy enough to share data between procs with R.

The 'testing' would really depend on you are doing in terms of trade
logic.  All in all though, aside from real high freq stuff, you can
easily have R running logic and trades - at least if you can temper
the incoming data to something like IB provides.

In terms of 'yes or no' ... I think the best you can get is
'sometimes' (or 'most times' if you aren't looking at the order book
or full market)

Jeff

On Sun, Jun 19, 2011 at 8:44 AM, Ulrich Staudinger
<ustaudinger at gmail.com> wrote:

  
    
1 day later
Me
#
Hi

well, I am currently testing an intraday version of the 'qsiblive'
function collection. For now everything above the 30sec bars seems to be
working fine (looking at realTimeBars only). One has to be mindful of
indicator and signal calculations though. If these  slow things down to
much, using longer bars may be the only option, aside from optimizing the
indicator/signal processing (which certainly needs to be done at some
point in the future)

Soren

  
    
3 days later
#
Alex, 
I have had the same bug, and found that in line:
s <- add.signal(s, name="sigCrossover", arguments =
list(data=quote(mktdata), columns=c("Close","SMA"), relationship="gt"),
label="Cl.gt.SMA")

change 
columns=c("Close","SMA")
to
columns=c("Close","SMA10").

This bug was in a certain copy of the faber example only (don't remember
where I got that copy from).
Brian's latest link to a different copy of faber demo works fine.

Daniel

--
View this message in context: http://r.789695.n4.nabble.com/New-to-R-and-Finance-backtest-etc-tp3608005p3622522.html
Sent from the Rmetrics mailing list archive at Nabble.com.