Adding an array of ticks for every 5 minutes or 10, 15 minutes

I have manged to add all the AskVolume and Bid Volume in a day by using the below snippet

AskVolume = iif(C>Ref(C,-1),Volume,0);
BidVolume = iif(C<Ref(C,-1),Volume,0);

I have set the time to 1 tick on my charts. Now I need to add all Ask Volume and BidVolume for every 5 minutes and make operations on it. Can any one help me with this ?

I try many way with TimeFrameCompress(), TimeFrameExpand() but can not.
Please help him and me!