×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Boxsplot chart in matlab for analysis of the financial market

Boxsplot chart in matlab for analysis of the financial market

Boxsplot chart in matlab for analysis of the financial market

(OP)
Hi.
I can generate boxsplot chart in matlab for analysis of the financial market. Example: I have a table of quotations containing the Open, High, Low, Close financial value. For ease of explanation left a graphic done in excel Any suggestions to make this graph?

Translation with google translator

Date Open High Low Close Volume
2008.09.01 3,16 3,22 3,12 3,15 367
2008.09.02 3,14 3,22 3,11 3,2 976
2008.09.03 3,22 3,23 3,16 3,19 1448
2008.09.04 3,17 3,29 3,13 3,13 3058
2008.09.05 3,11 3,19 3,11 3,17 1123
2008.09.08 3,22 3,28 3,15 3,19 1425
2008.09.09 3,15 3,26 3,15 3,23 1829
2008.09.10 3,21 3,34 3,21 3,34 2029
2008.09.11 3,35 3,46 3,32 3,39 2638
2008.09.12 3,39 3,39 3,3 3,31 2384
2008.09.15 3,19 3,34 3,17 3,21 1452
2008.09.16 3,17 3,17 3,06 3,11 2375
2008.09.17 3,1 3,12 2,97 3,02 2108
2008.09.18 3,03 3,13 2,94 3,13 2034
2008.09.19 3,25 3,35 3,22 3,35 1849
2008.09.22 3,33 3,38 3,25 3,32 1176
2008.09.23 3,32 3,32 3,16 3,16 1222
2008.09.24 3,19 3,25 3,18 3,25 647
2008.09.25 3,29 3,35 3,26 3,35 1100
2008.09.26 3,32 3,35 3,25 3,25 1123
2008.09.29 3,22 3,22 3 3,12 1327
2008.09.30 3,4 3,4 3,12 3,37 1167
2008.10.01 3,37 3,45 3,32 3,38 1173
2008.10.02 3,36 3,43 3,24 3,32 1618
2008.10.03 3,3 3,38 3,22 3,29 1629
2008.10.06 3,16 3,27 2,97 3,19 1420
2008.10.07 3,19 3,3 3,07 3,08 2264
2008.10.08 3,04 3,05 2,82 2,94 3827
2008.10.09 2,96 3,06 2,72 2,76 2012
2008.10.10 2,47 2,87 2,44 2,85 2558


RE: Boxsplot chart in matlab for analysis of the financial market

These aren't actually called boxplots (which are a statistical tool). What you're really asking for are candlestick plots. As it turns out, Matlab has a function to generate them for you. If the data that you're trying to plot is put into a text file called stkdata.dat, something like this should do what you want:

CODE --> Matlab

function mkCandle

clc;close all;
fid = fopen('stkdata.dat','r');
header = fgets(fid);
disp(header)
year=[]; month=[]; day=[]; opn=[]; hgh=[]; low=[]; clos=[]; vol=[];
while ~feof(fid)
    line = fgets(fid);
    for n = 1:length(line)
        if line(n)=='.'
            line(n)='-';
        elseif line(n)==','
            line(n)='.';
        end
    end
    stkData = sscanf(line,'%04f-%02f-%f %f %f %f %f %i');
    year(length(year)+1,:)   = stkData(1);
    month(length(month)+1,:) = stkData(2);
    day(length(day)+1,:)     = stkData(3);
    opn(length(opn)+1,:)     = stkData(4);
    hgh(length(hgh)+1,:)     = stkData(5);
    low(length(low)+1,:)     = stkData(6);
    clos(length(clos)+1,:)   = stkData(7);
    vol(length(vol)+1,:)     = stkData(8);
end
fclose(fid);

% Making the plot
h = figure(1);
Date = datenum(year, month, day,0,0,0);
candle(hgh, low, clos, opn, [.231,.443,0.642], Date);
set(gca,'YGrid','on');
yh = ylabel('Stock Price, US Dollars');
nicePrint(h,6,3,11); % Make a nice plot
set(yh,'FontSize',12, 'FontWeight','bold'); % Bold the label
print(h,'-deps', 'Candle.eps'); % Make an EPS file
print(h,'-dpdf', 'Candle.pdf'); % Make an PDF file
print(h,'-dmeta','Candle.emf'); % Make an EMF file (Windows only)

% A function for making nice plots
function nicePrint(H,WIDTH,HEIGHT,FONTSIZE)
set(H,'PaperUnits','inches');
set(H,'PaperOrientation','portrait');
set(H,'PaperSize',[WIDTH,HEIGHT]);
set(H,'PaperPosition',[0,0,WIDTH,HEIGHT])
FN = findall(H,'-property','FontName');
set(FN,'FontName','Avant Garde');
FS = findall(H,'-property','FontSize');
set(FS,'FontSize',FONTSIZE); 

-Chris

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login



News


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close