6 Downloads
Updated 06 Jun 2003
No License
This a candlestick graph function. It is an improvement over the one in MATLAB 5.2. It draws the colors correctly and can be included in subplots.
Nagi Hatoum (2021). Candlestick Graph (https://www.mathworks.com/matlabcentral/fileexchange/3549-candlestick-graph), MATLAB Central File Exchange. Retrieved .
Inspired: Bar- and candle style graph for stocks
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.
i have done a new vectorized model of candle plot.
you can download it from the link below.
https://www.mathworks.com/matlabcentral/fileexchange/73972-vectorized-candle
Hi I made update for you to speed up. Old codes are too slow for large amount of data ....
%%%%%%%%draw line from Low to High%%%%%%%%%%%%%%%%%
% ------------ following codes too slow ------- %
% lineHandles = zeros(1,l);
% for i=1:l
% lineHandles(i) = line([date(i) date(i)],[L(i) H(i)],'Color',colorLine);
% end
% --------------------------------------------- %
lineDataX = zeros(1,3*l);
lineDataY = zeros(1,3*l);
lineDataX(1:3:end) = date;
lineDataX(2:3:end) = date;
lineDataX(3:3:end) = NaN;
lineDataY(1:3:end) = L;
lineDataY(2:3:end) = H;
lineDataY(3:3:end) = NaN;
lineHandles = plot(lineDataX, lineDataY, 'Color', colorLine);
%%%%%%%%%%draw white (or user defined) body (down day)%%%%%
% ------------ following codes too slow ------- %
% fill1Handles = zeros(1,length(n));
% for i=1:length(n)
% x=[date(n(i))-w date(n(i))-w date(n(i))+w date(n(i))+w date(n(i))-w];
% y=[O(n(i)) C(n(i)) C(n(i)) O(n(i)) O(n(i))];
% fill1Handles(i) = fill(x,y,colorDown);
% end
% --------------------------------------------- %
n=find(d<0);
x=[date(n)-w date(n)-w date(n)+w date(n)+w];
y=[O(n) C(n) C(n) O(n)];
z=ones(size(x));
fill1Handles = patch(x', y', z', 'FaceColor', colorDown);
%%%%%%%%%%draw black (or user defined) body(up day)%%%%%%%
% ------------ following codes too slow ------- %
% n=find(d>=0);
% fill2Handles = zeros(1,length(n));
% for i=1:length(n)
% x=[date(n(i))-w date(n(i))-w date(n(i))+w date(n(i))+w date(n(i))-w];
% y=[O(n(i)) C(n(i)) C(n(i)) O(n(i)) O(n(i))];
% fill2Handles(i) = fill(x,y,colorUp);
% end
% --------------------------------------------- %
n=find(d>=0);
x=[date(n)-w date(n)-w date(n)+w date(n)+w];
y=[O(n) C(n) C(n) O(n)];
z=ones(size(x));
fill2Handles = patch(x', y', z', 'FaceColor', colorUp);
Great!
Exactly what I need!
Awesome
Excellen! Thank you very much.
Good. Congratulations.
Great! I love it!