LazyBear

Trading Strategy based on BB/KC squeeze

28280 lượt xem
1852
28280 21
**** [Edit: New version (v02) posted, see the comments section for the code *****

Simple strategy. You only consider taking a squeeze play when both the upper and lower Bollinger Bands go inside the Keltner Channel. When the Bollinger Bands (BOTH lines) start to come out of the Keltner Channel, the squeeze has been released and a move is about to take place.

More info : http://www.hiltinvestmentfund.com/html/s...

I have added more support indicators -- I highlight the bullish / bearish KC breaches (using GREEN/RED crosses) and a SAR to see where price action is trending.

Appreciate any feedback. Enjoy!

Color codes for v02:
----------------------------
When both the upper and lower Bollinger Bands go inside the Keltner Channel, the squeeze is on and is highlighted in RED.
When the Bollinger Bands (BOTH lines) start to come out of the Keltner Channel, the squeeze has been released and is highlighted in GREEN.
When one of the Bollinger Bands is out of Keltner Channel, no highlighting is done (this means, the background color shows up, so don't get confused if you have RED/GREEN in your chart's bground :))

Color codes for v01:
----------------------------
When both the upper and lower Bollinger Bands go inside the Keltner Channel, the squeeze is on and is highlighted in YELLOW.
When the Bollinger Bands (BOTH lines) start to come out of the Keltner Channel, the squeeze has been released and is highlighted in BLUE.
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích
//
// @author LazyBear
// @credits http://www.hiltinvestmentfund.com/html/squeeze.html
// Trading strategy based on Bollinger Bands & Keltner Channel. Added SAR / Highlights to make it really easy ;)
// v01 - initial release
//
study(shorttitle = "TS 1 [LB]", title="Trading strategy [BB / KC] [LazyBear]", overlay=true)

length = input(20, minval=1, title="Length"), mult = input(1.0, minval=0.001, maxval=50, title="MultFactor")
// showBarColor = input(true, title="Highlight Bear/Bull points (KC)", type=bool)
showBarColor = false
useTrueRange = input(false, title="Use TrueRange (KC)", type=bool)
// Note that "highlightStrategy" takes precedence over showBarColor. 
highlightStrategy = input(true, title="Highlight strategy points", type=bool)

startSAR = input(0.02, title="Start (SAR)")
incrementSAR = input(0.02, title="Increment (SAR)")
maximumSAR = input(0.2, title="Maximum (SAR)")

// Calculate BB
source = close
basis = sma(source, length)
dev = mult * stdev(source, length)
upperBB = basis + dev
lowerBB = basis - dev
plot(basis, color=red, linewidth=2)
p1 = plot(upperBB, color=red,  linewidth=2)
p2 = plot(lowerBB, color=red, linewidth=2)
fill(p1, p2, color = red)

// Calculate KC
ma = ema(source, length)
range = useTrueRange ? tr : high - low
rangema = ema(range, length)
upper = ma + rangema * mult
lower = ma - rangema * mult
c = lime
u = plot(upper, color=c, title="Upper")
plot(ma, color=c, title="Basis")
l = plot(lower, color=c, title="Lower")
fill(u, l, color=green, transp=80)

offset = 2
bearish = low < lower
bear_point = bearish ? (low-offset) : na
bear_color = bearish ? red : na
bullish = high > upper
bull_point = bullish ? (high+offset) : na
bull_color = bullish ? green : na

bar_color = bearish ? bear_color : (bullish ? bull_color : na)
plot(bear_point, color = bear_color, style=cross, linewidth=2)
plot(bull_point, color = bull_color, style=cross, linewidth=2)

bgcolor((showBarColor and not highlightStrategy) ? bar_color : na)

strat_sqz_color = ((upperBB < upper) and (lowerBB > lower)) ? yellow : blue
bgcolor(highlightStrategy ? strat_sqz_color : na)

// SAR
outSAR = sar(startSAR, incrementSAR, maximumSAR)
plot(outSAR, style=cross, color=blue)
Tried to apply this to ETHBTC on Poloniex, and it turns into a flat line.
It appeared as if something was being plotted to high and low on the chart, condensing the whole chart into a flat line.
So I commented out the plotting of the bear and bull points, and it seems to be fixed.
Not sure why it would be doing this, or if the chart is actually accurate (given the bull and bear points, appear not to be).
Could you take a look ?
Reproduce:
Simply load ETHBTC for Polo, and add this script to the chart (v2).
Phản hồi
Does it repaint?
Phản hồi
can anyone help me by saying how to add this script to the chart
Phản hồi
Goodmorning Sir . I am a boy of Italian What follows recently trading and are still being studied and wondered if Your Indicator ( trading strategy based on BB / KC SQUEEZE ) , can work with INDEX ITA40 DAX30 and CAC40 . With graphic hour seems to work fine , I advice to match another indicator to confirm entry to the market , or not ?
thanks for your time and congratulations for the work done by you and most of all for sharing.
+2 Phản hồi
Great indicator. Should be the foundation of any trading strategy.
Phản hồi
Giving this a try
+1 Phản hồi
LazyBear CrankMan
Thx. Also, try my custom COG channel - . It employs the same squeeze logic.
+4 Phản hồi
New version (v02) posted - http://pastebin.com/biVqEdg4

Appreciate any feedback/comments.

Changelog:
-----------------
- Fixed the SqzRelease condition (only if both BB lines come out, it is marked as a "release").
- Changed the color codes
- Updated the default multFactor to be 2

Sample Chart:
------------------

+2 Phản hồi
pantheo LazyBear
Great work my friend! I love this technique and using it when chance present during the last two years since Fibline recommended it in ST first and at his Gensai blog later. I'll try yours now. The only thing missing now is an automatic database search to publish the squeeze information in advance, before release, in trading instruments and timeframes. I guess could be done easily using even BB% or BB width as criteria when hit the lower levels. All the best to you and yours my friend:-) Panos
+1 Phản hồi
Thx :)
Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Shows Cách thức hoạt động Tính năng Biểu đồ Giá Quy tắc Áp dụng Người điều hành Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Trung tâm Trợ giúp Giới thiệu bạn Yêu cầu tính năng Blog & Tin tức Câu hỏi thường gặp Wiki Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất