Hi,<br><br>I have worked some more on how to reproduce the attached chart and the best I was able to come up in a day with is this:<br>require(quantmod)<br><br>getSymbols("SPY")<br><br>lines.SPY <- (Hi(SPY) + Lo(SPY))/2<br>
names(lines.SPY) <- c("lines")<br>lines.SPY$BuySell <- ifelse(lag(lines.SPY$lines) > lines.SPY$lines, 1, -1)<br><br>chartSeries(SPY, subset="2011-08::", theme=chartTheme('white', up.col='blue', dn.col='red'))<br>
addTA(lines.SPY$lines[lines.SPY$BuySell == -1,], type='p', col='darkred', pch="_", on=1, cex = 2.5)<br>addTA(lines.SPY$lines[lines.SPY$BuySell == 1,], type='p', col='green4', pch="_", on=1, cex = 2.5)<br>
<br>But I still can not add text on top of the line (value of lines.SPY$lines). Well, what I have produced is not actually not a line, but a symbol. I would like a line.<br><br>My question actually goes in to direction how to use quantmod chart object and on this current chart object add a line at specific position of specific length, thickness and color and just a little above that line how to add text with specific color...<br>
<br>I also do not know how to actually get from xts objects to x and y coordiantes on quantmod chart object.<br><br>Any help/ideas/code examples appreciated.<br><br>Best regards,<br>Samo.<br><br><div class="gmail_quote">2011/8/25 Samo Pahor <span dir="ltr"><<a href="mailto:samo.pahor@gmail.com">samo.pahor@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br><br>Is it possible to produce attached chart with so called "net lines" (short line with number on top in different colors) using quantmod?<br>
<br>The Idea is that there would be a data frame with datetime, value, type (each row represents one "net line" with its numeric value and whether it is a sell (color in red) or buy(color in green)). And this lines with data in dataframe would then be overlayed on quantmod chart.<br>
<br>Is something like this possible with quantmod? I would appreciate any ideas/examples of code...<br><br>Best regards,<br><font color="#888888">Samo.<br>
</font></blockquote></div><br>