Sunday, June 15, 2008

Intraday Trading---Converting Ticks into Bars

Sometimes it is easier to work with bars instead of ticks. In such cases, If we have Raw Tick Data, The following matlab programs would do the work for you. It is a collection of various methods that could be used to construct bars.

Tick2bar program at the matlab file exchange:



http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=3398

Another method that was posted at a forum http://www.nuclearphynance.com/


% numberOfBarsPerDay: 24 = 1 hour bars (60 minutes)
% 48 = 30 minute bars (24*60)/30
% 72 = 20 minute bars (24*60)/20
% 96 = 15 minute bars (24*60)/15
% 144 = 10 minute bars (24*60)/10
% 288 = 5 minute bars (24*60)/5
% 1440 = 1 minute bars (24*60)/1
%%--------------------------------------------------------------------------

numberOfBarsPerDay=24;
x=Bid;
datetimeGrid=(floor(datetime.*numberOfBarsPerDay))./numberOfBarsPerDay;
timeChgPointIndex=find(diff(datetimeGrid)~=0);
intervalDatetimeStart=datetimeGrid(timeChgPointIndex);
intervalDatetimeEnd=datetimeGrid(timeChgPointIndex+1);
intervalDatetimeActual=datetime(timeChgPointIndex);
intervalData=x(timeChgPointIndex);







3. Another method using histc
[numberInInterval,intervalIndex]=histc(datetime,intervals);

5 comments:

bot maker said...

Thanks for sharing this, just what I was looking for!

Tee Chess said...

Thanks for sharing this information. I have never used bars but is excited to try this method. I am thankful to you for posting these methods that could be used to construct bars.
binary options signals

iLeaf Ritz Banquets said...

You consistently give good advice that I can use.Thanks for sharing this information. These are very good tips on Intraday Trading that converts ticks into Bars.Online equity trading has become the norm for individual investors and traders over the past decade.

Akash Agarwal said...

Thanks for sharing such a nice and useful information.This is what i am seriously looking for.

webseos said...

Its good short article on Intraday Trading Charts. Thanks. Bikram Learn Intraday Trading Courses in Kolkata, For share market trading courses in Kolkata visit the link