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?