[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: average size in tick charts



PureBytes Links

Trading Reference Links

> I'm trying to figure out the daily average size of bars in an
> intraday tick chart. Problem, of course, is that I can't specify how
> many bars to look at in the average, because with tick charts the
> number isn't static. Any ideas? 

Count them.  Something like this:

if Date>Date[1] then begin
  AvgSize = average(Size[1], Count);
  Count = 0;
end;
Count = Count + 1;

Or, better yet, calculate your own average.  That way you won't 
have to look back an indeterminate number of bars for the 
average() call.

if Date>Date[1] then begin
  AvgSize = SumSize / Count;
  Count = 0;
  SumSize = 0;
end;
Count = Count + 1;
SumSize = SumSize + Size;

The Date>Date[1] test assumes you're using RTH data.  If you use 
24hr data you'll have to decide when you want the day to end 
(midnight?  start of RTH?) and what data you want to pay 
attention to (24hr?  RTH only?).

Gary