//@version=5 indicator("HL SMC Structures and FVG Only", overlay = true) import LudoGH68/Drawings_public/1 as d getLineStyle(lineOption) => lineOption == "┈" ? line.style_dotted : lineOption == "╌" ? line.style_dashed : line.style_solid get_structure_highest_bar(lookback) => var int idx = 0 maxBar = bar_index > lookback ? ta.highestbars(high, lookback) : ta.highestbars(high, bar_index + 1) for i = 0 to lookback - 1 by 1 if high[i+1] > high[i+2] and high[i] <= high[i+1] and ((i+1) * -1) >= maxBar idx := (i+1) * -1 idx := idx == 0 ? maxBar : idx get_structure_lowest_bar(lookback) => var int idx = 0 minBar = bar_index > lookback ? ta.lowestbars(low, lookback) : ta.lowestbars(low, bar_index + 1) for i = 0 to lookback - 1 by 1 if low[i+1] < low[i+2] and low[i] >= low[i+1] and ((i+1) * -1) >= minBar idx := (i+1) * -1 idx := idx == 0 ? minBar : idx // ------------------------------- // FVG Settings // ------------------------------- isFvgToShow = input(true, title='Display FVG', group="Fair Value Gap") bullishFvgColor = input(color.new(color.green, 50), 'Bullish FVG Color', group="Fair Value Gap") bearishFvgColor = input(color.new(color.red, 50), 'Bearish FVG Color', group="Fair Value Gap") mitigatedFvgColor = input(color.new(color.gray, 50), 'Mitigated FVG Color', group="Fair Value Gap") fvgHistoryNbr = input.int(10, 'Number of FVG to show', minval=1, maxval=50) isMitigatedFvgToReduce = input(false, title='Reduce mitigated FVG', group="Fair Value Gap") // ------------------------------- // Structure Settings // ------------------------------- isStructBodyCandleBreak = input(true, title="Break with candle's body", group="Structures") bullishBosColor = input(color.green, 'Bullish BOS Color', group="Structures") bearishBosColor = input(color.red, 'Bearish BOS Color', group="Structures") bosLineStyleOption = input.string("╌", title="BOS Style", group="Structures", options=["─", "┈", "╌"]) bosLineStyle = getLineStyle(bosLineStyleOption) bosLineWidth = input.int(1, title="BOS Width", group="Structures", minval=1, maxval=5) bullishChochColor = input(color.green, 'Bullish CHoCH Color', group="Structures") bearishChochColor = input(color.red, 'Bearish CHoCH Color', group="Structures") chochLineStyleOption = input.string("╌", title="CHoCH Style", group="Structures", options=["─", "┈", "╌"]) chochLineStyle = getLineStyle(chochLineStyleOption) chochLineWidth = input.int(1, title="CHoCH Width", group="Structures", minval=1, maxval=5) structHistoryNbr = input.int(50, 'Number of breaks to show', minval=1, maxval=50) // ------------------------------- // Arrays // ------------------------------- var array structureLines = array.new_line(0) var array