Problem with candle chart and loop
1 回表示 (過去 30 日間)
古いコメントを表示
Hello community,
I have a problem with creating a candle chart from a matrix using a for loop.
Just for comparison: I can make a loop for a simple plot (x,y) like this:
for z=1:length(x)
plot(x(1,z),y(1,z),'+r') hold on
end
In this case every point follows each other in the chart and everything is fine.
But when I want to use this simple method with candle() instead of plot(), it just overrides this first candle (data set) in the chart and I get a stack of overlapping candles.
for f=1:length(date)
candle(open(f,4),high(f,3),low(f,5),close(f,2),'b')
hold on
end
Does anybody know how to solve this problem? Would be very nice!
Merry Christmas and thanks, Dominik
0 件のコメント
回答 (1 件)
the cyclist
2013 年 12 月 24 日
In the version using plot(), you are telling MATLAB to place the plot marker at different x locations, but in the version using candle(), you are not specifying different dates to place the plot markers, so they just overlap. You need to use the 6-argument version of candle(), something like
candle(open(f,4),high(f,3),low(f,5),close(f,2),'b',date(f),Dateform)
as described in the documentation:
doc candle
I don't have the Finance Toolbox, so I may not have that quite right, but I think that is the gist of your problem.
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!