<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
<META NAME="GENERATOR" CONTENT="GtkHTML/3.16.1">
</HEAD>
<BODY>
<FONT COLOR="#000000">Hmm, that didn't work either.</FONT><BR>
<BR>
<FONT COLOR="#000000">> addTA(xts(rep(TRUE,length(times)), times), on=-1, col="#333333", border=NA)</FONT><BR>
<FONT COLOR="#000000">Error in coredata(x)[lchob@xsubset, ] : incorrect number of dimensions</FONT><BR>
<FONT COLOR="#000000">In addition: Warning message:</FONT><BR>
<FONT COLOR="#000000">In merge.zoo(lchob@xdata, ta, fill = ifelse(is.logical(ta), 0, NA), :</FONT><BR>
<FONT COLOR="#000000"> Index vectors are of different classes: POSIXt Date integer integer</FONT><BR>
<BR>
<FONT COLOR="#000000">I couldn't peer into lchob to see wha the xsubset slot contained, but I did try using a different series for times</FONT><BR>
<FONT COLOR="#000000">> times <- index(QQQQ)</FONT><BR>
<BR>
<FONT COLOR="#000000">but I got the same error.</FONT><BR>
<BR>
<FONT COLOR="#000000">BTW is there any reason that the year is off by 1 year in the help pages? I noticed the same thing in the previous release.</FONT><BR>
<BR>
<FONT COLOR="#000000">Version: 0.3-7</FONT><BR>
<FONT COLOR="#000000">Date: 2007-11-17</FONT><BR>
<BR>
<FONT COLOR="#000000">Brian</FONT><BR>
<BR>
<BR>
----- Original message ----- <BR>
Sent: 2008/11/28 08:26:36 <BR>
Subject: Re:Re: Re: [R-SIG-Finance] Shaded regions as an indicator in quantmod <BR>
<BR>
Hi Brian, <BR>
<BR>
Try version 0.3-7 from CRAN (released last week sometime...) <BR>
<BR>
http://cran.r-project.org/web/packages/quantmod/index.html <BR>
<BR>
Jeff <BR>
<BR>
On Fri, Nov 28, 2008 at 6:28 AM, Brian Lee Yung Rowe wrote: <BR>
> Hi Jeff, <BR>
> <BR>
> This sounds promising, but I couldn't get it to work. <BR>
> <BR>
>> chartSeries(QQQQ) <BR>
>> times <- timeBasedSeq('20071001/2007') <BR>
>> addTA(xts(rep(TRUE,length(times)), times), on=-1, col="#333333", <BR>
>> border=NA) <BR>
> Warning message: <BR>
> In plot.xy(xy.coords(x, y), type = type, ...) : <BR>
> "border" is not a graphical parameter <BR>
>> addTA(xts(rep(TRUE,length(times)), times), on=-1, col="#333333") <BR>
> Warning message: <BR>
> In plot.xy(xy.coords(x, y), type = type, ...) : <BR>
> "border" is not a graphical parameter <BR>
> <BR>
> Re-executing the sequence without the border parameter removes the error <BR>
> message, but I don't see any bars. The series name does appear in the legend <BR>
> area, though. <BR>
> <BR>
>> chartSeries(QQQQ) <BR>
>> addTA(xts(rep(TRUE,length(times)), times), on=-1, col="#333333") <BR>
> <BR>
> I'm using version 0.3-6 revision 433. Any thoughts on what I'm doing wrong? <BR>
> <BR>
> Brian <BR>
> <BR>
> <BR>
> ----- Original message ----- <BR>
> Sent: 2008/11/27 17:58:54 <BR>
> Subject: Re:Re: [R-SIG-Finance] Shaded regions as an indicator in quantmod <BR>
> <BR>
> quantmod can do this now as well: <BR>
> <BR>
> If addTA is passed a logical vector of the same length as your series <BR>
> or passed an ?xtsible object of any length it will cause bands to be <BR>
> drawn. Points in the vector/time that are TRUE will be cause event <BR>
> blocks to be drawn on/under the series. <BR>
> <BR>
> An example: <BR>
> <BR>
>> library(quantmod) <BR>
>> chartSeries(QQQQ) <BR>
>> times <- timeBasedSeq(20071001/2007) # create a Date sequence from <BR>
>> 2007-10-01 to 2007-12-31 <BR>
>> addTA(xts(rep(TRUE,length(times)), times), on=-1, col="#333333", <BR>
>> border=NA) <BR>
> <BR>
> A few comments about 'addTA': <BR>
> <BR>
> 1) the 'on' argument which plot you want it drawn on. Starting with <BR>
> the main series window=1. Negative values cause the values to be drawn <BR>
> under the main graphics. <BR>
> <BR>
> 2) 'col' and 'border' are arguments to the 'rect' call internal, which <BR>
> draws the bands underneath. <BR>
> <BR>
> See ?addTA for further details. <BR>
> <BR>
> HTH <BR>
> Jeff <BR>
> <BR>
> <BR>
> <BR>
> <BR>
> On Thu, Nov 27, 2008 at 11:24 AM, Eric Zivot wrote: <BR>
>> You can use the chart.TimeSeries() function in the package <BR>
>> PerformanceAnalytics to do this very easily. See the examples in the help <BR>
>> file for adding shading to user defined event times. <BR>
>> ez <BR>
>> <BR>
>> _____ <BR>
>> <BR>
>> From: r-sig-finance-bounces@stat.math.ethz.ch <BR>
>> [mailto:r-sig-finance-bounces@stat.math.ethz.ch] On Behalf Of Brian Lee <BR>
>> Yung <BR>
>> Rowe <BR>
>> Sent: Thursday, November 27, 2008 9:19 AM <BR>
>> To: r-sig-finance@stat.math.ethz.ch <BR>
>> Subject: [R-SIG-Finance] Shaded regions as an indicator in quantmod <BR>
>> <BR>
>> <BR>
>> Hi, <BR>
>> <BR>
>> I want to produce charts using quantmod similar to the ones available from <BR>
>> FRED. Specifically, FRED has this handy feature of rendering the <BR>
>> NBER-defined recession periods under the displayed time series. <BR>
>> <BR>
>> It seems like calling newTA with the appropriate function handle could <BR>
>> produce the output necessary to define the shading bars, but I'm not sure <BR>
>> if <BR>
>> any of the existing charting types can generate the correct look and feel. <BR>
>> Anybody have suggestions? <BR>
>> <BR>
>> Thanks, <BR>
>> Brian <BR>
>> <BR>
>> [[alternative HTML version deleted]] <BR>
>> <BR>
>> _______________________________________________ <BR>
>> R-SIG-Finance@stat.math.ethz.ch mailing list <BR>
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance <BR>
>> -- Subscriber-posting only. <BR>
>> -- If you want to post, subscribe first. <BR>
>> <BR>
> <BR>
> <BR>
> <BR>
> -- <BR>
> Jeffrey Ryan <BR>
> jeffrey.ryan@insightalgo.com <BR>
> <BR>
> ia: insight algorithmics <BR>
> www.insightalgo.com <BR>
<BR>
<BR>
<BR>
-- <BR>
Jeffrey Ryan <BR>
jeffrey.ryan@insightalgo.com <BR>
<BR>
ia: insight algorithmics <BR>
www.insightalgo.com
</BODY>
</HTML>