Yauheni

YK Fuller Bars

The script highlights "Fuller's pins" and generates alerts when these bars are appearing
Script open-source

Dans le plus pur esprit de TradingView, l'auteur de ce texte l'a publié en open-source, afin que les traders puissent le comprendre et le vérifier. Bravo à l'auteur ! Vous pouvez l'utiliser gratuitement, mais la réutilisation de ce code dans une publication est régie par les règles internes. Vous pouvez le mettre en favori pour l'utiliser sur un graphique.

Vous voulez utiliser ce script sur un graphique ?
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)

minRlDistance = input(title="Minimum distance from Pin-Bar to the round level", type=float, defval=0,  minval=0)
floatCount = input(title="The count of digits after the decimal point (for example, 3 - for GBPJPY, 5 - for EURUSD )", type=integer, defval=5,  minval=3, maxval=5)

rDelimeter = (floatCount == 3) ? 1000 : (floatCount == 4 ? 10000 : 100000)

intRoundLevel = close * rDelimeter
intRemainder = intRoundLevel % 1000
toRound = (intRemainder >= 500) ? 1000 : 0
roundLevel = (intRoundLevel - intRemainder + toRound) / rDelimeter
rlDistance = abs(close - roundLevel)

showRl = input(title="Show round levels?", type=bool, defval=false)
roundLevelPlot = iff(showRl, roundLevel, na)
plot(roundLevelPlot, title='Round Level', color=lime, style=circles, linewidth=2)

iIb = input(title="Ignore inside bars?", type=bool, defval=true)
insideBar = iIb and 
            ((high <= high[1] and 
            low >= low[1]) 
            or
            (high <= high[2] and 
            low >= low[2] 
            and 
            high[1] <= high[2] and 
            low[1] >= low[2]) 
            or
            (high <= high[3] and 
            low >= low[3]
            and 
            high[2] <= high[3] and 
            low[2] >= low[3]
            and 
            high[1] <= high[3] and 
            low[1] >= low[3])
            or
            (high <= high[4] and 
            low >= low[4]
            and 
            high[3] <= high[4] and 
            low[3] >= low[4]
            and 
            high[2] <= high[4] and 
            low[2] >= low[4]
            and 
            high[1] <= high[4] and 
            low[1] >= low[4])
            or
            (high <= high[5] and 
            low >= low[5]
            and 
            high[4] <= high[5] and 
            low[4] >= low[5]
            and 
            high[3] <= high[5] and 
            low[3] >= low[5]
            and 
            high[2] <= high[5] and 
            low[2] >= low[5]
            and 
            high[1] <= high[5] and 
            low[1] >= low[5])
            or
            (high <= high[6] and 
            low >= low[6]
            and 
            high[5] <= high[6] and 
            low[5] >= low[6]
            and 
            high[4] <= high[6] and 
            low[4] >= low[6]
            and 
            high[3] <= high[6] and 
            low[3] >= low[6]
            and 
            high[2] <= high[6] and 
            low[2] >= low[6]
            and 
            high[1] <= high[6] and 
            low[1] >= low[6])
            or
            (high <= high[7] and 
            low >= low[7]
            and 
            high[6] <= high[7] and 
            low[6] >= low[7]
            and 
            high[5] <= high[7] and 
            low[5] >= low[7]
            and 
            high[4] <= high[7] and 
            low[4] >= low[7]
            and 
            high[3] <= high[7] and 
            low[3] >= low[7]
            and 
            high[2] <= high[7] and 
            low[2] >= low[7]
            and 
            high[1] <= high[7] and 
            low[1] >= low[7])
            or
            (high <= high[8] and 
            low >= low[8]
            and 
            high[7] <= high[8] and 
            low[7] >= low[8]
            and 
            high[6] <= high[8] and 
            low[6] >= low[8]
            and 
            high[5] <= high[8] and 
            low[5] >= low[8]
            and 
            high[4] <= high[8] and 
            low[4] >= low[8]
            and 
            high[3] <= high[8] and 
            low[3] >= low[8]
            and 
            high[2] <= high[8] and 
            low[2] >= low[8]
            and 
            high[1] <= high[8] and 
            low[1] >= low[8]) 
            or
            (high <= high[9] and 
            low >= low[9]
            and 
            high[8] <= high[9] and 
            low[8] >= low[9]
            and 
            high[7] <= high[9] and 
            low[7] >= low[9]
            and 
            high[6] <= high[9] and 
            low[6] >= low[9]
            and 
            high[5] <= high[9] and 
            low[5] >= low[9]
            and 
            high[4] <= high[9] and 
            low[4] >= low[9]
            and 
            high[3] <= high[9] and 
            low[3] >= low[9]
            and 
            high[2] <= high[9] and 
            low[2] >= low[9]
            and 
            high[1] <= high[9] and 
            low[1] >= low[9]) 
            or
            (high <= high[10] and 
            low >= low[10]
            and 
            high[9] <= high[10] and 
            low[9] >= low[10]
            and 
            high[8] <= high[10] and 
            low[8] >= low[10]
            and 
            high[7] <= high[10] and 
            low[7] >= low[10]
            and 
            high[6] <= high[10] and 
            low[6] >= low[10]
            and 
            high[5] <= high[10] and 
            low[5] >= low[10]
            and 
            high[4] <= high[10] and 
            low[4] >= low[10]
            and 
            high[3] <= high[10] and 
            low[3] >= low[10]
            and 
            high[2] <= high[10] and 
            low[2] >= low[10]
            and 
            high[1] <= high[10] and 
            low[1] >= low[10])) 
            ? true : false
            
emaCrossing = input(title="ЕМА crossing?", type=bool, defval=true)

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
           ((rlDistance > minRlDistance and
           fakeHighUp * 2 < fakeLowUp and 
           bodyHeight > fakeHighUp and 
           ema1 >= low and
           close > ema1 and
           open > ema1 and
           close > ema2 and
           open > ema2 and
           ((emaCrossing and ema1 > ema2) or emaCrossing == false) and
           open > (close - pinHeightUp * tail1) and
           close > (high - pinHeightUp * tail1)) 
           or 
           (rlDistance > minRlDistance and
           fakeHighUp > fakeLowUp * 2 and
           bodyHeight > fakeLowUp and
           high >= ema1 and
           close < ema1 and
           close < ema2 and
           ((emaCrossing and ema1 < ema2) or emaCrossing == false) and
           open < (high - pinHeightUp * tail) and
           close < (high - pinHeightUp * tail))) 
           ? true : false
           
pinBarUp = getPinBarUp(ema1, ema2)
          
fakeHighDn = high - open
fakeLowDn = close - low

pinHeightDn = height - min(fakeHighDn, fakeLowDn)

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

pinBarDn = getPinBarDn(ema1, ema2)

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 and insideBar == false) ? 999 : -999
plot(hl2 + hl2Change, title='Alert', style=area, transp=100, editable=false)


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

Commentaires

Do not forget to set this checkbox:

https://i.gyazo.com/9da98f43b3150117d2b4afcad4c52c87.png
+1 Répondre
Accueil Screener d'actions Screener Forex Screener Crypto Calendrier économique A propos Caractéristiques du graphique Prix Parrainer un ami Règles de conduite Centre d'aide Solutions site web & courtier Widgets Solutions de cartographie Bibliothèque de graphiques allégés Blog & News Twitter
Profil Paramètres du Profil Compte et Facturation Amis référés Coins Mes tickets au support Centre d'aide Messages privés Chat Se Déconnecter