No BSD License  

Highlights from
Candlestick Graph

4.625

4.6 | 8 ratings Rate this file 18 Downloads (last 30 days) File Size: 915 Bytes File ID: #3549
image thumbnail

Candlestick Graph

by Nagi Hatoum

 

04 Jun 2003 (Updated 06 Jun 2003)

Plots a candlestick graph.

| Watch this File

File Information
Description

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.

Acknowledgements
This submission has inspired the following:
Bar- and candle style graph for stocks
MATLAB release MATLAB 5.2 (R10)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (8)
28 Mar 2004 William Bain

Great! I love it!

14 Apr 2004 ESAS sas

Good. Congratulations.

06 Jul 2004 Yiwen Yang

Excellen! Thank you very much.

14 Jan 2005 Tyler Moore

Awesome

15 May 2005 Brian O'Donnell

Exactly what I need!

13 Nov 2005 Michele Denber  
18 Aug 2008 DE YAO

Great!

04 Oct 2010 SSOI SS

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);

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
finance Nagi Hatoum 22 Oct 2008 07:02:41
modeling Nagi Hatoum 22 Oct 2008 07:02:41
analysis Nagi Hatoum 22 Oct 2008 07:02:41
graph Cristina McIntire 06 Feb 2009 11:44:22
plot Cristina McIntire 06 Feb 2009 11:44:22
candlestick Cristina McIntire 06 Feb 2009 11:44:22
japanese Cristina McIntire 06 Feb 2009 11:44:22
close Cristina McIntire 06 Feb 2009 11:44:22
open Cristina McIntire 06 Feb 2009 11:44:22
high Cristina McIntire 06 Feb 2009 11:44:22
low Cristina McIntire 06 Feb 2009 11:44:22
stock Cristina McIntire 06 Feb 2009 11:44:22
open Jelle Veraa 28 Mar 2009 13:00:30
analysis Robert 23 Dec 2009 00:24:52

Contact us at files@mathworks.com