-1

I have some stock prices High, Low, Open, Close. I would like to use R to draw a candle stick chart, then I have another customer indicator (a type of moving average) that I have developed and I would like to plot that as a line chart over the candle sticks.

Also I would like to be able to specify he colour of the line chart that I add to the candlestick chart.

miniChart <- as.xts(miniSubset,order.by=miniDF$GMT.x..i..)
#Create quantmod chart
candleChart(miniChart)

Please could someone tell me how I would add a line chart on the candlechart above?

edb500
  • 183
  • 2
  • 13
  • Duplicate of http://stackoverflow.com/questions/2564258/plot-two-graphs-in-same-plot-in-r? – dww Jul 05 '16 at 13:39

1 Answers1

0

You could use candleChart from the quantmod package or gvisCandlestickChart from googleVis. Quantmod was specifically designed to work with financial data so I'd suggest you start with it.

Once you're happy with the candle stick chart, then you can add an overlying line chart.

epo3
  • 2,573
  • 1
  • 29
  • 51
  • lol that is my question. What is the code to write the chart and the overlying line chart? – edb500 Jul 05 '16 at 15:16
  • like how do you add an overlying line chart onto a quantmod candlestick chart – edb500 Jul 05 '16 at 15:18
  • read your question again. you didn't mention any packages used or haven't shared any code used. what have you tried so far? – epo3 Jul 05 '16 at 15:51
  • Please check my question, I have edited it. If you know how to add a line to the candlstick chart, please write the code for this. – edb500 Jul 05 '16 at 17:20