LazyBear

Squeeze Momentum Indicator [LazyBear]



Fixed a typo in the code where BB multiplier was stuck at 1.5. Thanks @ucsgears for bringing it to my notice.

Updated source: http://pastebin.com/UCpcX8d7

Use the updated source instead of the what TV shows below.



This is a derivative of John Carter's "TTM Squeeze" volatility indicator, as discussed in his book "Mastering the Trade" (chapter 11).

Black crosses on the midline show that the market just entered a squeeze ( Bollinger Bands are with in Keltner Channel). This signifies low volatility , market preparing itself for an explosive move (up or down). Gray crosses signify "Squeeze release".

Mr.Carter suggests waiting till the first gray after a black cross, and taking a position in the direction of the momentum (for ex., if momentum value is above zero, go long). Exit the position when the momentum changes (increase or decrease --- signified by a color change). My (limited) experience with this shows, an additional indicator like ADX / WaveTrend, is needed to not miss good entry points. Also, Mr.Carter uses simple momentum indicator , while I have used a different method (linreg based) to plot the histogram.

More info:
- Book: Mastering The Trade by John F Carter
- Using Squeeze with ADX: http://www.tradethemarkets.com/public/mastering-the-trade-chapter-11-squeeze.cfm

List of all my indicators:

Remove from Favorite Scripts Add to Favorite Scripts
//
// @author LazyBear 
// List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
//
study(shorttitle = "SQZMOM_LB", title="Squeeze Momentum Indicator [LazyBear]", overlay=false)

length = input(20, title="BB Length")
mult = input(2.0,title="BB MultFactor")
lengthKC=input(20, title="KC Length")
multKC = input(1.5, title="KC MultFactor")

useTrueRange = input(true, title="Use TrueRange (KC)", type=bool)

// Calculate BB
source = close
basis = sma(source, length)
dev = multKC * stdev(source, length)
upperBB = basis + dev
lowerBB = basis - dev

// Calculate KC
ma = sma(source, lengthKC)
range = useTrueRange ? tr : (high - low)
rangema = sma(range, lengthKC)
upperKC = ma + rangema * multKC
lowerKC = ma - rangema * multKC

sqzOn  = (lowerBB > lowerKC) and (upperBB < upperKC)
sqzOff = (lowerBB < lowerKC) and (upperBB > upperKC)
noSqz  = (sqzOn == false) and (sqzOff == false)

val = linreg(source  -  avg(avg(highest(high, lengthKC), lowest(low, lengthKC)),sma(close,lengthKC)), 
            lengthKC,0)

bcolor = iff( val > 0, 
            iff( val > nz(val[1]), lime, green),
            iff( val < nz(val[1]), red, maroon))
scolor = noSqz ? blue : sqzOn ? black : gray 
plot(val, color=bcolor, style=histogram, linewidth=4)
plot(0, color=scolor, style=cross, linewidth=2)
What is the significance of those black trend lines over the momentum indicators ?
+5 Reply
Hi, guys. What mean light-green and red and dark-green and red columns of this indicator?
+4 Reply
@Holden1, Did you ever find out the answer to this?
+1 Reply
@Holden1,
I believe that those colors to easier identify the directions of the histogram's bars:

light green-rising, dark green- falling
light red-falling, dark red-rising

So, if you are riding a long position up, it's suggested to get out when light green changes to dark green ( indicator goes down)
Reverse is true for a short position-get out when light red turns to dark ( indicator goes up)
+4 Reply
is this valid anymore? rather quiet here.
+1 Reply
This helps with my London breakout strategy on nadex platform. Made my first $1,000 profit trade in about 3 hours last Friday ;-)
+4 Reply
Is it possible within TV to setup an alert when the squeeze releases, the gray cross?
+4 Reply
@dignus, Yes, you need to edit the pinescript to add the alert condition though. The syntax for creating a custom alert condition is "alertcondition(condition, title, message)."

If you're not familiar with pine, condition is the variable linked to the set of conditions that will trigger the alert once activate, title is what the alert will appear as in the alert creation menu, and message is the default message (although you can still change it in the alert creation menu. For condition, in this case you would use sqzOff, since that is what LazyBear named the variable in the code. So pretty much you would view the source code for this indicator, chose the "create copy" option, and in your copy add something to the effect of "alertcondition(sqzOff, 'Squeeze Off', 'Security has exited squeeze')." You should add this to the end of the code, since it needs to come after sqzOff has been defined.

Also, note that this will not actually create an alert, it just will add the option to create an alert from the normal create alert dialogue.
+2 Reply
Very nice job, thanks! Years now, after reading "Mastering the Trade", used BB 20, 2 with KC 20, 1.5 overlaid to see squeeze come off with a 5 period Momemtum. The ADX here is a nice touch. Keep it up, thanks again and Keep Smiling!
+1 Reply
Hi, LazyBear:

Thanks much for this. Am I correct in thinking that if I wanted to change the color of the CROSSES--I'm having a hard time distinguishing the grey/black from each other--I can edit line 38? And replace black : gray with the colors I want? I realize it's been a loooooooong time since you released this (I'm using V2--I hope!), but if you could confirm that, that would be great. I'll give it a go myself, but I wouldn't mind a bit of confirmation. :-)

Again--many thanks for this and all your fab work.
Reply
United States
United Kingdom
India
Deutschland
France
España
Italia
Polska
Türkiye
Россия
Brasil
Indonesia
Malaysia
ประเทศไทย
Việt Nam
日本
한국
简体
繁體
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