[R-SIG-Finance] [R-sig-finance] Shaded regions as an indicator in quantmod

PitaBread aliona.mn at gmail.com
Wed Mar 25 20:45:16 CET 2009


Hello.
I have got a related question.

When I generate Trades signals of either -1s or 1s, and do 
   > plot(addTA(Trades > 0, border = NA, col = 'green', on = -1))
although it plots correctly, it seems to be plotting starting the next day,
and ending between the last and previous-to-last day. 
As a result, if i add: 
   > plot(addTA(Trades < 0, border = NA, col = 'red', on = -1))
it should really have plotted all the region (since i don't have any 0's in
Trades). Instead, it has spaces, not filled by either 'red' or 'green'...
Another result of that is that if i have a one-day Trade, i.e. 
   > Trades[23:27]
       [1] 1 1 -1 1 1
instead of a red rectangle i get a gray line when on=-1 and absolutely
nothing when on=-2. FYI: my x-range is 2 months, so it is not a zoom
problem.

http://www.nabble.com/file/p22709315/DUG-1.jpg 

Aliona


Brian Lee Yung Rowe wrote:
> 
> 
> Hi, 
> 
> I want to produce charts using quantmod similar to the ones available from
> FRED. Specifically, FRED has this handy feature of rendering the
> NBER-defined recession periods under the displayed time series. 
> 
> It seems like calling newTA with the appropriate function handle could
> produce the output necessary to define the shading bars, but I'm not sure
> if any of the existing charting types can generate the correct look and
> feel. Anybody have suggestions? 
> 
> Thanks, 
> Brian
> 
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
> 

-- 
View this message in context: http://www.nabble.com/Shaded-regions-as-an-indicator-in-quantmod-tp20722874p22709315.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list