# Spyfrat BB50 Strategy

315 2
BB50 Strategy from Spyfrat (Hernan Segovia) concept
```// @author Senpai
// List of all my indicators: https://www.tradingview.com/v/4IneGo8h/
//
study(title = "Spyfrat BB50 Strategy", shorttitle = "SpyfratBB50")
source = close
length = input(50, minval=1)
mult = input(0.2, title="Mult Factor", minval=0.001, maxval=50)
impulseLevel=input(0.40)
showRange = input(false, type=bool)

// Calc BB
basis = sma(source, length)
dev = mult * stdev(source, length)
upper = basis + dev
lower = basis - dev
// Calc Impulse
//bbr = ((source - lower)/(upper - lower))/10
//bbi = bbr - nz(bbr[1])
//bbc = iff(bbi>0,
//        iff(bbi>alertLevel and bbi<impulseLevel, lime, iff(bbi>impulseLevel, orange, aqua)),
//        iff(bbi<-alertLevel and bbi>-impulseLevel, red, iff(bbi<-impulseLevel, orange, aqua))
//        )
bbr = source>upper?(((source-upper)/(upper-lower))/10): source<lower?(((lower-source)/(upper-lower))/10) : 0.1
bbi = bbr - nz(bbr[1])
bbc = iff(bbi>0,
iff(bbi>alertLevel and bbi<impulseLevel, lime, iff(bbi>impulseLevel, orange, aqua)),
iff(bbi<-alertLevel and bbi>-impulseLevel, red, iff(bbi<-impulseLevel, orange, aqua))
)
// Plot Ian Woodward's suggested Reference Levels
plot(0, color=gray, title="MidLine", style=3)
plot( impulseLevel, color=gray, style=line, linewidth=1, title="Impulse+")
plot( -impulseLevel, color=gray, style=line, linewidth=1, title="Impulse-")

plot(showRange ? bbr : na, color=gray, style=area, title="Range+", linewidth=0, transp=80)
plot(showRange ? -bbr : na, color=gray, style=area, title="Range-", linewidth=0, transp=80)

plot(bbi, color=bbc, style=histogram, linewidth=2)

```
sir @senpai , paano po gamitin ung sa pinakababa na graph?
galing naman po nito :)
EN English
EN English (UK)
EN English (IN)
DE Deutsch
FR Français
ES Español
IT Italiano
PL Polski
SV Svenska
TR Türkçe
RU Русский
PT Português
ID Bahasa Indonesia
MS Bahasa Melayu
TH ภาษาไทย
VI Tiếng Việt
JA 日本語
KO 한국어
ZH 简体中文
ZH 繁體中文
AR العربية