LazyBear

Firefly Oscillator [LazyBear]

This is a modified version of a public Amibroker indicator, called Firefly.

I disabled the additional smoothing (you can enable it via options page) and updated the visual rendering (simple 3D look, histo, bar colors et al). Also, have added an option to show enclosing BB.

You can trade this like any other oscillator -- 80/20 OB/OS levels, divergences, ...

Here's a chart showing some possible customizations that are supported:

Do let me know what you guys think.

List of my public indicators: bit.ly/1LQaPK8
List of my app-store indicators: blog.tradingview.com/?p=970

List of my free indicators: bit.ly/1LQaPK8
List of my indicators at Appstore: blog.tradingview.com/?p=970
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
//
// @author LazyBear 
// 
// List of my public indicators: http://bit.ly/1LQaPK8 
// List of my app-store indicators: http://blog.tradingview.com/?p=970 
//
// Original idea from a public Amibroker indicator published by @Yasu
//
study(title = "Firefly Oscillator [LazyBear]", shorttitle="FIREFLY_LB")
m=input(10,title= "Lookback Length", minval= 5, maxval=20)
n1=input(3, title="Signal Smoothing", minval=3, maxval=10)
as=input(false, title="Double smooth Osc")
bt=input(false, title="Use ZLEMA")
seb=input(false, title="Show Enclosing BB")
lbb=input(20, title="Enclosing BB Length")
mbb1=input(2.0, title="Enclosing BB Multiplier")
hbr=input(false, title="Highlight Breaches")
ebc=input(false, title="Enable bar colors")
calc_zlema(src, length) =>
	ema1=ema(src, length)
	ema2=ema(ema1, length)
	d=ema1-ema2
	ema1+d
ma(s,l) => bt==false?ema(s,l):calc_zlema(s,l)
v2=(high+low+close*2)/4
v3=ma(v2,m)
v4=stdev(v2,m)
v5=(v2-v3)*100/iff(v4==0,1,v4)
v6=ma(v5,n1)
v7=as?ma(v6,n1):v6
ww=(ma(v7,m)+100)/2-4 
mm=highest(ww,n1) 
plot(ww!=50 and mm!=50 and ((ww>50 and mm>50) or (ww<50 and mm<50))?50:na, color=gray, style=linebr, title="Midline")
d=ww>50?min(ww,mm):mm<50?max(ww,mm):na
dc=d>50?d>d[1]?green:orange:d<d[1]?red:orange
plot(seb?na:d, title="Histo", linewidth=2, color=dc, histbase=50, style=histogram) 
wwl=plot(ww, title="Oscillator", linewidth=1, color=red) 
mml=plot(mm, title="Signal", linewidth=1, color=green) 
fill(wwl,mml,red, transp=60, title="OscillatorSignal Fill")
basis = seb?sma(ww, lbb):na
dev = seb?mbb1 * stdev(ww, lbb):na
upper = seb?basis + dev:na
lower = seb?basis - dev:na
// Uncomment the next line to show BB midline
//plot(basis, color=#0066CC, title="Enclosing BB Mid") 
p1 = plot(seb?upper:na, color=gray, title="Enclosing BB Upper")
p2 = plot(seb?lower:na, color=gray, title="Enclosing BB Lower")
fill(p1,p2, gray, title="Enclosing BB Fill")
b_color = (ww > upper) ? red : (ww < lower) ? green : na
bgcolor(hbr ? b_color : na)
bc=ebc?d>50?d>d[1]?lime:orange:d<d[1]?red:orange:na
barcolor(bc)