Skip to content

OHLC Plot with EMA in it

4 messages · Michael Zak, Adaikalavan Ramasamy, Dirk Eddelbuettel +1 more

#
Hi there

I have some timeseries data which I plot in a OHLC Plot. In the same  
plot I'd like to have the EMA of this timeseries. I tried to add the  
EMA point to OHLC with lines(), but this doesn't work. Has anyone an  
idea how to handle it?

Regards, Michael Zak
#
Can you give us a simple example which produces the same behavior?
Michael Zak wrote:
#
On Thu, Sep 25, 2008 at 03:44:21PM +0200, Michael Zak wrote:
Quick guess:  Your transformation from priceData to EMA(priceData)
changed the x-axis data representation. Maybe you moved from times to
observation count.  Make sure it remains the same, and your good.

For a simple solution directly in R, look up my bollinger bands
examples on the R Graph Gallery page.  

For a high-end solution, look at the quantmod package and the quantmod
site.

Lastly, the question really belongs on the r-sig-finance list which
you should subscribe to in order to post.

Dirk
1 day later
#
Using quantmod and TTR (for EMA, as well as many, many more technical tools):

library(quantmod)

# get some data
getSymbols("QQQQ")

barChart(QQQQ)
addEMA()

Lots of examples at:

http://www.quantmod.com http://www.quantmod.com 
---and---
http://www.quantmod.com/examples/charting/
http://www.quantmod.com/examples/charting/ 


Do like Dirk suggests and find your way to R-Sig-Finance.

Enjoy!
Jeff
Michael Zak wrote: