Yauheni

YK Fuller Bars

The script highlights "Fuller's pins" and generates alerts when these bars are appearing
Remove from Favorite Scripts Add to Favorite Scripts
study("YK Fuller Bars", overlay=true)

pTail = input(title="Tail (default 45), %", type=integer, defval=45,  minval=0, maxval=100)
tail = pTail * 0.01
tail1 = 1 - tail

ema1Value = input(title="EMA (default 8)", type=integer, defval=8,  minval=1)
ema2Value = input(title="EMA (default 21)", type=integer, defval=21,  minval=1)

ema1 = ema(close, ema1Value)
ema2 = ema(close, ema2Value)

height = high - low
bodyHeight = abs(open - close)

fakeHighUp = high - close
fakeLowUp = open - low

pinHeightUp = height - min(fakeHighUp, fakeLowUp)

getPinBarUp(ema1, ema2) => open < close and 
           ((fakeHighUp * 2 < fakeLowUp and 
           bodyHeight > fakeHighUp and 
           ema1 >= low and
           close > ema1 and
           open > ema1 and
           close > ema2 and
           open > ema2 and
           open > (close - pinHeightUp * tail1) and
           close > (high - pinHeightUp * tail1)) 
           or 
           (fakeHighUp > fakeLowUp * 2 and
           bodyHeight > fakeLowUp and
           high >= ema1 and
           close < ema1 and
           close < ema2 and
           open < (high - pinHeightUp * tail) and
           close < (high - pinHeightUp * tail))) 
           ? true : false
           
pinBarUp1 = getPinBarUp(ema1, ema2)            
pinBarUp = pinBarUp1 ? pinBarUp1 : getPinBarUp(ema2, ema1)
          
fakeHighDn = high - open
fakeLowDn = close - low

pinHeightDn = height - min(fakeHighDn, fakeLowDn)

getPinBarDn(ema1, ema2) => open > close and
           ((fakeHighDn > fakeLowDn * 2 and
           bodyHeight > fakeLowDn and
           high >= ema1 and
           close < ema1 and
           open < ema1 and
           close < ema2 and
           open < ema2 and
           open < (high - pinHeightDn * tail) and
           close < (high - pinHeightDn * tail))
           or 
           (fakeHighDn * 2 < fakeLowDn and
           bodyHeight > fakeHighDn and
           ema1 >= low and
           ema1 < close and
           ema2 < close and
           open > (open - pinHeightDn * tail1) and
           close > (open - pinHeightDn * tail1)))
           ? true : false

pinBarDn1 = getPinBarDn(ema1, ema2)            
pinBarDn = pinBarDn1 ? pinBarDn1 : getPinBarDn(ema2, ema1)

highlightBars = input(title="Highlight bars", type=bool, defval=true)
enableAlerts = input(title="Enable alerts", type=bool, defval=true)

 
//Temporary fix for alerts  
hl2Change = ((pinBarUp or pinBarDn) and enableAlerts) ? 999 : -999
plot(hl2 + hl2Change, style=area, transp=100, editable=false)


barcolor((pinBarUp and highlightBars) ? lime : na, title="Bullish bar")
barcolor((pinBarDn and highlightBars) ? red : na, title="Bearish bar")


Yauheni
a year ago
If you want to set alert you can just create horizontal line and set alert here:

https://i.gyazo.com/57a84008bd189b0ee0985958a73fb9e3.png
Reply
Yauheni
a year ago
Also do not forget to set this checkbox:

https://i.gyazo.com/9da98f43b3150117d2b4afcad4c52c87.png
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out