Plotting a normal graph with a candlestick graph

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?

Réponses (2)

Oleg Komarov
Oleg Komarov le 11 Fév 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)
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 commentaires

Mate 2u
Mate 2u le 10 Fév 2011
That does not seem to work
Walter Roberson
Walter Roberson le 10 Fév 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
Mate 2u le 10 Fév 2011
plot(Y, Depth_midpoint, Y, Fib100 ,Y, Fib0, Y, Fib382, Y, Fib50, Y, Fib618, Y, Fib236,Y, movingaverage2000obs, Y, movingaverage4000obs,Y, movingaverage6000obs, Y, movingaverage8000obs, Y, movingaverage10000obs);
hold on
candle(MaxPrices, MinPrices, ClosePrices, OpenPrices);
You see it is not showing me the candle graph at all like this, it just shows me the above plot :(

Connectez-vous pour commenter.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Question posée :

le 10 Fév 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by