36 lines
1022 B
Plaintext
36 lines
1022 B
Plaintext
//
|
|
// @author LazyBear
|
|
//
|
|
// List of my public indicators: http://bit.ly/1LQaPK8
|
|
// List of my app-store indicators: http://blog.tradingview.com/?p=970
|
|
//
|
|
//
|
|
study("Impulse MACD [LazyBear]", shorttitle="IMACD_LB", overlay=false)
|
|
lengthMA = input(34)
|
|
lengthSignal = input(9)
|
|
calc_smma(src, len) =>
|
|
smma=na(smma[1]) ? sma(src, len) : (smma[1] * (len - 1) + src) / len
|
|
smma
|
|
|
|
calc_zlema(src, length) =>
|
|
ema1=ema(src, length)
|
|
ema2=ema(ema1, length)
|
|
d=ema1-ema2
|
|
ema1+d
|
|
|
|
src=hlc3
|
|
hi=calc_smma(high, lengthMA)
|
|
lo=calc_smma(low, lengthMA)
|
|
mi=calc_zlema(src, lengthMA)
|
|
|
|
md=(mi>hi)? (mi-hi) : (mi<lo) ? (mi - lo) : 0
|
|
sb=sma(md, lengthSignal)
|
|
sh=md-sb
|
|
mdc=src>mi?src>hi?lime:green:src<lo?red:orange
|
|
plot(0, color=gray, linewidth=1, title="MidLine")
|
|
plot(md, color=mdc, linewidth=2, title="ImpulseMACD", style=histogram)
|
|
plot(sh, color=blue, linewidth=2, title="ImpulseHisto", style=histogram)
|
|
plot(sb, color=maroon, linewidth=2, title="ImpulseMACDCDSignal")
|
|
|
|
ebc=input(false, title="Enable bar colors")
|
|
barcolor(ebc?mdc:na) |