Hola todos, me podéis ayudar a transcribir el siguiente indicador de Tradingview llamado Sweep Institutional. Gracias //@version=5 indicator(‘Sweep institutional’, overlay=true, max_lines_count=500, max_labels_count = 500) //INPUTS cooldownPeriod = input.int(10,title=”Cooldown Period”, minval=0, group = “Settings”) lbLeft = 20 lbRight = 20 showSwing = input.bool(true,title=”Show Swings?”, inline=”s_1″, group = ‘Swing Detaction’) swingClr = input.color(color.new(color.black, 0), title=”, inline=”s_1″, group = ‘Swing Detaction’) bullWidth = input.int(1, title=’Line Width:’, group=’Bullish Sweep’) bullStyle = input.string(‘Dashed’, title=’Line Style:’, options=[‘Solid’, ‘Dotted’, ‘Dashed’], group=’Bullish Sweep’) bullColor = input.color(color.new(color.teal, 0), title=’Bullish Color:’, group=’Bullish Sweep’) bearWidth = input.int(1, title=’Line Width:’, group=’Bearish Sweep’) bearStyle = input.string(‘Dashed’, title=’Line Style:’, options=[‘Solid’, ‘Dotted’, ‘Dashed’], group=’Bearish Sweep’) bearColor = input.color(color.new(color.maroon, 0), title=’Bearish Color:’, group=’Bearish Sweep’) //FUNCTIONS lineStyle(s) => if s == ‘Solid’ line.style_solid else if s == ‘Dotted’ line.style_dotted else line.style_dashed //VARS var int bullSignalIndex = 0 var int bearSignalIndex = 0 var line bullLine = na var line bearLine = na var line highLine = na var line lowLine = na var label swingHighLbl = na var label swingLowLbl = na var label swingHighLblTxt = na var label swingLowLblTxt = na var float swingLowVal = na var float swingHighVal = na //CALCULATIONS pLow = ta.pivotlow(low, lbLeft, lbRight) pHigh = ta.pivothigh(high, lbLeft, lbRight) pLowVal = ta.valuewhen(not na(pLow), low[lbRight], 0) pHighVal = ta.valuewhen(not na(pHigh), high[lbRight], 0) prevLowIndex = ta.valuewhen(not na(pLow), bar_index[lbRight], 0) prevHighIndex = ta.valuewhen(not na(pHigh), bar_index[lbRight], 0) lp = ta.lowest(low, lbLeft) hp = ta.highest(high, lbLeft) highestClose = ta.highest(close, lbLeft) lowestClose = ta.lowest(close, lbLeft) bullishSFP = low < pLowVal and close > pLowVal and open > pLowVal and low == lp and lowestClose >= pLowVal bearishSFP = high > pHighVal and close < pHighVal and open < pHighVal and high == hp and highestClose <= pHighVal bullCond = bullishSFP[3] and (close > pLowVal) and (close[1] > pLowVal[1]) and (close[2] > pLowVal[2]) and bar_index >= bullSignalIndex + cooldownPeriod bearCond = bearishSFP[3] and (close < pHighVal) and (close[1] < pHighVal[1]) and (close[2] < pHighVal[2]) and bar_index >= bearSignalIndex + cooldownPeriod //Check Swing H/L Stopper var int swingLowCounter = 0 var int swingHighCounter = 0 var bool isSwingLowCheck = false var bool isSwingHighCheck = false var bool stopPrintingLow = false var bool stopPrintingHigh = false if high < swingLowVal and isSwingLowCheck swingLowCounter := swingLowCounter+1 if low > swingHighVal and isSwingHighCheck swingHighCounter := swingHighCounter+1 if ta.crossunder(close, swingLowVal) and isSwingLowCheck == false isSwingLowCheck := true swingLowCounter := 1 if ta.crossover(close, swingHighVal) and isSwingHighCheck == false isSwingHighCheck := true swingHighCounter := 1 if swingLowCounter == 5 and isSwingLowCheck stopPrintingLow := true isSwingLowCheck := false line.set_x2(lowLine,bar_index[4]) if swingHighCounter == 5 and isSwingHighCheck stopPrintingHigh := true isSwingHighCheck := false line.set_x2(highLine,bar_index[4]) //Draw sweep lines if bullCond bullSignalIndex := bar_index bullLine := line.new(prevLowIndex, pLowVal, bar_index-3, pLowVal, color=bullColor, width=bullWidth, style=lineStyle(bullStyle)) if bearCond bearSignalIndex := bar_index bearLine := line.new(prevHighIndex, pHighVal, bar_index-3, pHighVal, color=bearColor, width=bearWidth, style=lineStyle(bearStyle)) var swingHighArr = array.new_label(0) var swingHighTextArr = array.new_label(0) var swingLowArr = array.new_label(0) var swingLowTextArr = array.new_label(0) if array.size(swingHighArr) >= 3 label.delete(array.shift(swingHighArr)) label.delete(array.shift(swingHighTextArr)) if array.size(swingLowArr) >= 3 label.delete(array.shift(swingLowArr)) label.delete(array.shift(swingLowTextArr)) //Draw range lines if showSwing ifstopPrintingHigh==false line.set_x2(highLine,bar_index+5) if stopPrintingLow == false line.set_x2(lowLine,bar_index+5) if showSwing and not na(pHigh) and bearishSFP[lbRight] == false stopPrintingHigh := false swingHighVal := high[lbRight] line.delete(highLine) highLine := line.new(bar_index[lbRight], high[lbRight], bar_index+10, high[lbRight], color = swingClr, width = 2) swingHighLbl := label.new(bar_index[lbRight], high[lbRight], text=””, yloc=yloc.abovebar, color = swingClr, textcolor = swingClr, style = label.style_triangledown, size = size.auto) swingHighLblTxt := label.new(bar_index[lbRight], high[lbRight], text=”Swing\nH”, yloc=yloc.abovebar, color = swingClr, textcolor = swingClr, style = label.style_none, size = size.small) array.push(swingHighArr, swingHighLbl) array.push(swingHighTextArr, swingHighLblTxt) if showSwing and not na(pLow) and bullishSFP[lbRight] == false stopPrintingLow := false swingLowVal := low[lbRight] line.delete(lowLine) lowLine := line.new(bar_index[lbRight], low[lbRight], bar_index+10, low[lbRight], color = swingClr, width = 2) swingLowLbl := label.new(bar_index[lbRight], low[lbRight], text=””, yloc=yloc.belowbar, color = swingClr, textcolor = swingClr, style = label.style_triangleup, size = size.auto) swingLowLblTxt := label.new(bar_index[lbRight], low[lbRight], text=”Swing\nL”, yloc=yloc.belowbar, color = swingClr, textcolor = swingClr, style = label.style_none, size = size.small) array.push(swingLowArr, swingLowLbl) array.push(swingLowTextArr, swingLowLblTxt) //PLOTS plotshape(bullCond, text=’Sweep’, color=bullColor, textcolor=bullColor, location=location.belowbar, offset = -3) plotshape(bearCond, text=’Sweep’, color=bearColor, textcolor=bearColor, location=location.abovebar, offset = -3) //ALERTS alertcondition(bullishSFP, title=’Bullish Sweep’, message='{{ticker}} Bullish Sweep, Price:{{close}}’) alertcondition(bearishSFP, title=’Bearish Sweep’, message='{{ticker}} Bearish Sweep, Price:{{close}}’)