Tick2Bar

버전 1.0.0.0 (1.22 KB) 작성자: Michael Robbins
Divides a time series into periods and returns high, low, open, close, volume.
다운로드 수: 4.5K
업데이트 날짜: 2003/7/30

라이선스 없음

TICK2BAR
[T,H,L,O,C,V]=Tick2Bar(t,p,v,g)
Divides a time series into periods of g days
(may be less than one day).
It is useful in conjunction with HIGHLOW
[T,H,L,O,C,V]=Tick2Bar(t,p,v,g);
highlow(H(:),L(:),C(:),O(:),'k',T(:));

It returns:

T date/time of the period
H high of the period
L low of the period
O open (first datum of the period)
C close (last datum of the period)
V volume of the period

given

t date/time
p price
v volume
g time granularity [days]

USAGE

% test data
N=1e4;
g=1/(24*60*60); % 1 minute granularity
t=([1:N]+rand(1,N)).*g; % time
p=100+rand(1,N).*10; % price
v=1e4.*rand(1,N); % volume
% add some test-NANs
a=randperm(N);
v(a(1:10))=nan;

g=1/(24*60*60); % 1 minute granularity
[T,H,L,O,C,V]=Tick2Bar(t,p,v,g);

subplot(6,1,1:2);
plot(t,p,'k');
datetick;
title('plot(t,p,''k'');')

subplot(6,1,3);
plot(t,v,'k');
datetick;
title('plot(t,v,''k'');');

subplot(6,1,4:5);
highlow(H(:),L(:),C(:),O(:),'k',T(:));
datetick;
title('highlow(H(:),L(:),C(:),O(:),''k'',T(:));');

subplot(6,1,6);
plot(T,V,'k');
datetick;
title('plot(T,V,''k'');');

h=suptitle('[T,H,L,O,C,V]=Tick2Bar(t,p,v,g);');
set(h,'FontSize',get(h,'FontSize').*2, ...
'FontWeight','Bold');

IT'S NOT FANCY BUT IT WORKS

인용 양식

Michael Robbins (2024). Tick2Bar (https://www.mathworks.com/matlabcentral/fileexchange/3398-tick2bar), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R13
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Financial Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

Speed increases on the order of 10x (input data with NaN's may produce different output than before change.