Home Article swing high low lavel swing high low lavel Software Technique Web Technique All Computer Language and Computer Language Practice Computer Educa August 28, 2026 0 Comments Share: Facebook Twitter Google+ Pinterest Whatsapp TREDING //@version=6 indicator("MTF Swing High Low - Line + Horizontal Box", overlay=true, max_lines_count=200, max_boxes_count=200) //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // SETTINGS //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ swingTF = input.timeframe("15", "Swing Timeframe") leftBars = input.int(3, "Left Bars", minval=1) rightBars = input.int(3, "Right Bars", minval=1) showHigh = input.bool(true, "Show Swing High") showLow = input.bool(true, "Show Swing Low") // Display showLines = input.bool(true, "Show Horizontal Lines") showBoxes = input.bool(true, "Show Horizontal Boxes") // Levels keepLevels = input.int(20, "Keep Levels", minval=1, maxval=100) // Line lineWidth = input.int(2, "Line Width", minval=1, maxval=4) // Box boxSize = input.float(2.0, "Box Size", minval=0.1, step=0.1) boxTransparency = input.int(85, "Box Transparency", minval=0, maxval=100) //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // 15M SWING HIGH //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sHigh = request.security( syminfo.tickerid, swingTF, ta.pivothigh(high, leftBars, rightBars), gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // 15M SWING LOW //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sLow = request.security( syminfo.tickerid, swingTF, ta.pivotlow(low, leftBars, rightBars), gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // EXACT SWING CANDLE TIME //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ sHighTime = request.security( syminfo.tickerid, swingTF, not na(ta.pivothigh(high, leftBars, rightBars)) ? time[rightBars] : na, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) sLowTime = request.security( syminfo.tickerid, swingTF, not na(ta.pivotlow(low, leftBars, rightBars)) ? time[rightBars] : na, gaps=barmerge.gaps_off, lookahead=barmerge.lookahead_off) //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // ARRAYS //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ var highLines = array.new_line() var lowLines = array.new_line() var highBoxes = array.new_box() var lowBoxes = array.new_box() //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // NEW SWING HIGH //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ newHigh = not na(sHigh) and na(sHigh[1]) if showHigh and newHigh //━━━━━━━━━━━━━━━━━━ // HORIZONTAL LINE //━━━━━━━━━━━━━━━━━━ if showLines highLine = line.new( x1=sHighTime, y1=sHigh, x2=time, y2=sHigh, xloc=xloc.bar_time, extend=extend.right, color=color.red, width=lineWidth) array.push(highLines, highLine) if array.size(highLines) > keepLevels oldLine = array.shift(highLines) line.delete(oldLine) //━━━━━━━━━━━━━━━━━━ // HORIZONTAL BOX //━━━━━━━━━━━━━━━━━━ if showBoxes highBox = box.new( left=sHighTime, top=sHigh, right=time, bottom=sHigh - boxSize, xloc=xloc.bar_time, extend=extend.right, border_color=color.red, bgcolor=color.new(color.red, boxTransparency)) array.push(highBoxes, highBox) if array.size(highBoxes) > keepLevels oldBox = array.shift(highBoxes) box.delete(oldBox) //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ // NEW SWING LOW //━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ newLow = not na(sLow) and na(sLow[1]) if showLow and newLow //━━━━━━━━━━━━━━━━━━ // HORIZONTAL LINE //━━━━━━━━━━━━━━━━━━ if showLines lowLine = line.new( x1=sLowTime, y1=sLow, x2=time, y2=sLow, xloc=xloc.bar_time, extend=extend.right, color=color.lime, width=lineWidth) array.push(lowLines, lowLine) if array.size(lowLines) > keepLevels oldLine = array.shift(lowLines) line.delete(oldLine) //━━━━━━━━━━━━━━━━━━ // HORIZONTAL BOX //━━━━━━━━━━━━━━━━━━ if showBoxes lowBox = box.new( left=sLowTime, top=sLow + boxSize, right=time, bottom=sLow, xloc=xloc.bar_time, extend=extend.right, border_color=color.lime, bgcolor=color.new(color.lime, boxTransparency)) array.push(lowBoxes, lowBox) if array.size(lowBoxes) > keepLevels oldBox = array.shift(lowBoxes) box.delete(oldBox) Copy Copied Text:
No comments