Plotting a normal graph with a candlestick graph
Show older comments
Hi I am plotting few arrays in one graph, and I want a candlestick graph to appear in the same graph. Does anyone know how to do this?
Answers (2)
Oleg Komarov
on 11 Feb 2011
1 vote
I can get to this result:
% Google market data from yahoo
str = urlread('http://ichart.finance.yahoo.com/table.csv?s=GOOG&a=00&b=1&c=2005&d=00&e=1&f=2011&g=m&ignore=.csv');
% Extract dates, high, low, close, open
[dates,o,h,l,c] = dataread('string',str,'%s%f%f%f%f%*f%*f','delimiter',',','headerlines',1);
dates = datenum(dates,'yyyy-mm-dd');
% Plot the candles and the line, reversing the order won't work candle(h,l,c,o,'k',dates,'yy-mmm') hold on plot(dates,mean([h,l],2),'--r','LineWidth',2)

Walter Roberson
on 10 Feb 2011
Perhaps
hold on
?
I've never used candlestick. If it always creates a new figure, then let us know and we'll talk about the work-arounds.
3 Comments
Mate 2u
on 10 Feb 2011
Walter Roberson
on 10 Feb 2011
Hmmm, there is no evidence from the documentation that it would create a new figure.
To confirm: you are using this candle() and not the fts candle(), right?
http://www.mathworks.com/help/toolbox/finance/candle.html
Where did you put the "hold on" ? It should go after the first graph is created.
When you say that it does not seem to work, do you mean that it produces a mess or that calling candle() erases the previous graph?
Mate 2u
on 10 Feb 2011
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!