Home  |  About Us  |  Link To Us  |  FAQ  |  Contact

# Tick2Bar 1.0

Date Added: June 03, 2013  |  Visits: 242

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 periodH high of the periodL low of the periodO open (first datum of the period)C close (last datum of the period)V volume of the periodgivent date/timep pricev volumeg time granularity [days]USAGE% test dataN=1e4;g=1/(24*60*60); % 1 minute granularityt=([1:N]+rand(1,N)).*g; % timep=100+rand(1,N).*10; % pricev=1e4.*rand(1,N); % volume% add some test-NANsa=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

 Requirements: No special requirements Platforms: Matlab Keyword: Close,  Conjunction,  Datan,  Datetimep,  Daysusage,  Fancy,  Fontweight Bold,  Granularity,  Granularityt Brand,  Minute,  Period,  Periodgivent,  Periodv,  Pricev,  Pricev Rand,  Testnansa Drandpermnva Dnang,  Timep Brand,  Volume,  Volumeg,  Works Users rating: 0/10