Time segmented volume (TSV) is a technical analysis indicator developed by Worden Brothers Inc. that segments a stock’s price and volume according to specific time intervals. The price and volume data is then compared to uncover periods of accumulation (buying) and distribution (selling).
Time Segmented Volume was developed by Worden Brothers, Inc to be a leading indicator by comparing various time segments of both price and volume.
Following a request at https://www.prorealcode.com/topic/time-segmented-volume-by-worden-brothers-code/, I converted this indicator to the ProRealTime platform:
// TSV Time Segmented Volume indicator
//
//https://futures.io/thinkorswim/10957-time-segmented-volume-worden-telecharts.html#post122215
//
// 13 = number of daily HALF HOURS
// 7 = ????
//
// Example Settings:
// Short Term Trading : TSV period between 9 and 12
// Intermediate Term Trading: TSV period between 18 and 25
// Long Term Trading : TSV period between 35 and 45
//
// --------------------------------------------------------------------------------------
// t = sum(close>close[1]?volume*close-close[1]:close<close[1]?(volume*-1)*close-close[1]:0,13)
// m = sma(t,7)
// --------------------------------------------------------------------------------------
// TSV=(Sum( IIf( C > Ref(C,-1), V * ( C-Ref(C,-1) ), IIf( C < Ref(C,-1),-V * ( C-Ref(C,-1) ), 0 ) ) ,18));
// --------------------------------------------------------------------------------------
//
//ONCE p1 = 13
//ONCE p2 = 7
//ONCE Mtype = 0
p1 = max(1,min(999,p1))
p2 = max(1,min(999,p2))
Mtype = max(0,min(6,Mtype))
MyVol = 0
IF close > close[1] THEN
MyVol = volume * (close - close[1])
ELSIF close < close[1] THEN
MyVol = -volume * (close - close[1])
ENDIF
TSV = summation[p1](MyVol)
Signal = average[p2,Mtype](TSV)
RETURN TSV AS "Tsv",Signal AS "Signal"