rmwaddelljr

LBR PaintBars [LazyBear]

204
I wanted to use the indicator LazyBear published and use StDev instead of ATR. This is my first time doing this so I'd appreciate suggestions. I will say this too; as helpful as indicators are in general (some more than others), the most important "indicator" you can use is the one between your ears. Controlling emotion, having a reliable plan followed with discipline. That gives one the decided "edge".
Open-source Skript

Ganz im Spirit von TradingView hat der Autor dieses Skripts es als Open-Source veröffentlicht, damit Trader es besser verstehen und überprüfen können. Herzlichen Glückwunsch an den Autor! Sie können es kostenlos verwenden, aber die Wiederverwendung dieses Codes in einer Veröffentlichung unterliegt den Hausregeln. Sie können es als Favoriten auswählen, um es in einem Chart zu verwenden.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.

Möchten Sie dieses Skript auf einem Chart verwenden?
//
// @author LazyBear
// List of all my indicators:
// https://docs.google.com/document/d/15AGCufJZ8CIUvwFJ9W-IKns88gkWOKBCvByMEvm5MLo/edit?usp=sharing
//
study("LBR PaintBars [LazyBear]", overlay=true, shorttitle="LBRBARS_LB")
lbperiod = input (16, title="HL Length")
atrperiod = input (9, title= "ATR Length")
stdev = input(20, title= "St Dev Length")
mult = input (2.5, minval=0, title="ATR Multiplier")
bcf = input(true, title="Color LBR Bars?")
mnlb=input(false, title="Color non LBR Bars?" )
svb=input(false, title="Show Volatility Bands?")
mkb=input(true, title="Mark LBR bars above/below KC?")
lengthKC = input(20, minval=1, title="KC Length")
multKC = input(1.5, title="KC Multiplier")
useTR = input(true, title="Use TR for KC")
skb=input(false, title="Show KC?")
calc_stdev(source, useTR, length, mult) =>
    ma = ema(source, length)
    range = useTR ? tr : high - low
    rangema = ema(range, length)
    upper = ma + rangema * mult
    lower = ma - rangema * mult
    [upper, ma, lower]
 
[u,b,l] = calc_stdev(close, useTR, lengthKC, multKC)
uk=plot(skb?u:na, color=gray, linewidth=1, title="KC Upper"), lk=plot(skb?l:na, color=gray, linewidth=1, title="KC Lower")
fill(uk,lk,gray), plot(skb?b:na, style=circles, color=orange, linewidth=2, title="KC Basis")
kct=mkb ? (close >= u or close <= l) : false
aatr = mult * sma(stdev(close,atrperiod), atrperiod)
b1 = lowest(low, lbperiod) + aatr
b2 = highest(high, lbperiod) - aatr
uvf =  (close > b1 and close > b2)
lvf = (close < b1 and close < b2 )
uv = plot(svb?b2:na, style=line, linewidth=3, color=red, title="UpperBand")
lv = plot(svb?b1:na, style=line, linewidth=3, color=green, title="LowBand")
bc = (bcf ? kct?fuchsia:(uvf ? lime : lvf ? maroon : mnlb?blue:na) : (not (uvf or lvf) and mnlb ? blue : na ) )
barcolor(bc)