# How to calculate time-segmented volume? [closed]

amibrokers has this calculation for TSV:

_SECTION_BEGIN(" Time Segmented Volume ");

t=(Sum(IIf( C>Ref(C,-1), (V*(C-Ref(C,-1))),IIf(C<Ref(C,-1),(V*(C-Ref(C,-1))),0)),13));
m=MA(t ,7 );
Plot(t, "Time Segmented Volume 13", colorRed);
Plot(m, " Simple Moving Average 7" , colorYellow);

_SECTION_END();


Key: t is calculated TSV; read IIF as IF (happily, IIF has been defenestrated); C is the close on the current bar; (C,-1) is the close on the just-previous bar. @chrisaycock points out below that the usual trading day in the US has 13 half-hour periods, represented perhaps by the constant 13.

Can you comment on the correctness of the calculation? Or suggest a better one?

-

## closed as too localized by SRKX♦, Alexey Kalmykov, Tal FishmanFeb 6 '12 at 21:31

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

There are 13 half-hour periods in a typical US trading day. –  chrisaycock Jan 22 '12 at 22:01
@ chrisaycock -- Thanks!! <gulp> :-) –  Pete Wilson Jan 23 '12 at 0:31