NomadandTrader

Bollinger Bands V2 [Super Trend]

################################## Anglais ######################################

With the News Bollinger Bands V2 , you can choose the source of the color (Color with Price or Color with the Super Trend ATR).

You can also view the Super Trend on the chart and the configure.


this allows you to quickly identify trends and the acceleration phase and accumulation

Sorry for my basic English

//J.Dow

################################## Français ######################################



Avec les Nouvelles Bollinger Bands V2 , vous pouvez choisir la source de la couleur ( couleur avec le prix ou la couleur avec le Super Tendance ATR ) .

Vous pouvez aussi consulter le Super Tendance sur le graphique et le configure.


cela vous permet d'identifier rapidement les tendances et la phase d'accélération et d'accumulation

//J.Dow
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 đồ?
//Crée par J.Dow
//Bollinger Band Color + Super Trend
//Version V2
study(shorttitle="Bollinger Bands V2 [Super Trend]", title="Bollinger Bands V2 [Super Trend]", overlay=true)
 
//########################## Parametre  ########################################
src = input(defval=close, title="Source")
length = input(defval=20, minval=1, title ="Boullinger Bands")
mult = input(defval=2.0, minval=0.001, maxval=50)

souc = input(title="Color of the BB with Super Trend", type=bool, defval=false)
Factor=input(title="Super Trend", defval=4, minval=1,maxval = 100)
ATR=input(title="ATR", defval=12, minval=1,maxval = 100)
spt = input(title="View Super Trend on chart", type=bool, defval=false)


//######################## Bollinger Bands #####################################

basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev

//########################## Super Trend #######################################

Up=hl2-(Factor*atr(ATR))
Dn=hl2+(Factor*atr(ATR))
TUp=src[1]>TUp[1]? max(Up,TUp[1]) : Up
TDown=src[1]<TDown[1]? min(Dn,TDown[1]) : Dn
Trend = src > TDown[1] ? 1: src < TUp[1]? -1: nz(Trend[1],1)
Tsl = Trend==1? TUp: TDown
TslView = spt == true ? Tsl : false
//############################# couleur ##########################################

linecolorATR = Trend == 1 ? green : red
linecolorPrice = src >= basis ? green : red
linecolor = souc == true ? linecolorATR : linecolorPrice

//########################### Affichage ########################################

plot(TslView, color = linecolorATR , style = line , linewidth = 2, title = "SuperTrend")
plot(basis, color=red, transp=75, title="Moving Average")
p1 = plot(upper, color=linecolor, transp=35, title="high band")
p2 = plot(lower, color=linecolor, transp=35, title="Low band")
fill(p1, p2, color=linecolor, transp=95, title="background")