//@version=2 study("TD Sequential Ultimate", overlay=true) // OPTIONAL PARAMETERS //// priceFlipRequired = input(false, title="Setup - Require Price Flip for Initiation") showBuySetup = input(true, title="Setup - Show Buy Setup") showSellSetup = input(true, title="Setup - Show Sell Setup") showOnlySetupNine = input(false,title="Setup - Show Only Completed Nines") showResistance = input(true, title="Setup Trend - Show Resistance Lines") showSupport = input(true, title="Setup Trend - Show Support Lines") showBuyCountdown = input(true, title="Countdown - Show Buy Countdown") showSellCountdown = input(true, title="Countdown - Show Sell Countdown") showRiskLinesSt = input(true, title="Setup Risk Lines - Show") showRiskLinesCt = input(true, title="Countdown Risk Lines - Show") showReloadZones = input(true, title="Reload Zones - Show") showExtensionZones = input(false, title="Extension Lines - Show") showExtensionZones1 = input(true, title="Extension Zones - Show") showVBCB = input(false, title="Volume Based Colored Bars - Show") showST = input(false, title="SuperTrend - Show") // PRICE FLIP AND SETUP // buySetup = if close < close[4] if priceFlipRequired if close[1] > close[5] or 0 < nz(buySetup[1]) nz(buySetup[1]) + 1 else 0 else if nz(buySetup[1]) == 9 1 else nz(buySetup[1]) + 1 else 0 sellSetup = if close > close[4] if priceFlipRequired if close[1] < close[5] or 0 < nz(sellSetup[1]) nz(sellSetup[1]) + 1 else 0 else if nz(sellSetup[1]) == 9 1 else nz(sellSetup[1]) + 1 else 0 // PERFECTED SETUP CONDITIONS // sellPerfection = sellSetup==9 and ((high > high[2] and high > high[3]) or (high[1] > high[2] and high[1] > high[3])) buyPerfection = buySetup==9 and ((low < low[2] and low < low[3]) or (low[1] < low[2] and low[1] < low[3])) //STEALTH SETUP ssell = barssince(sellSetup==8) <=1 and buySetup==1 sbuy = barssince(buySetup==8) <=1 and sellSetup==1 // NUMBER PLOTS // plotshape(sellSetup==1 and showSellSetup and not sbuy ,style=shape.arrowup,color=purple,location=location.abovebar,transp=50) plotchar(sellSetup==2 and showSellSetup and not showOnlySetupNine,char='2',color=green,location=location.abovebar,transp=80) plotchar(sellSetup==3 and showSellSetup and not showOnlySetupNine,char='3',color=green,location=location.abovebar,transp=70) plotchar(sellSetup==4 and showSellSetup and not showOnlySetupNine,char='4',color=green,location=location.abovebar,transp=60) plotchar(sellSetup==5 and showSellSetup ,char='5',color=white,location=location.abovebar,transp=50) plotchar(sellSetup==6 and showSellSetup and not showOnlySetupNine,char='6',color=green,location=location.abovebar,transp=40) plotchar(sellSetup==7 and showSellSetup and not showOnlySetupNine,char='7',color=green,location=location.abovebar,transp=30) plotchar(sellSetup==8 and showSellSetup ,char='8',color=fuchsia,location=location.abovebar,transp=0) plotshape(sellSetup==9 and showSellSetup and not sellPerfection,style=shape.labeldown,size=size.tiny,color=maroon,location=location.abovebar,text="9",textcolor=white,transp=25) plotshape(sellPerfection and showSellSetup,style=shape.labeldown,size=size.tiny,color=maroon,location=location.abovebar,text="9\nP",textcolor=white,transp=25) plotshape(ssell and showSellSetup,style=shape.labeldown,size=size.tiny,color=purple,location=location.abovebar,text="S",textcolor=white,transp=40) plotshape(buySetup==1 and showBuySetup and not ssell ,style=shape.arrowdown,color=blue,location=location.abovebar,transp=50) plotchar(buySetup==2 and showBuySetup and not showOnlySetupNine,char='2',color=red,location=location.abovebar,transp=80) plotchar(buySetup==3 and showBuySetup and not showOnlySetupNine,char='3',color=red,location=location.abovebar,transp=70) plotchar(buySetup==4 and showBuySetup and not showOnlySetupNine,char='4',color=red,location=location.abovebar,transp=60) plotchar(buySetup==5 and showBuySetup ,char='5',color=white,location=location.abovebar,transp=50) plotchar(buySetup==6 and showBuySetup and not showOnlySetupNine,char='6',color=red,location=location.abovebar,transp=40) plotchar(buySetup==7 and showBuySetup and not showOnlySetupNine,char='7',color=red,location=location.abovebar,transp=30) plotchar(buySetup==8 and showBuySetup ,char='8',color=orange,location=location.abovebar,transp=0) plotshape(buyPerfection and showBuySetup,style=shape.labelup,size=size.tiny,color=orange,location=location.belowbar,text="9\nP",textcolor=navy,transp=25) plotshape(buySetup==9 and not buyPerfection and showBuySetup,style=shape.labelup,size=size.tiny,color=orange,location=location.belowbar,text="9",textcolor=navy,transp=25) plotshape(sbuy and showBuySetup,style=shape.labelup,size=size.tiny,color=orange,location=location.belowbar,text="S",textcolor=navy,transp=40) // SETUP TREND LINES // sell9 = (sellSetup == 9 or ssell) TDSTSupport = sell9 ? lowest(low, 9) : nz(TDSTSupport[1]) TDSTSupportIntact = close >= TDSTSupport and (barssince(close < TDSTSupport) > barssince(sell9)) plot(TDSTSupportIntact and showSupport ? TDSTSupport : na, style=circles, linewidth=2, color=navy) buy9 = (buySetup == 9 or sbuy) TDSTResistance = buy9 ? highest(high, 9) : nz(TDSTResistance[1]) TDSTResistanceIntact = close <= TDSTResistance and (barssince(close > TDSTResistance) > barssince(buy9)) plot(TDSTResistanceIntact and showResistance ? TDSTResistance : na, style=circles, linewidth=2, color=maroon) // RISK LINES "9" // buysetuplow = buySetup == 1 and nz(buySetup[1]) != 1 ? low : min(nz(buysetuplow[1]), low) buyRiskLine = buy9 and low <= valuewhen(nz(buySetup[1]) == 7, close, 0) ? 2*buysetuplow - valuewhen(change(buysetuplow)!=0, high, 0) : nz(buyRiskLine[1]) buyRiskLineIntact = high >= buyRiskLine and (barssince(high < buyRiskLine) > barssince(buy9 and low <= valuewhen(nz(buySetup[1]) == 7, close, 0))) plot(buyRiskLineIntact and showRiskLinesSt ? buyRiskLine : na, style=circles, linewidth=1, color=yellow,transp=45) sellsetuphigh = sellSetup == 1 and nz(sellSetup[1]) != 1 ? high : max(nz(sellsetuphigh[1]), high) sellRiskLine = sell9 and high >= valuewhen(nz(sellSetup[1]) == 7, close, 0) ? 2*sellsetuphigh - valuewhen(change(sellsetuphigh)!=0, low, 0) : nz(sellRiskLine[1]) sellRiskLineIntact = low <= sellRiskLine and (barssince(low > sellRiskLine) > barssince(sell9 and high >= valuewhen(nz(sellSetup[1]) == 7, close, 0))) plot(sellRiskLineIntact and showRiskLinesSt ? sellRiskLine : na, style=circles, linewidth=1, color=fuchsia,transp=45) // COUNTDOWN - BUY // // Cancelation Filter sinceBuyNine = barssince(buySetup == 9) sinceSellNine = barssince(sellSetup == 9) lastSetupIsBuy = sinceBuyNine < sinceSellNine // last completed setup is a buy setup lastSetupIsSell = not lastSetupIsBuy brokeResistance = barssince(low > TDSTResistance) < sinceBuyNine // did full candle trade above tdst resistance generated by last buy setup buyCancelationFilter = lastSetupIsSell or brokeResistance // Cancelation Qualifier 1 - Last buy setup larger than the one before but less then 1.618 times it's size lastBuyLowestVal = buySetup == 9 ? lowest(low, 9) : (buySetup > 9 ? min(nz(lastBuyLowestVal[1]), low) : nz(lastBuyLowestVal[1])) lastBuySetupRange = TDSTResistance - lastBuyLowestVal secondLastBuyRange = buySetup == 9 ? nz(lastBuySetupRange[1]) : nz(secondLastBuyRange[1]) buyCancelationQualifier1 = (secondLastBuyRange <= lastBuySetupRange) and (lastBuySetupRange < 1.618 * secondLastBuyRange) // Cancelation Qualifier 2 - Last buy setup not within the last one lastBuyHighestClose = buySetup == 9 ? highest(close, 9) : (buySetup > 9 ? max(nz(lastBuyHighestClose[1]), close) : nz(lastBuyHighestClose[1])) lastBuyLowestClose = buySetup == 9 ? lowest(close, 9) : (buySetup > 9 ? min(nz(lastBuyLowestClose[1]), close) : nz(lastBuyLowestClose[1])) secondLastBuyHighestVal = buySetup == 9 ? TDSTResistance[1] : nz(secondLastBuyHighestVal[1]) secondLastBuyLowestVal = buySetup == 9 ? nz(lastBuyLowestVal[1]) : nz(secondLastBuyLowestVal[1]) aboveSecondLastBuyRange = lastBuyHighestClose > secondLastBuyHighestVal belowSecondLastBuyRange = lastBuyLowestClose < secondLastBuyLowestVal sinceSecondLastBuy = buySetup == 9 ? nz(sinceBuyNine[1])+1 : nz(sinceSecondLastBuy[1])+1 sellSetupBetweenTwoBuys = sinceSecondLastBuy > sinceSellNine and sinceSellNine > sinceBuyNine buyCancelationQualifier2 = aboveSecondLastBuyRange or belowSecondLastBuyRange or sellSetupBetweenTwoBuys // Miscellaneous initiateBuyCountdown = (close <= low[2]) and (buySetup == 9 or barssince(close[1] <= low[3])+1 > sinceBuyNine) buyCountdownCompleted = low[1] <= valuewhen(nz(buyCountdown[1]) == 7, close, 0) newBuySetupDuringCountdown = barssince(buySetup == 9) < barssince(buyCountdown[1] == 1) and (close <= low[2]) // Countdown Logic buyCountdown = if buyCancelationFilter 0 else if nz(buyCountdown[1]) == 0 // previous bar buyCountdown is 0 if initiateBuyCountdown 1 else 0 else if nz(buyCountdown[1]) < 13 // previous bar 0 < buyCountdown < 13 if newBuySetupDuringCountdown and (buyCancelationQualifier1 or buyCancelationQualifier2) 1 else if close <= low[2] nz(buyCountdown[1]) + 1 else nz(buyCountdown[1]) else // previous bar buyCountdown is 13 if newBuySetupDuringCountdown and (buyCancelationQualifier1 or buyCancelationQualifier2) 1 else if buyCountdownCompleted 0 else nz(buyCountdown[1]) // completion is deferred until condition is satisfied // Number Plots// plotchar(buyCountdown!=buyCountdown[1] and buyCountdown==1 and showBuyCountdown,char='',text='1',color=white,location=location.belowbar,transp=55) //plotchar(buyCountdown>buyCountdown[1] and buyCountdown==2 and showBuyCountdown,char='',text='2',color=red,location=location.belowbar,transp=80) plotchar(buyCountdown>buyCountdown[1] and buyCountdown==3 and showBuyCountdown,char='',text='3',color=red,location=location.belowbar,transp=75) //plotchar(buyCountdown>buyCountdown[1] and buyCountdown==4 and showBuyCountdown,char='',text='4',color=red,location=location.belowbar,transp=70) plotchar(buyCountdown>buyCountdown[1] and buyCountdown==5 and showBuyCountdown,char='',text='5',color=red,location=location.belowbar,transp=65) //plotchar(buyCountdown>buyCountdown[1] and buyCountdown==6 and showBuyCountdown,char='',text='6',color=red,location=location.belowbar,transp=60) //plotchar(buyCountdown>buyCountdown[1] and buyCountdown==7 and showBuyCountdown,char='',text='7',color=red,location=location.belowbar,transp=55) plotchar(buyCountdown>buyCountdown[1] and buyCountdown==8 and showBuyCountdown,char='',text='Q',color=white,location=location.belowbar,transp=35) //plotchar(buyCountdown>buyCountdown[1] and buyCountdown==9 and showBuyCountdown,char='',text='9',color=red,location=location.belowbar,transp=45) //plotchar(buyCountdown>buyCountdown[1] and buyCountdown==10 and showBuyCountdown,char='',text='10',color=red,location=location.belowbar,transp=40) plotchar(buyCountdown>buyCountdown[1] and buyCountdown==11 and showBuyCountdown,char='',text='11',color=red,location=location.belowbar,transp=35) //plotchar(buyCountdown>buyCountdown[1] and buyCountdown==12 and showBuyCountdown,char='',text='12',color=red,location=location.belowbar,transp=30) plotshape(buyCountdown==13 and close <= low[2] and low > valuewhen(nz(buyCountdown[1]) == 7, close, 0) and showBuyCountdown, style=shape.xcross, color=#875F5B, location=location.belowbar, transp=35) plotshape(low <= valuewhen(nz(buyCountdown[1]) == 7, close, 0) and buyCountdown==13 and showBuyCountdown,text='13\nC',textcolor=black,style=shape.labelup,size=size.tiny,color=#E1A980,location=location.belowbar,transp=40) buy13 = low <= valuewhen(nz(buyCountdown[1]) == 7, close, 0) and buyCountdown==13 // COUNTDOWN - SELL // // Cancelation Filter brokeSupport = barssince(high < TDSTSupport) < sinceSellNine // full candle traded below current tdst support sellCancelationFilter = lastSetupIsBuy or brokeSupport // Cancelation Qualifier 1 lastSellHighestVal = sellSetup == 9 ? highest(high, 9) : (sellSetup > 9 ? max(nz(lastSellHighestVal[1]), high) : nz(lastSellHighestVal[1])) lastSellSetupRange = lastSellHighestVal - TDSTSupport secondLastSellRange = sellSetup == 9 ? nz(lastSellSetupRange[1]) : nz(secondLastSellRange[1]) sellCancelationQualifier1 = (secondLastSellRange <= lastSellSetupRange) and (lastSellSetupRange < 1.618 * secondLastSellRange) // Cancelation Qualifier 2 lastSellHighestClose = sellSetup == 9 ? highest(close, 9) : (sellSetup > 9 ? max(nz(lastSellHighestClose[1]), close) : nz(lastSellHighestClose[1])) lastSellLowestClose = sellSetup == 9 ? lowest(close, 9) : (sellSetup > 9 ? min(nz(lastSellLowestClose[1]), close) : nz(lastSellLowestClose[1])) secondLastSellHighestVal = sellSetup == 9 ? nz(lastSellHighestVal[1]) : nz(secondLastSellHighestVal[1]) secondLastSellLowestVal = sellSetup == 9 ? TDSTSupport[1] : nz(secondLastSellLowestVal[1]) aboveSecondLastSellRange = lastSellHighestClose > secondLastSellHighestVal belowSecondLastSellRange = lastSellLowestClose < secondLastSellLowestVal sinceSecondLastSell = sellSetup == 9 ? nz(sinceSellNine[1])+1 : nz(sinceSecondLastSell[1])+1 buySetupBetweenTwoSells = sinceSecondLastSell > sinceBuyNine and sinceBuyNine > sinceSellNine sellCancelationQualifier2 = aboveSecondLastSellRange or belowSecondLastSellRange or buySetupBetweenTwoSells // Miscellaneous initiateSellCountdown = (close >= high[2]) and (sellSetup == 9 or barssince(close[1] >= high[3])+1 > sinceSellNine) sellCountdownCompleted = high[1] >= valuewhen(nz(sellCountdown[1]) == 7, close, 0) newSellSetupDuringCountdown = barssince(sellSetup == 9) < barssince(sellCountdown[1] == 1) and (close >= high[2]) // Countdown Logic sellCountdown = if sellCancelationFilter 0 else if nz(sellCountdown[1]) == 0 // previous bar sellCountdown is 0 if initiateSellCountdown 1 else 0 else if nz(sellCountdown[1]) < 13 // previous bar 0 < sellCountdown < 13 if newSellSetupDuringCountdown and (sellCancelationQualifier1 or sellCancelationQualifier2) 1 else if close >= high[2] nz(sellCountdown[1]) + 1 else nz(sellCountdown[1]) else // previous bar sellCountdown is 13 if newSellSetupDuringCountdown and (sellCancelationQualifier1 or sellCancelationQualifier1) 1 else if sellCountdownCompleted 0 else nz(sellCountdown[1]) // completion is deferred until condition is satisfied // Number Plots plotchar(sellCountdown!=sellCountdown[1] and sellCountdown==1 and showSellCountdown,char='',text='1',color=white,location=location.belowbar,transp=65) //plotchar(sellCountdown>sellCountdown[1] and sellCountdown==2 and showSellCountdown,char='',text='2',color=green,location=location.belowbar,transp=80) plotchar(sellCountdown>sellCountdown[1] and sellCountdown==3 and showSellCountdown,char='',text='3',color=green,location=location.belowbar,transp=75) //plotchar(sellCountdown>sellCountdown[1] and sellCountdown==4 and showSellCountdown,char='',text='4',color=green,location=location.belowbar,transp=70) plotchar(sellCountdown>sellCountdown[1] and sellCountdown==5 and showSellCountdown,char='',text='5',color=green,location=location.belowbar,transp=65) //plotchar(sellCountdown>sellCountdown[1] and sellCountdown==6 and showSellCountdown,char='',text='6',color=green,location=location.belowbar,transp=60) //plotchar(sellCountdown>sellCountdown[1] and sellCountdown==7 and showSellCountdown,char='',text='7',color=green,location=location.belowbar,transp=55) plotchar(sellCountdown>sellCountdown[1] and sellCountdown==8 and showSellCountdown,char='',text='Q',color=white,location=location.belowbar,transp=35) //plotchar(sellCountdown>sellCountdown[1] and sellCountdown==9 and showSellCountdown,char='',text='9',color=green,location=location.belowbar,transp=45) //plotchar(sellCountdown>sellCountdown[1] and sellCountdown==10 and showSellCountdown,char='',text='10',color=green,location=location.belowbar,transp=40) plotchar(sellCountdown>sellCountdown[1] and sellCountdown==11 and showSellCountdown,char='',text='11',color=green,location=location.belowbar,transp=35) //plotchar(sellCountdown>sellCountdown[1] and sellCountdown==12 and showSellCountdown,char='',text='12',color=green,location=location.belowbar,transp=30) plotshape(sellCountdown==13 and close >= high[2] and high < valuewhen(nz(sellCountdown[1]) == 7, close, 0) and showSellCountdown, style=shape.xcross, color=#648587, location=location.belowbar, transp=35) plotshape(high >= valuewhen(nz(sellCountdown[1]) == 7, close, 0) and sellCountdown==13 and showSellCountdown,text='13\nC',textcolor=black,style=shape.labeldown,size=size.tiny,color=#E17CB0,location=location.abovebar,transp=40) sell13 = high >= valuewhen(nz(sellCountdown[1]) == 7, close, 0) and sellCountdown==13 // RISK LINES COUNTDOWN // buyCountdownLow = buyCountdown == 1 and nz(buyCountdown[1]) != 1 ? low : min(nz(buyCountdownLow[1]), low) buyRiskLinec = low <= valuewhen(nz(buyCountdown[1]) == 7, close, 0) and buyCountdown==13 ? 2*buyCountdownLow - valuewhen(change(buyCountdownLow)!=0, high, 0) : nz(buyRiskLinec[1]) buyRiskLinecIntact = high >= buyRiskLinec and (barssince(high < buyRiskLinec) > barssince(buyCountdown == 13 and low <= valuewhen(nz(buyCountdown[1]) == 7, close, 0))) plot(buyRiskLinecIntact and showRiskLinesCt ? buyRiskLinec : na, style=circles, linewidth=1, color=#876846, transp=35) sellCountdownHigh = sellCountdown == 1 and nz(sellCountdown[1]) != 1 ? high : max(nz(sellCountdownHigh[1]), high) sellRiskLinec = sellCountdown == 13 and high >= valuewhen(nz(sellCountdown[1]) == 7, close, 0) ? 2*sellCountdownHigh - valuewhen(change(sellCountdownHigh)!=0, low, 0) : nz(sellRiskLinec[1]) sellRiskLinecIntact = low <= sellRiskLinec and (barssince(low > sellRiskLinec) > barssince(sellCountdown == 13 and high >= valuewhen(nz(sellCountdown[1]) == 7, close, 0))) plot(sellRiskLinecIntact and showRiskLinesCt ? sellRiskLinec : na, style=circles, linewidth=1, color=#E1B4CE, transp=35) //ReloadResistance fuark=TDSTResistance-buyRiskLine breload618=TDSTResistance-fuark*(0.382) breload786=TDSTResistance-fuark*(0.214) brl1 = plot(showReloadZones ? breload618 :na , style=cross, linewidth=1, color=white,transp=85) brl2 = plot(showReloadZones ? breload786 :na , style=cross, linewidth=1, color=white,transp=85) //ReloadSupport fuarkk=TDSTSupport-sellRiskLine preload618=TDSTSupport-fuarkk*(0.382) preload786=TDSTSupport-fuarkk*(0.214) prl1 = plot(showReloadZones ? preload618 :na , style=cross, linewidth=1, color=olive,transp=75) prl2 = plot(showReloadZones ? preload786 :na , style=cross, linewidth=1, color=olive,transp=75) fill(brl1, brl2, color=yellow, transp=95) fill(prl1, prl2, color=aqua, transp=95) //ExtensionResistanceLine bextension1618=TDSTResistance-fuark*(-0.618) bextension2618=TDSTResistance-fuark*(-1.618) bex1 = plot(showExtensionZones ? bextension1618 :na , style=cross, linewidth=2, color=fuchsia,transp=90) bex2 = plot(showExtensionZones ? bextension2618 :na , style=cross, linewidth=2, color=fuchsia,transp=90) //ExtensionResistanceZone fuarkkk= bextension2618-bextension1618 extext1= bextension2618-fuarkkk*(0.382) extext2= bextension2618-fuarkkk*(0.214) extext12 = plot(showExtensionZones1 ? extext1 :na , style=circles, linewidth=1, color=purple,transp=85) extext21 = plot(showExtensionZones1 ? extext2 :na , style=circles, linewidth=1, color=purple,transp=85) fill(extext12, extext21, color=maroon, transp=90) //ExtensionResistanceZone fuarkkkr= bextension1618 -breload786 extext1r= bextension1618-fuarkkkr*(0.382) extext2r= bextension1618-fuarkkkr*(0.214) extext12r = plot(showExtensionZones1 ? extext1r :na , style=circles, linewidth=1, color=purple,transp=85) extext21r = plot(showExtensionZones1 ? extext2r :na , style=circles, linewidth=1, color=purple,transp=85) fill(extext12r, extext21r, color=maroon, transp=90) extzonessetup1 = sell9 and (high >= extext1r or high[1] >= extext1r or high[2] >= extext1r or high[3] >= extext1r) and close= extext1r or high[1] >= extext1r or high[2] >= extext1r or high[3] >= extext1r) and close= extext1 or high[1] >= extext1 or high[2] >= extext1 or high[3] >= extext1) and close= extext1 or high[1] >= extext1 or high[2] >= extext1 or high[3] >= extext1) and closeextext2p and close [1] > extext2p and close [2] > extext2p and close [3] > extext2p extzonebsetup1c = buy13 and (low <= extext1p or low[1] <= extext1p or low[2] <= extext1p or low[3] <= extext1p) and close>extext2p and close [1] > extext2p and close [2] > extext2p and close [3] > extext2p extzonebsetup2 = buy9 and (low <= extext1pr or low[1] <= extext1pr or low[2] <= extext1pr or low[3] <= extext1pr) and close>extext2pr and close [1] > extext2pr and close [2] > extext2pr and close [3] > extext2pr extzonebsetup2c = buy13 and (low <= extext1pr or low[1] <= extext1pr or low[2] <= extext1pr or low[3] <= extext1pr) and close>extext2pr and close [1] > extext2pr and close [2] > extext2pr and close [3] > extext2pr //BARCOLOR b1 = buy9 and (low <= preload618 or low[1] <= preload618 or low[2] <= preload618) and close>preload786 and close [1] > preload786 and close [2] > preload786 and close [3] > preload786 s1 = sell9 and (high >= breload618 or high[1] >= breload618 or high[2] >= breload618) and close avrg*1.5 and close= avrg*0.5 and volume<=avrg*1.5 and close avrg*1.5 and close>open volu2 = volume >= avrg*0.5 and volume<=avrg*1.5 and close>open volu3 = volume< avrg*0.5 and close>open cold1=#800000 cold2=#FF0000 cold3=#FF7F00 colu1=#008000 colu2=lime colu3=#7FFFD4 color = vold1 ? cold1 : vold2 ? cold2 : vold3 ? cold3 : volu1 ? colu1 : volu2 ? colu2 : volu3 ? colu3 : na barcolor(showVBCB ? color : na) //SUPERTREND// Up=hl2-(3*atr(10)) Dn=hl2+(3*atr(10)) TrendUp=close[1]>TrendUp[1]? max(Up,TrendUp[1]) : Up TrendDown=close[1] TrendDown[1] ? 1: close< TrendUp[1]? -1: nz(Trend[1],1) Tsl = Trend==1? TrendUp: TrendDown linecolor = Trend == 1 ? yellow : gray plot(showST ? Tsl :na , color = linecolor , style = linebr , linewidth = 2,title = "SuperTrend", transp=75)