This is my version of the Squeeze indicator from Trade the Markets ( TTM             ) and John Carter.
Remove from Favorite Scripts Add to Favorite Scripts
study(title="TTM_Squeeze_LinReg", shorttitle="TTM_Squeeze_LinReg", overlay=false)

source = close
ROC_length = input(title="RoC Length", defval=14, minval=1)
length = input(title="Length", type=integer, defval=22)
offset = input(title="Offset", type=integer, defval=0)

rate = 100 * mom(source, ROC_length)/source[ROC_length]
lsma = linreg(rate, length, offset)

isOne()   => lsma>0 and lsma>lsma[1]
isTwo()   => lsma>0 and lsma<lsma[1]
isThree() => lsma<0 and lsma<lsma[1]
isFour()  => lsma<0 and lsma>lsma[1]

plot(lsma, linewidth=4, style=histogram, color=isOne() ? aqua : isTwo() ? blue : isThree() ? red : isFour() ? yellow : gray, title="ROC")

K_source = close
Keltner_useTrueRange = input(title="True Range", defval=true)
Keltner_length = input(title="Keltner Length", defval=20, minval=1)
Keltner_multiple = input(title="Keltner Multiple", defval=1.5)
K_ma = ema(K_source, Keltner_length)
K_range = Keltner_useTrueRange ? tr : high - low
K_rangema = ema(K_range, Keltner_length)
K_upper = K_ma + K_rangema * Keltner_multiple
K_lower = K_ma - K_rangema * Keltner_multiple
K_width = K_upper - K_lower

B_source = close
Bollinger_length = input(title="Bollinger Length", defval=20, minval=1)
Bollinger_multiple = input(title="Bollinger Multiple", defval=2.0, minval=0.001, maxval=50)
B_basis = sma(B_source, Bollinger_length)
B_dev = Bollinger_multiple * stdev(B_source, Bollinger_length)
B_upper = B_basis + B_dev
B_lower = B_basis - B_dev
B_width= B_upper - B_lower

dot_red = iff(B_width < K_width, 0, na)
dot_green = iff(B_width > K_width, 0, na)

plot(dot_red, style=circles, color=red, linewidth=3)
plot(dot_green, style=circles, color=lime, linewidth=3)
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية
Home Stock Screener Forex Signal Finder Cryptocurrency Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators Website & Broker Solutions Widgets Stock Charting Library Feature Request Blog & News FAQ Help & Wiki Twitter
Profile Profile Settings Account and Billing My Support Tickets Contact Support Ideas Published Followers Following Private Messages Chat Sign Out