esvafromdc
New member
This is something I used that combines the TTM squeeze (written as the "Momentum Squeeze" by Mobius) with Time Segmented Volume as written by @cos251. I've used TSV for so long that I forgot it came from here (thought it was standard on TOS)! I've always found the momentum indicator part of the TTM squeeze fairly useless. It's very lagging and even when adjusted, it just reflects obvious price action. Why not use something much more valuable like volume?
Basically, you are looking at the TSV indicator colored like TTM squeeze and with the zero line marked out with the periods where ATR is inside Bollinger bands (red dots), along with the TSV moving average. I have a version of this that is similar on some charts that combines the lower squeeze indicator with advanced volume bars as well. Anyway, just thought I'd throw this out there in case anyone had any other ideas for adding to it or sprucing it up. I've found it much more useful than traditional Carter TTM squeeze for obvious reasons, but including seeing more obvious divergence setups.
Hopefully I've credited everyone correctly!
Basically, you are looking at the TSV indicator colored like TTM squeeze and with the zero line marked out with the periods where ATR is inside Bollinger bands (red dots), along with the TSV moving average. I have a version of this that is similar on some charts that combines the lower squeeze indicator with advanced volume bars as well. Anyway, just thought I'd throw this out there in case anyone had any other ideas for adding to it or sprucing it up. I've found it much more useful than traditional Carter TTM squeeze for obvious reasons, but including seeing more obvious divergence setups.
Hopefully I've credited everyone correctly!
Code:
# Time Segmented Volume with Squeeze Indicator
# Uses Mobius' Momentum Squeeze code
declare lower;
input length = 20;
input price = close;
input SDmult = 2.0;
input ATRmult = 1.5;
def K = (Highest(High, length) + Lowest(low, length)) /
2 + ExpAverage(close, length);
def Momo = Inertia(price - K / 2, length);
## Time_Segmented_Volume
##
##
## CREDITS
## Requested by @squatsandstonks from orignal source https://www.tradingview.com/chart/BTCUSD/TG3DTxTR-INDICATOR-TIME-SEGMENTED-VOLUME/
##
##
## Removing the header Credit credits and description is not permitted, any modification needs to be shared.
##
##
## V 1.0 : @cos251 - Initial release per request from usethinkscript forum. All logic has not been ported, only base idea
## :
input tsvLength = 13;
input maLength = 7;
def t = Sum(if close > close[1] then (volume * (close-close[1])) else if close < close[1] then (volume *(close-close[1])) else 0,tsvLength);
def m = MovingAverage(AverageType.SIMPLE,t,maLength);
def PAL = (t > m) and (t > 0);
def PAL_Fail = (t < m) and (t > 0);
def PAS = (t <m) and (t < 0);
def PAS_Fail = (t > m) and (t < 0);
plot TSV = t;
TSV.SetPaintingStrategy(PaintingStrategy.HISTOGRAM);
TSV.AssignValueColor(if TSV > 0 then Color.CYAN else Color.RED);
TSV.SetLineWeight(4);
plot TSV_MA = m;
TSV_MA.SetDefaultColor(Color.White);
TSV_MA.SetlineWeight(2);
# Plot Squeeze
def SD = StDev(close, length);
def Avg = Average(close, length);
def ATR = Average(TrueRange(high, close, low), length);
def SDup = Avg + (SdMult * Sd);
def ATRup = Avg + (AtrMult * ATR);
plot Squeeze = if SDup < ATRup
then 0
else Double.NaN;
Squeeze.SetPaintingStrategy(PaintingStrategy.Points);
Squeeze.SetLineWeight(3);
Squeeze.SetDefaultColor(Color.Red);
plot zero = if IsNaN(close) or !IsNaN(Squeeze) then Double.NaN else 0;
zero.SetPaintingStrategy(PaintingStrategy.Points);
zero.SetLineWeight(3);
zero.SetDefaultColor(Color.Green);
# End Code - TSV Squeeze