Plotting a normal graph with a candlestick graph

조회 수: 7 (최근 30일)
Mate 2u
Mate 2u 2011년 2월 10일
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?

답변 (2개)

Oleg Komarov
Oleg Komarov 2011년 2월 11일

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
Walter Roberson 2011년 2월 10일
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
Walter Roberson
Walter Roberson 2011년 2월 10일
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 2011년 2월 10일
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 :(

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by