Plot Stock Chart and Overlay Remaining time series from Excel Worksheet

Hello!
I am trying to plot data from Excel in Matlab...
I wonder if it is possible to plot a stock chart, from the stock data and then add more time series over it??? I have the following code to plot different time series from excel file (from http://www.mathworks.com/matlabcentral/answers/15871-plot-multiple-time-series-based-on-individual-condition):
%% [Num,Txt,Raw]=xlsread('test.xls'); colors = {'r', 'k', 'g'}; %red, black, green linetypes = {'--', '-'}; %dashed, solid figure(1);hold on; for k=2:23 plot(Num(4:end,1),Num(4:end,k),[colors{Num(1,k)},linetypes{Num(2,k)}],'linewidth',Num(3,k)); end
I wonder if the the stock-chart plot from financial toolbox can be used to plot 4 first time series from the following worksheet( and then the remaining time series to be overlaid over it):
ANY HELP IS HUGELY APPRECIATED!
D

2 Commenti

What do you mean "overlay"? The code has the 'hold on' line so all curves are plotted in the same figure. Is that "overlay"?
glad to hear again form you...I mean that the first four series are actually the open high low close prices of a stock chart....and I see that they can be plotted as a candlestick chart by a special function in Matlab...I think it is as follows:
candle(HighPrices, LowPrices, ClosePrices, OpenPrices)
I need to plot those former time series over a candlestick chart based on the first four columns of this dataset (test.xls). I hope this is win in the boundaries of Matlab capabilities)
Hope to hear from you soon!)
D

Accedi per commentare.

 Risposta accettata

Make your program flow like this:
f=figure;hold on;
candle(....)
Then run the previous code with the 'figure(1);hold on;' line.
Type help figure or doc figure to lean how to create new figure or use existing figure for plotting.

3 Commenti

cool it all works now...here is the code:
%%
[Num,Txt,Raw]=xlsread('test.xls');
colors = {'r', 'k', 'g'}; %red, black, green
linetypes = {'--', '-'}; %dashed, solid
figure(1);hold on;
candle(Num(4:end,2),Num(4:end,3),Num(4:end,4),Num(4:end,5),'k');
for k=6:23
plot(Num(4:end,1),Num(4:end,k),[colors{Num(1,k)},linetypes{Num(2,k)}],'linewidth',Num(3,k));
end
thanks for your constant help)))
I have one more question - how do I set the lower time axis to display dates instead of the number?
Thanks so much!!)
BTW as you can see on this chart (http://ifile.it/1zwk43i) each line start is accompanied by an upward vertical line - I wonder if there is a way to remove that? thanks!)
The link requires registration so I won't do it. To show the date in x axis, use the following example:
%%
Time=(1:10)+now;
plot(Time,1:10);
a=gca;
xtick=get(a,'xtick');
xticklabel=datestr(xtick,'yyyy/mm/dd');
set(a,'xticklabel',xticklabel);

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by