Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
- // © danielx888
- // Credits to Joy_Bangla for the Leledc exhaustion bar code
- // Credits to VishvaP for the 34 EMA bands code
- // Credits to SlumdogTrader for the BB exhaustion code (edited for functionality)
- // Credits to Juanc2316 for his code for BB Keltner Squeeze
- //@version=5
- indicator(title='EMA bands trend and scalping indi w/ alerts', shorttitle='Trend Pooristics', overlay=true, max_bars_back=200)
- //////USER INPUTS
- //INPUT: OPEN
- i_EMAlength = input.int (34, 'EMA Length', minval=1, step=1)
- i_topMBmult = input.float (1, 'Top middle band multiplier', 0.1,3,step=0.1,group='Open Conditions')
- i_botMBmult = input.float (1, 'Bottom middle band multiplier',0.1,3,step=0.1,group='Open Conditions')
- s_useSlowEMA = input.bool (false, title='Use slow EMA filter',tooltip='Condition does not apply to counter-trend trades', group='Open Conditions')
- i_slowEMAlen = input.int (200, title='Slow EMA Length', step=1, minval=1, group='Open Conditions')
- //INPUT: CLOSE
- i_midClose = input.string('Opposite band', 'Close on crosses through middle EMA bands', tooltip='Selecting "Delayed bars inside" will closing positions after specified amount of candles close in between the middle EMA bands without breaking out', options=['Nearest band', 'Opposite band', 'Delayed bars inside'], group='Close Conditions')
- i_numBars = input.int (4, 'Delayed close no. of bars', minval=1, maxval=10, step=1, group='Close Conditions')
- s_whichBuySellBars = input.string('Inner', 'Which Buy/Sell zone?', options=['Inner', 'Outer'], group='Close Conditions')
- //INPUT: KELTNER BUY/SELL ZONES
- s_keltnerBuySell = input.bool (false, 'Use Keltner channel multiples for "Buy/Sell Zones"',tooltip='Enables inputting custom multiples and a different/smoother calculation of "Buy/Sell Zones". Default calculation is a multiple of EMA band highs and lows', group='Keltner Buy/Sell Zones')
- i_mult = input.float (5.0, "Outer Multiplier", tooltip='Only for "Buy/Sell Zones" calculated by Keltner channels', group='Keltner Buy/Sell Zones')
- i_innerMult = input.float (3.0, "Inner Multiplier", tooltip='Only for "Buy/Sell Zones" calculated by Keltner channels', group='Keltner Buy/Sell Zones')
- //INPUT: VOLATILITY SQUEEZE FILTER
- s_squeezeFilter = input.bool (false, 'Filter out trades during BB-Keltner squeezes', group= 'BB-Keltner squeze')
- i_bbCondition = input.string('At Least One', title='Bollinger Band Crossover Condition', options=['Both', 'At Least One'], group= 'BB-Keltner squeze')
- i_bbSqueezeLength = input.int (30, minval=1, title='BB Length', group= 'BB-Keltner squeze')
- i_ktSqueezeLength = input.int (18, minval=1, title='Keltner Length', group= 'BB-Keltner squeze')
- s_useRes = input.bool (false, 'Use current timeframe', group= 'BB-Keltner squeze')
- res = (s_useRes ? '' :input.timeframe('360', 'Resolution for BB-Keltner squeeze', group= 'BB-Keltner squeze'))
- i_B2mult = input.float (2, minval=0.001, maxval=50, title='BB Standard Deviation', group= 'BB-Keltner squeze')
- i_Kmult = input.float (1.5, title='Keltner Range', group= 'BB-Keltner squeze')
- //INPUT: BOLLINGER BANDS EXHAUSTION BARS
- i_BBlength = input.int (20, minval=1, title='Bollinger Bands SMA Period Length', group='Bollinger Bands Exhaustion Bar Settings')
- i_BBmult = input.float (1.8, minval=0.001, maxval=50, title='Bollinger Bands Standard Deviation', group='Bollinger Bands Exhaustion Bar Settings')
- i_RSIlength = input.int (8, minval=1, step=1, title='RSI Period Length', group='Bollinger Bands Exhaustion Bar Settings')
- i_RSIos = input.int (30, minval=0, maxval=50, step=1,title='RSI Oversold Value', group='Bollinger Bands Exhaustion Bar Settings')
- i_RSIob = input.int (70, minval=50, maxval=100, step=1, title='RSI Overbought value', group='Bollinger Bands Exhaustion Bar Settings')
- i_srcBB = input.source(close, title='Source', group='Bollinger Bands Exhaustion Bar Settings')
- //INPUT: LELEDC
- s_reqLeleBuySell = input.bool (false, 'Require Leledc to fall outside Buy/Sell zone to show', group='Leledc Exhaustion Bar Settings')
- i_ctLeleBuySell = input.string('Inner', 'Leledc/BB must be outside which Buy/Sell zone to open', options=['Inner', 'Outer'], group='Leledc Exhaustion Bar Settings')
- i_leleVol = input.bool (false, 'Require Volume breakout for Leledc bars', group='Leledc Exhaustion Bar Settings')
- i_volMult = input.float (1.5,'Volume Multiplier', 0.1,20,0.1, group='Leledc Exhaustion Bar Settings')
- i_majLen = input.int (30, 'Highest / Lowest', group='Leledc Exhaustion Bar Settings')
- i_majQual = input.int (6, 'Bar count no', group='Leledc Exhaustion Bar Settings')
- i_closeVal = input.int (4, 'Close', group='Leledc Exhaustion Bar Settings')
- i_bindexSindex = input.int (1, 'bindexSindex', group='Leledc Exhaustion Bar Settings')
- //INPUT: VISUAL ELEMENTS
- s_trendColor = input.bool (false, 'Enable Trend Bar Color', tooltip='Color bars green when above mid bands, red when below, and gray when inside. Dark green and dark red bars signal a position is kept open from the delayed close settings.', group='Visual Elements')
- s_showBuySell = input.bool (true, 'Show "Buy/Sell Zones"', group='Visual Elements')
- s_showEMA = input.bool (false, 'Show EMA', group='Visual Elements')
- s_showMiddleBands = input.bool (true, 'Show middle EMA bands', group='Visual Elements')
- s_showSlowEMA = input.bool (false, 'Show Slow EMA', group='Visual Elements')
- s_showMaj = input.bool (true, 'Show Leledc Exhausion Bars', group='Visual Elements')
- s_switch1 = input.bool (true, 'Enable Bollinger Bands exhaustion bar coloring', group='Visual Elements')
- s_switch2 = input.bool (false, 'Enable Bollinger bands exhaustion bar background coloring', tooltip='Enabling this can help visualize when dialing in Bollinger Bands and RSI settings', group='Visual Elements')
- s_colorBuySellBars = input.bool (false, 'Enable Buy/Sell zone failure bar coloring', group='Visual Elements')
- //EMA
- EMA = ta.ema(close, i_EMAlength)
- slowEMA = ta.ema(close, i_slowEMAlen)
- plot(s_showSlowEMA ? slowEMA : na, 'Slow EMA', color.new(color.gray, 20), 3)
- //*****************************
- // SlumdogTrader's Bollinger Bands + RSI Double Strategy - Profit Trailer
- //====================================================================================================//
- //BB VARIABLES
- BBbasis = ta.sma(i_srcBB, i_BBlength)
- BBdev = i_BBmult * ta.stdev(i_srcBB, i_BBlength)
- BBupper = BBbasis + BBdev
- BBlower = BBbasis - BBdev
- //RSI VARIABLES
- vrsi = ta.rsi(i_srcBB, i_RSIlength)
- RSIoverSold = vrsi < i_RSIos
- RSIoverBought = vrsi > i_RSIob
- //BB EXHAUSTION BAR COLOR VARIABLE
- OSOBcolor = RSIoverBought and i_srcBB[1] > BBupper and i_srcBB < BBupper ? color.yellow : RSIoverSold and i_srcBB[1] < BBlower and i_srcBB > BBlower ? color.blue : na
- bgcolor(s_switch2 ? color.new(OSOBcolor,70) : na)
- //====================================================================================================//
- //*****************************
- //KELTNER SELL ZONE
- rangema = s_keltnerBuySell ? ta.rma(high - low, i_EMAlength) : 0.0
- kt_outersell(_ma) =>
- upper = EMA + _ma * i_mult
- upper
- kt_innersell(_ma) =>
- inner_upper = EMA + _ma * i_innerMult
- inner_upper
- kt_outerbuy(_ma) =>
- lower = EMA - _ma * i_mult
- lower
- kt_innerbuy(_ma) =>
- inner_lower = EMA - _ma * i_innerMult
- inner_lower
- //*****************************
- //*****************************
- // BB-Keltner Squeeze-FVBO-2.0
- // Modified by Juan C for FVBO Strategy, some source code from Trader-Elisa
- //====================================================================================================//
- //VARIABLES FOR HTF SOURCES
- rp_security(_sym, _res, _src)=> request.security(_sym, _res, _src[barstate.ishistory ? 0 : 1], gaps=barmerge.gaps_on)
- srcClose = rp_security(syminfo.tickerid, res, close)
- srcHigh = rp_security(syminfo.tickerid, res, high)
- srcLow = rp_security(syminfo.tickerid, res, low)
- //SQUEEZE BOLLINGER BANDS
- B2basis = ta.sma(srcClose, i_bbSqueezeLength)
- B2dev = i_B2mult * ta.stdev(srcClose, i_bbSqueezeLength)
- B2upper = B2basis + B2dev
- B2lower = B2basis - B2dev
- //SQUEEZE KELTNER CHANNELS
- Kma = ta.ema(srcClose, i_ktSqueezeLength)
- Krange =srcHigh - srcLow
- Krangema = ta.ema(Krange, i_ktSqueezeLength)
- Kupper = Kma + Krangema * i_Kmult
- Klower = Kma - Krangema * i_Kmult
- //DEFINE SQUEEZE
- var bool squeezing = false
- if s_squeezeFilter
- if i_bbCondition == 'Both' and s_useRes
- squeezing := B2upper <= Kupper and B2lower >= Klower ? true : false
- squeezing
- else if i_bbCondition == 'At Least One' and s_useRes
- squeezing := B2upper <= Kupper or B2lower >= Klower ? true : false
- squeezing
- else if i_bbCondition == 'Both'
- squeezing := B2upper[ta.barssince(not srcClose == barstate.isrealtime)] <= Kupper[ta.barssince(not srcClose == barstate.isrealtime)] and B2lower[ta.barssince(not srcClose == barstate.isrealtime)] >= Klower[ta.barssince(not srcClose == barstate.isrealtime)] ? true : false
- squeezing
- else
- squeezing := B2upper[ta.barssince(not srcClose == barstate.isrealtime)] <= Kupper[ta.barssince(not srcClose == barstate.isrealtime)] or B2lower[ta.barssince(not srcClose == barstate.isrealtime)] >= Klower[ta.barssince(not srcClose == barstate.isrealtime)] ? true : false
- squeezing
- //VISUAL
- cross_over_color = (squeezing ? color.new(color.aqua, 90) : na)
- bgcolor(color=cross_over_color, title='Cross Over Identification Color')
- //*****************************
- //*****************************
- // © VishvaP 34 EMA Bands v2
- //====================================================================================================//
- //BUILD EMA MIDDLE BANDS
- highShortEMA = ta.ema(high, i_EMAlength)
- lowShortEMA = ta.ema(low, i_EMAlength)
- middleBandTop = (highShortEMA - EMA) * i_topMBmult + EMA
- middleBandBot = (lowShortEMA - EMA) * i_botMBmult + EMA
- //==============================================//
- //1D Bands [Not Used]
- //bandsHigh = highShortEMA * math.phi
- //bandsLow = lowShortEMA * math.rphi
- //==============================================//
- //INNER BUY/SELL ZONES
- shortbandsHigh = s_keltnerBuySell ? kt_innersell(rangema) : ((highShortEMA - EMA) * math.phi) * math.pi + EMA
- shortbandsLow = s_keltnerBuySell ? kt_innerbuy(rangema) : (-(EMA - lowShortEMA) * math.phi) * math.pi + EMA
- //SMOOTH INNER
- shortbandsHighEMA = ta.wma(shortbandsHigh, 8)
- shortbandsLowEMA = ta.wma(shortbandsLow, 8)
- //==============================================//
- //OUTER BUY/SELL ZONES
- phiExtensionHigh = s_keltnerBuySell ? kt_outersell(rangema) : ((highShortEMA - EMA) * math.phi) * (math.phi + 4) + EMA
- phiExtensionLow = s_keltnerBuySell ? kt_outerbuy(rangema) : (-(EMA - lowShortEMA) * math.phi) * (math.phi + 4) + EMA
- //SMOOTH OUTER
- phiExtensionHighEMA = ta.wma(phiExtensionHigh, 8)
- phiExtensionLowEMA = ta.wma(phiExtensionLow, 8)
- //==============================================//
- //PLOT MIDDLE BANDS AND EMA
- highP1 = plot(s_showMiddleBands ? middleBandTop : na, color = color.new(color.blue, 100), title = "Top median zone")
- lowP1 = plot(s_showMiddleBands ? middleBandBot : na, color = color.new(color.blue, 100), title = "Bottom median zone")
- plot(s_showEMA ? EMA : na, color = color.new(color.gray, 0), title = "EMA")
- //1D bands [not used]
- //highP2 = plot(bandsHigh)
- //lowP2 = plot(bandsLow)
- //PLOT BUY/SELL ZONES
- highP3 = plot(s_showBuySell ? shortbandsHighEMA : na, color = color.new(color.yellow, 100), title = "Inner sell zone")
- lowP3 = plot(s_showBuySell ? shortbandsLowEMA : na, color = color.new(color.teal, 100), title = "Inner buy zone")
- phiPlotHigh = plot(s_showBuySell ? phiExtensionHighEMA : na, color = color.new(color.red, 100), title = "Outer sell zone")
- phiPlotLow = plot(s_showBuySell ? phiExtensionLowEMA : na, color = color.new(color.green, 100), title = "Outer buy zone")
- //==============================================//
- //BUY/SELL ZONE AND MIDDLE BAND COLOR FILLS
- fill(phiPlotHigh, highP3, color.new(color.red, 85), title = "Sell zone")
- fill(lowP3, phiPlotLow, color.new(color.green, 85), title = "Buy zone")
- fill(highP1, lowP1, color.new(color.gray, 70), title = "Median zone")
- //====================================================================================================//
- //*****************************
- //ASSIGN BANDS FOR COUNTERTREND ENTRIES
- float CTbandTop = na
- float CTbandBottom = na
- if i_ctLeleBuySell == 'Inner'
- CTbandTop := shortbandsHighEMA
- CTbandBottom := shortbandsLowEMA
- else
- CTbandTop := phiExtensionHighEMA
- CTbandBottom := phiExtensionLowEMA
- //BUILD VARIABLES FOR CROSSES
- crossUpTopMB = open < middleBandTop and close > middleBandTop
- wiggleUpTopMB = open > middleBandTop and close > middleBandTop and close[1] <= middleBandTop[1]
- crossDownTopMB = open > middleBandTop and close < middleBandTop
- wiggleDownTopMB = open < middleBandTop and close < middleBandTop and close[1] >= middleBandTop[1]
- failTopMB = crossDownTopMB or wiggleDownTopMB
- crossUpBotMB = open < middleBandBot and close > middleBandBot
- wiggleUpBotMB = open > middleBandBot and close > middleBandBot and close[1] <= middleBandBot[1]
- crossDownBotMB = open > middleBandBot and close < middleBandBot
- wiggleDownBotMB = open < middleBandBot and close < middleBandBot and close[1] >= middleBandBot[1]
- failBotMB = crossUpBotMB or wiggleUpBotMB
- crossUpBotInnerRB = open < shortbandsLowEMA and close > shortbandsLowEMA
- wiggleUpBotInnerRB = open > shortbandsLowEMA and close > shortbandsLowEMA and close[1] <= shortbandsLowEMA[1]
- crossUpBotOuterRB = open < phiExtensionLowEMA and close > phiExtensionLowEMA
- wiggleUpBotOuterRB = open > phiExtensionLowEMA and close > phiExtensionLowEMA and close[1] <= phiExtensionLowEMA[1]
- crossUpTopInnerRB = open < shortbandsHighEMA and close > shortbandsHighEMA
- wiggleUpTopInnerRB = open > shortbandsHighEMA and close > shortbandsHighEMA and close[1] <= shortbandsHighEMA[1]
- crossUpTopOuterRB = open < phiExtensionHighEMA and close > phiExtensionHighEMA
- wiggleUpTopOuterRB = open > phiExtensionHighEMA and close > phiExtensionHighEMA and close[1] <= phiExtensionHighEMA[1]
- crossDownBotInnerRB = open > shortbandsLowEMA and close < shortbandsLowEMA
- wiggleDownBotInnerRB = open < shortbandsLowEMA and close < shortbandsLowEMA and close[1] >= shortbandsLowEMA[1]
- crossDownBotOuterRB = open > phiExtensionLowEMA and close < phiExtensionLowEMA
- wiggleDownBotOuterRB = open < phiExtensionLowEMA and close < phiExtensionLowEMA and close[1] >= phiExtensionLowEMA[1]
- crossDownTopInnerRB = open > shortbandsHighEMA and close < shortbandsHighEMA
- wiggleDownTopInnerRB = open < shortbandsHighEMA and close < shortbandsHighEMA and close[1] >= shortbandsHighEMA[1]
- crossDownTopOuterRB = open > phiExtensionHighEMA and close < phiExtensionHighEMA
- wiggleDownTopOuterRB = open < phiExtensionHighEMA and close < phiExtensionHighEMA and close[1] >= phiExtensionHighEMA[1]
- //BUILD VARIABLES FOR CLOSING CONDITIONS
- shortMidBreak = s_squeezeFilter ? (crossDownBotMB or wiggleDownBotMB) and squeezing == false : crossDownBotMB or wiggleDownBotMB
- longMidBreak = s_squeezeFilter ? (crossUpTopMB or wiggleUpTopMB) and squeezing == false: crossUpTopMB or wiggleUpTopMB
- //==============================================//
- //VARIABLES: CONDITIONS OF LOSS OF BUY/SELL ZONES
- var bool crossUpRB = false
- var bool wiggleUpRB = false
- var bool crossDownRB = false
- var bool wiggleDownRB = false
- if s_whichBuySellBars == 'Inner'
- crossUpRB := crossUpBotInnerRB
- wiggleUpRB := wiggleUpBotInnerRB
- crossDownRB := crossDownTopInnerRB
- wiggleDownRB := wiggleDownTopInnerRB
- else
- crossUpRB := crossUpBotOuterRB
- wiggleUpRB := wiggleUpBotOuterRB
- crossDownRB := crossDownTopOuterRB
- wiggleDownRB := wiggleDownTopOuterRB
- reverBarColor = crossDownRB or (wiggleDownRB and not crossDownRB[1]) ? color.orange : crossUpRB or (wiggleUpRB and not crossUpRB[1]) ? color.purple : na
- //DEFINE BARS IN MID
- //return true after specified number of bars (i_numBars) closes inside the mid bands but no breakout
- inMid = close > middleBandBot and close < middleBandTop and open > middleBandBot and open < middleBandTop
- isAllMid() =>
- AllMid = true
- for t = 0 to i_numBars by 1
- if longMidBreak[t] or shortMidBreak[t]
- AllMid := false
- AllMid
- //*****************************
- // © Joy_Bangla Leledc Exhaustion V4
- //====================================================================================================//
- //min = input(false, 'Minor Leledc Exhaustion Bar :: Show')
- //min_qual = input(5, 'Minor Leledc Exhausion Bar :: Bar count no')
- //min_len = input(5, 'Minor Leledc Exhausion Bar :: Bar count no')
- reqLeleBuySell = not s_reqLeleBuySell ? true : i_ctLeleBuySell == 'Inner' ? low < shortbandsLowEMA or high > shortbandsHighEMA : low < phiExtensionLowEMA or high > phiExtensionHighEMA
- leleVol = volume > ta.sma(volume,100)*i_volMult
- lele(qual, len) =>
- bindex = 0
- sindex = 0
- bindex := nz(bindex[i_bindexSindex], 0)
- sindex := nz(sindex[i_bindexSindex], 0)
- ret = 0
- if close > close[i_closeVal]
- bindex += 1
- bindex
- if close < close[i_closeVal]
- sindex += 1
- sindex
- if i_leleVol and not leleVol
- ret := 0
- ret
- else
- if bindex > qual and close < open and high >= ta.highest(high, len) and reqLeleBuySell
- bindex := 0
- ret := -1
- ret
- if sindex > qual and close > open and low <= ta.lowest(low, len) and reqLeleBuySell
- sindex := 0
- ret := 1
- ret
- return_1 = ret
- return_1
- major = lele(i_majQual, i_majLen)
- //minor = lele(min_qual, min_len)
- plotchar(s_showMaj ? major == -1 ? high : na : na, char='•', location=location.absolute, color=color.new(color.red, 0), size=size.small, title='Major Bearish Leledc')
- plotchar(s_showMaj ? major == 1 ? low : na : na, char='•', location=location.absolute, color=color.new(color.lime, 0), size=size.small, title='Major Bullish Leledc')
- //plotchar(min ? minor == 1 ? high : na : na, char='x', location=location.absolute, color=color.new(color.red, 0), size=size.small)
- //plotchar(min ? minor == -1 ? low : na : na, char='x', location=location.absolute, color=color.new(color.lime, 0), size=size.small)
- //leledcMajorBullish = major == 1 ? low : na
- //leledcMajorBearish = major == -1 ? high : na
- //leledcMinorBullish = minor == 1 ? low : na
- //leledcMinorBearish = minor == -1 ? high : na
- //==============================================//
- //alertcondition(leledcMajorBullish, title='Major Bullish Leledc', message='Major Bullish Leledc')
- //alertcondition(leledcMajorBearish, title='Major Bearish Leledc', message='Major Bearish Leledc')
- //alertcondition(leledcMinorBullish, title='Minor Bullish Leledc', message='Minor Bullish Leledc')
- //alertcondition(leledcMinorBearish, title='Minor Bearish Leledc', message='Minor Bearish Leledc')
- //====================================================================================================//
- //*****************************
- //==============================================//
- //SET BAR COLORS
- inFromBelow = ta.barssince(failBotMB) > ta.barssince(failTopMB)
- inFromAbove = ta.barssince(failTopMB) > ta.barssince(failBotMB)
- var colorBar = color.new(color.white, 50)
- if s_trendColor
- if s_switch1
- if s_colorBuySellBars
- if reverBarColor == color.purple or reverBarColor == color.orange
- colorBar := reverBarColor
- else if OSOBcolor == color.yellow or OSOBcolor == color.blue
- colorBar := OSOBcolor
- else if s_useSlowEMA and slowEMA > middleBandTop and close < slowEMA and close > middleBandBot
- colorBar := color.new(color.gray, 0)
- else if s_useSlowEMA and slowEMA < middleBandBot and close > slowEMA and close < middleBandTop
- colorBar := color.new(color.gray, 0)
- else if close > middleBandTop
- colorBar := color.new(color.green, 0)
- else if close < middleBandBot
- colorBar := color.new(color.red, 0)
- else if (i_midClose == 'Opposite band' and inFromBelow) or (i_midClose == 'Delayed bars inside' and inFromBelow and ta.barssince(failTopMB) < i_numBars)
- colorBar := color.new(#0a6136, 20)
- else if (i_midClose == 'Opposite band' and inFromAbove) or (i_midClose == 'Delayed bars inside' and inFromAbove and ta.barssince(inFromAbove) < i_numBars)
- colorBar := color.new(#600008, 20)
- else
- colorBar := color.new(color.gray, 0)
- else
- if OSOBcolor == color.yellow or OSOBcolor == color.blue
- colorBar := OSOBcolor
- else if s_useSlowEMA and slowEMA > middleBandTop and close < slowEMA and close > middleBandBot
- colorBar := color.new(color.gray, 0)
- else if s_useSlowEMA and slowEMA < middleBandBot and close > slowEMA and close < middleBandTop
- colorBar := color.new(color.gray, 0)
- else if close > middleBandTop
- colorBar := color.new(color.green, 0)
- else if close < middleBandBot
- colorBar := color.new(color.red, 0)
- else if (i_midClose == 'Opposite band' and inFromBelow) or (i_midClose == 'Delayed bars inside' and inFromBelow and ta.barssince(failTopMB) < i_numBars)
- colorBar := color.new(#0a6136, 20)
- else if (i_midClose == 'Opposite band' and inFromAbove) or (i_midClose == 'Delayed bars inside' and inFromAbove and ta.barssince(inFromAbove) < i_numBars)
- colorBar := color.new(#600008, 20)
- else
- colorBar := color.new(color.gray, 0)
- else if s_colorBuySellBars
- if reverBarColor == color.purple or reverBarColor == color.orange
- colorBar := reverBarColor
- else if s_useSlowEMA and slowEMA > middleBandTop and close < slowEMA and close > middleBandBot
- colorBar := color.new(color.gray, 0)
- else if s_useSlowEMA and slowEMA < middleBandBot and close > slowEMA and close < middleBandTop
- colorBar := color.new(color.gray, 0)
- else if close > middleBandTop
- colorBar := color.new(color.green, 0)
- else if close < middleBandBot
- colorBar := color.new(color.red, 0)
- else if (i_midClose == 'Opposite band' and inFromBelow) or (i_midClose == 'Delayed bars inside' and inFromBelow and ta.barssince(failTopMB) < i_numBars)
- colorBar := color.new(#0a6136, 20)
- else if (i_midClose == 'Opposite band' and inFromAbove) or (i_midClose == 'Delayed bars inside' and inFromAbove and ta.barssince(inFromAbove) < i_numBars)
- colorBar := color.new(#600008, 20)
- else
- colorBar := color.new(color.gray, 0)
- else
- if s_useSlowEMA and slowEMA > middleBandTop and close < slowEMA and close > middleBandBot
- colorBar := color.new(color.gray, 0)
- else if s_useSlowEMA and slowEMA < middleBandBot and close > slowEMA and close < middleBandTop
- colorBar := color.new(color.gray, 0)
- else if close > middleBandTop
- colorBar := color.new(color.green, 0)
- else if close < middleBandBot
- colorBar := color.new(color.red, 0)
- else if (i_midClose == 'Opposite band' and inFromBelow) or (i_midClose == 'Delayed bars inside' and inFromBelow and ta.barssince(failTopMB) < i_numBars)
- colorBar := color.new(#0a6136, 20)
- else if (i_midClose == 'Opposite band' and inFromAbove) or (i_midClose == 'Delayed bars inside' and inFromAbove and ta.barssince(failBotMB) < i_numBars)
- colorBar := color.new(#600008, 20)
- else
- colorBar := color.new(color.gray, 0)
- else if s_switch1
- if s_colorBuySellBars
- if reverBarColor == color.purple or reverBarColor == color.orange
- colorBar := reverBarColor
- else if OSOBcolor == color.yellow or OSOBcolor == color.blue
- colorBar := OSOBcolor
- else
- colorBar := na
- else
- if OSOBcolor == color.yellow or OSOBcolor == color.blue
- colorBar := OSOBcolor
- else
- colorBar := na
- else if s_colorBuySellBars
- if reverBarColor == color.purple or reverBarColor == color.orange
- colorBar := reverBarColor
- else
- colorBar := na
- else
- colorBar := na
- alertcondition(RSIoverSold and i_srcBB[1] < BBlower and i_srcBB > BBlower, 'Bullish Bollinger Bands Exhaustion Bar', 'Bullish Bollinger Bands Exhaustion Bar')
- alertcondition(RSIoverBought and i_srcBB[1] > BBupper and i_srcBB < BBupper, 'Bearish Bollinger Bands Exhaustion Bar', 'Bearish Bollinger Bands Exhaustion Bar')
- alertcondition(shortMidBreak, 'Middle Bands Breakdown (Short)', 'Middle Bands Breakdown (Short)')
- alertcondition(longMidBreak, 'Middle Bands Breakout (Long)', 'Middle Bands Breakout (Long)')
- alertcondition(squeezing and not squeezing[1], 'Volatility Squeeze Beginning', 'Volatility Squeeze Beginning')
- alertcondition(not squeezing and squeezing[1], 'Volatility Squeeze Ending', 'Volatility Squeeze Ending')
- alertcondition(crossUpTopInnerRB or wiggleUpTopInnerRB, 'Inner Sell Zone Breakout (Close Higher)', 'Inner Sell Zone Breakout (Close Higher)')
- alertcondition(crossUpTopOuterRB or wiggleUpTopOuterRB, 'Outer Sell Zone Breakout (Close Higher)', 'Outer Sell Zone Breakout (Close Higher)')
- alertcondition(crossDownBotInnerRB or wiggleDownBotInnerRB, 'Inner Buy Zone Breakout (Close Lower)', 'Inner Buy Zone Breakout (Close Lower)')
- alertcondition(crossDownBotOuterRB or wiggleDownBotOuterRB, 'Outer Buy Zone Breakout (Close Lower)', 'Outer Buy Zone Breakout (Close Lower)')
- alertcondition(reverBarColor == color.purple, 'Buy Zone Failure Bar', 'Buy Zone Failure Bar')
- alertcondition(reverBarColor == color.orange, 'Sell Zone Failure Bar', 'Sell Zone Failure Bar')
- alertcondition(high > shortbandsHighEMA and close < shortbandsHighEMA and open < shortbandsHighEMA, 'Wick Above Inner Sell Zone', 'Wick Above Inner Sell Zone')
- alertcondition(high > phiExtensionHighEMA and close < phiExtensionHighEMA and open < phiExtensionHighEMA, 'Wick Above Outer Sell Zone', 'Wick Above Outer Sell Zone')
- alertcondition(low < shortbandsLowEMA and close > shortbandsLowEMA and open > shortbandsLowEMA, 'Wick Below Inner Buy Zone', 'Wick Below Inner Buy Zone')
- alertcondition(low < phiExtensionLowEMA and close > phiExtensionLowEMA and open > phiExtensionLowEMA, 'Wick Below Outer Buy Zone', 'Wick Below Outer Buy Zone')
- alertcondition(major == 1, 'Major Bullish Leledc', 'Major Bullish Leledc')
- alertcondition(major == -1, 'Major Bearish Leledc', 'Major Bearish Leledc')
- barcolor(colorBar)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement