Excluding weekend gaps from financial timeseries plots
古いコメントを表示
Is it possible to tell the matlab plot(fts)function not to display the gaps caused by weekends?
回答 (2 件)
It is possible to plot financial data without weekends.
Please look at the example code. We use "set(gca…)" to tell the x axis which dates to plot.
datum=Aktie.dates(400:end); %These are the dates we want to plot. Normal Matlab datenumbers.
figure
hold on
candle(Aktie.high (400:end), Aktie.low (400:end), Aktie.close(400:end), Aktie.open(400:end), 'b') %Let's plot a candle chart.
plot(LONG(400:end), 'r'); %with a moving average
%This is the important date section
tick_index = 1:10:length(datum); % checks length of the dates with 10 steps in between.
tick_label = datestr(datum(tick_index), 6); % this is translated to a datestring.
%Now we tell the x axis to use the parameters set before.
set(gca,'XTick',tick_index);
set(gca,'XTickLabel',tick_label);
It should look like this:

Cheers Rasmus
Robert Cumming
2012 年 1 月 9 日
0 投票
make the gaps NaN and the plot will skip the NaN data.
4 件のコメント
Richard Bibb
2012 年 1 月 9 日
Robert Cumming
2012 年 1 月 9 日
Ah - maybe I misinterperted the question...
is this part of the financial toolbox? if so I dont have it so cant help directly. But I would have thought that it should be in the options to remove it (pretty basic functionality)..
Titus Edelhofer
2012 年 1 月 9 日
What exactly do you mean by gaps? The plot should always interpolate linearly between the Friday and the next Monday data point. Please describe in more detail (a) what you observer and (b) what you would like to have changed.
Dmitri
2013 年 2 月 8 日
Let me explain what's needed here. I have data from a financial instrument - two columns - first contains the datetime information (stored as a double, bizarrely) and the second is the prices. now I create a FINTS object over them and do a plot on it. The problem is that I end up with something that has blank spaces between the missing dates. I'd like those spaces gone.
カテゴリ
ヘルプ センター および File Exchange で Grid Lines, Tick Values, and Labels についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!