initial commit
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
//@version=5
|
||||
indicator("TTM Squeeze", overlay=false)
|
||||
|
||||
squeezeLen = input.int(20, "Squeeze Length")
|
||||
mult = input.float(2.0, "StdDev Multiplier")
|
||||
|
||||
// Bollinger Bands
|
||||
basis = ta.sma(close, squeezeLen)
|
||||
dev = mult * ta.stdev(close, squeezeLen)
|
||||
upperBB = basis + dev
|
||||
lowerBB = basis - dev
|
||||
|
||||
// Keltner Channels
|
||||
atr = ta.atr(squeezeLen)
|
||||
upperKC = basis + atr * 1.5
|
||||
lowerKC = basis - atr * 1.5
|
||||
|
||||
// Squeeze condition
|
||||
squeezeOn = (upperBB < upperKC) and (lowerBB > lowerKC)
|
||||
|
||||
// Momentum histogram
|
||||
mom = ta.linreg(close - basis, squeezeLen, 0)
|
||||
|
||||
// Bigger squeeze dots
|
||||
plot(squeezeOn ? 0 : na, style=plot.style_circles, color=color.red, linewidth=4, title="Squeeze On")
|
||||
plot(not squeezeOn ? 0 : na, style=plot.style_circles, color=color.green, linewidth=4, title="Squeeze Off")
|
||||
|
||||
// Momentum histogram
|
||||
plot(mom, style=plot.style_histogram, color=mom >= 0 ? color.lime : color.orange, title="Momentum")
|
||||
Reference in New Issue
Block a user