<!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">Hi Jeff,</FONT><BR>
<BR>
<FONT COLOR="#000000">This sounds promising, but I couldn't get it to work. </FONT><BR>
<BR>
<FONT COLOR="#000000">&gt; chartSeries(QQQQ)</FONT><BR>
<FONT COLOR="#000000">&gt; times &lt;- timeBasedSeq('20071001/2007')</FONT><BR>
<FONT COLOR="#000000">&gt; </FONT>addTA(xts(rep(TRUE,length(times)), times), on=-1, col=&quot;#333333&quot;, border=NA)<BR>
<FONT COLOR="#000000">Warning message:</FONT><BR>
<FONT COLOR="#000000">In plot.xy(xy.coords(x, y), type = type, ...) :</FONT><BR>
<FONT COLOR="#000000">&nbsp; &quot;border&quot; is not a graphical parameter</FONT><BR>
<FONT COLOR="#000000">&gt; </FONT>addTA(xts(rep(TRUE,length(times)), times), on=-1, col=&quot;#333333&quot;)<BR>
<FONT COLOR="#000000">Warning message:</FONT><BR>
<FONT COLOR="#000000">In plot.xy(xy.coords(x, y), type = type, ...) :</FONT><BR>
<FONT COLOR="#000000">&nbsp; &quot;border&quot; is not a graphical parameter</FONT><BR>
<BR>
<FONT COLOR="#000000">Re-executing the sequence without the border parameter removes the error message, but I don't see any bars. The series name does appear in the legend area, though.</FONT><BR>
<BR>
<FONT COLOR="#000000">&gt; chartSeries(QQQQ)</FONT><BR>
<FONT COLOR="#000000">&gt; addTA(xts(rep(TRUE,length(times)), times), on=-1, col=&quot;#333333&quot;)</FONT><BR>
<BR>
<FONT COLOR="#000000">I'm using version 0.3-6 revision 433. Any thoughts on what I'm doing wrong?</FONT><BR>
<BR>
<FONT COLOR="#000000">Brian</FONT><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>
&gt; library(quantmod) <BR>
&gt; chartSeries(QQQQ) <BR>
&gt; times &lt;- timeBasedSeq(20071001/2007) # create a Date sequence from 2007-10-01 to 2007-12-31 <BR>
&gt; addTA(xts(rep(TRUE,length(times)), times), on=-1, col=&quot;#333333&quot;, 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>
&gt; You can use the chart.TimeSeries() function in the package <BR>
&gt; PerformanceAnalytics to do this very easily. See the examples in the help <BR>
&gt; file for adding shading to user defined event times. <BR>
&gt; ez <BR>
&gt; <BR>
&gt; _____ <BR>
&gt; <BR>
&gt; From: r-sig-finance-bounces@stat.math.ethz.ch <BR>
&gt; [mailto:r-sig-finance-bounces@stat.math.ethz.ch] On Behalf Of Brian Lee Yung <BR>
&gt; Rowe <BR>
&gt; Sent: Thursday, November 27, 2008 9:19 AM <BR>
&gt; To: r-sig-finance@stat.math.ethz.ch <BR>
&gt; Subject: [R-SIG-Finance] Shaded regions as an indicator in quantmod <BR>
&gt; <BR>
&gt; <BR>
&gt; Hi, <BR>
&gt; <BR>
&gt; I want to produce charts using quantmod similar to the ones available from <BR>
&gt; FRED. Specifically, FRED has this handy feature of rendering the <BR>
&gt; NBER-defined recession periods under the displayed time series. <BR>
&gt; <BR>
&gt; It seems like calling newTA with the appropriate function handle could <BR>
&gt; produce the output necessary to define the shading bars, but I'm not sure if <BR>
&gt; any of the existing charting types can generate the correct look and feel. <BR>
&gt; Anybody have suggestions? <BR>
&gt; <BR>
&gt; Thanks, <BR>
&gt; Brian <BR>
&gt; <BR>
&gt; [[alternative HTML version deleted]] <BR>
&gt; <BR>
&gt; _______________________________________________ <BR>
&gt; R-SIG-Finance@stat.math.ethz.ch mailing list <BR>
&gt; https://stat.ethz.ch/mailman/listinfo/r-sig-finance <BR>
&gt; -- Subscriber-posting only. <BR>
&gt; -- If you want to post, subscribe first. <BR>
&gt; <BR>
<BR>
<BR>
<BR>
-- <BR>
Jeffrey Ryan <BR>
jeffrey.ryan@insightalgo.com <BR>
<BR>
ia: insight algorithmics <BR>
www.insightalgo.com 
</BODY>
</HTML>