Indicator · Pine Script v6 · On the chart

Fvg Fibo

by Ahmed-GoCode· code credited to Ahmed - Quant-Edge Indicators

This indicator overlays fair value gaps, market-structure breaks, and two Fibonacci levels on the price chart.

View on GitHub

GitHub stars53on the repository
Pine versionv6current
Lines of code415
Settings40inputs
LicenceMPL-2.0
Last update2 months ago17 Aug 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

415 lines of Pine Script v6 from Quant-Edge-Indicators/Fibonacci & FVG/Fibonacci + FVG.pinescript, published under MPL-2.0. Keep the author's credit and licence lines when you reuse it.

Fibonacci + FVG.pinescript
// This Pine Script™ code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © Ahmed - Quant-Edge Indicators
//@version=6
indicator("!<*FVG_FIBO*>!", 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
            //break

    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
            //break

    idx := idx == 0 ? minBar : idx

is_structure_high_broken(_highStructBreakPrice, _structureHigh, _structureHighStartIndex, _structureDirection) =>
    var bool res = false

    if (_highStructBreakPrice > _structureHigh and  bar_index[1] >  _structureHighStartIndex) or (_structureDirection == 1 and _highStructBreakPrice > _structureHigh)
        res := true
    else
        res := false

    res

// Fear Value Gap
isFvgToShow =  input(true, title='Display FVG', group="Fear Value Gap")
bullishFvgColor = input(color.new(#b2b5be, 70), 'Bullish FVG Color', group="Fear Value Gap")
bearishFvgColor = input(color.new(#b2b5be, 70), 'Bearish FVG Color', group="Fear Value Gap")
mitigatedFvgColor = input(color.new(#b2b5be, 70), 'Mitigated FVG Color', group="Fear Value Gap")
fvgHistoryNbr = input.int(5, 'Number of FVG to show', minval=1, maxval=50)
isMitigatedFvgToReduce = input(false, title='Reduce mitigated FVG', group="Fear Value Gap")

// Structures
isStructBodyCandleBreak = input(true, title='Break with candle\'s body', group="Structures")
isCurrentStructToShow = input(true, title='Display current structure', group="Structures")
bullishBosColor = input(color.silver, 'Bullish BOS Color', group="Structures")
bearishBosColor = input(color.silver, '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.silver, 'Bullish CHoCH Color', group="Structures")
bearishChochColor = input(color.silver, 'Bearish CHoCH Color', group="Structures")
chochLineStyleOption = input.string("-", title="CHoCH Style", group="Structures", options=["-", "–", "—"])
chochLineStyle = getLineStyle(chochLineStyleOption)
chochLineWidth = input.int(1, title="MSB Width", group="Structures", minval=1, maxval=5)
currentStructColor = input(color.rgb(255, 4, 0), 'Current structure Color', group="Structures")
currentStructLineStyleOption = input.string("-", title="Current structure Style", group="Structures", options=["-", "–", "—"])
currentStructLineStyle = getLineStyle(currentStructLineStyleOption)
currentStructLineWidth = input.int(1, title="Current structure Width", group="Structures", minval=1, maxval=5)
structHistoryNbr = input.int(10, 'Number of break to show', minval=1, maxval=50)

// Fibonacci 1
isFibo1ToShow = input(true, title = "", group="Structure Fibonacci", inline = "Fibo1")
fibo1Value = input.float(0.786, title = "", group="Structure Fibonacci", inline = "Fibo1")
fibo1Color = input(#9598a1, title = "", group="Structure Fibonacci", inline = "Fibo1")
fibo1StyleOption = input.string("-", title = "", group="Structure Fibonacci", options=["-", "–", "—"], inline = "Fibo1")
fibo1Style = getLineStyle(fibo1StyleOption)
fibo1LineWidth = input.int(1, title = "", group="Structure Fibonacci", minval=1, maxval=5, inline = "Fibo1")

// Fibonacci 2
isFibo2ToShow = input(true, title = "", group="Structure Fibonacci", inline = "Fibo2")
fibo2Value = input.float(0.705, title = "", group="Structure Fibonacci", inline = "Fibo2")
fibo2Color = input(#9598a1, title = "", group="Structure Fibonacci", inline = "Fibo2")
fibo2StyleOption = input.string("-", title = "", group="Structure Fibonacci", options=["-", "–", "—"], inline = "Fibo2")
fibo2Style = getLineStyle(fibo2StyleOption)
fibo2LineWidth = input.int(1, title = "", group="Structure Fibonacci", minval=1, maxval=5, inline = "Fibo2")

// Fibonacci 3
isFibo3ToShow = input(true, title = "", group="Structure Fibonacci", inline = "Fibo3")
fibo3Value = input.float(0.618, title = "", group="Structure Fibonacci", inline = "Fibo3")
fibo3Color = input(#9598a1, title = "", group="Structure Fibonacci", inline = "Fibo3")
fibo3StyleOption = input.string("-", title = "", group="Structure Fibonacci", options=["-", "–", "—"], inline = "Fibo3")
fibo3Style = getLineStyle(fibo3StyleOption)
fibo3LineWidth = input.int(1, title = "", group="Structure Fibonacci", minval=1, maxval=5, inline = "Fibo3")

// Fibonacci 3
isFibo4ToShow = input(true, title = "", group="Structure Fibonacci", inline = "Fibo4")
fibo4Value = input.float(0.5, title = "", group="Structure Fibonacci", inline = "Fibo4")
fibo4Color = input(#9598a1, title = "", group="Structure Fibonacci", inline = "Fibo4")
fibo4StyleOption = input.string("-", title = "", group="Structure Fibonacci", options=["-", "–", "—"], inline = "Fibo4")
fibo4Style = getLineStyle(fibo4StyleOption)
fibo4LineWidth = input.int(1, title = "", group="Structure Fibonacci", minval=1, maxval=5, inline = "Fibo4")

// Fibonacci 5
isFibo5ToShow = input(true, title = "", group="Structure Fibonacci", inline = "Fibo5")
fibo5Value = input.float(0.382, title = "", group="Structure Fibonacci", inline = "Fibo5")
fibo5Color = input(#9598a1, title = "", group="Structure Fibonacci", inline = "Fibo5")
fibo5StyleOption = input.string("-", title = "", group="Structure Fibonacci", options=["-", "–", "—"], inline = "Fibo5")
fibo5Style = getLineStyle(fibo5StyleOption)
fibo5LineWidth = input.int(1, title = "", group="Structure Fibonacci", minval=1, maxval=5, inline = "Fibo5")

// Draw FVG into graph
FVGDraw(_boxes, _fvgTypes, _isFvgMitigated) =>

    // Loop into all values of the array
    for [index, value] in _boxes

        // Processing bullish FVG
        if(array.get(_fvgTypes, index))

            // Check if FVG has been totally mitigated
            if(low <= box.get_bottom(value))
                array.remove(_boxes, index)
                array.remove(_fvgTypes, index)
                array.remove(_isFvgMitigated, index)
                box.delete(value)
            else
                if(low < box.get_top((value)))
                    box.set_bgcolor(value, mitigatedFvgColor)

                    // Mitigated FVG Alert
                    if(not(array.get(_isFvgMitigated, index)))
                        alert("FVG has been mitigated", alert.freq_once_per_bar)
                        array.set(_isFvgMitigated, index, true)

                    // Reduce FVG if needed
                    if(isMitigatedFvgToReduce)
                        box.set_top(value, low)

                box.set_right(value, bar_index)

        // Processing bearish FVG
        else

            // Check if FVG has been mitigated
            if(high >= box.get_top(value))
                array.remove(_boxes, index)
                array.remove(_fvgTypes, index)
                array.remove(_isFvgMitigated, index)
                box.delete(value)
            else
                if(high > box.get_bottom((value)))
                    box.set_bgcolor(value, mitigatedFvgColor)

                    // Mitigated FVG Alert
                    if(not(array.get(_isFvgMitigated, index)))
                        alert("FVG has been mitigated", alert.freq_once_per_bar)
                        array.set(_isFvgMitigated, index, true)

                    // Reduce FVG if needed
                    if(isMitigatedFvgToReduce)
                        box.set_bottom(value, high)

                box.set_right(value, bar_index)

// Arrays variable
var array<line> structureLines = array.new_line(0)
var array<label> structureLabels = array.new_label(0)
var array<box>  fvgBoxes = array.new_box(0)
var array<bool> fvgTypes = array.new_bool(0)
var array<bool> isFvgMitigated = array.new_bool(0)

// Price variables
var float structureHigh = 0.0
var float structureLow = 0.0
var float fibo1Price = 0.0
var float fibo2Price = 0.0
var float fibo3Price = 0.0
var float fibo4Price = 0.0
var float fibo5Price = 0.0

// Index variable
var int structureHighStartIndex = 0
var int structureLowStartIndex = 0
var int structureDirection = 0
var int fibo1StartIndex = 0
var int fibo2StartIndex = 0
var int fibo3StartIndex = 0
var int fibo4StartIndex = 0
var int fibo5StartIndex = 0

// Line variable
var line structureHighLine = na
var line structureLowLine = na
var line fibo1Line = na
var line fibo2Line = na
var line fibo3Line = na
var line fibo4Line = na
var line fibo5Line = na

// Label variable
var label fibo1Label = na
var label fibo2Label = na
var label fibo3Label = na
var label fibo4Label = na
var label fibo5Label = na

// Define FVG type
isBullishFVG = high[3] < low[1]
isBearishFVG = low[3] > high[1]

// Bullish FVG process
if(isBullishFVG and isFvgToShow)

    // Add FVG into FVG's array
    box _box = box.new(left=bar_index - 2, top=low[1], right=bar_index[1], bottom=high[3], border_style=line.style_solid, border_width=1, bgcolor=bullishFvgColor, border_color=color.new(color.green, 100))
    array.push(fvgBoxes, _box)
    array.push(fvgTypes, true)
    array.push(isFvgMitigated, false)

    // Check if FVG to show is upper than user parameter
    if(array.size(fvgBoxes) > fvgHistoryNbr + 1)

        // Delete the FVG and its index from arrays
        box.delete(array.get(fvgBoxes, 0))
        array.remove(fvgBoxes, 0)
        array.remove(fvgTypes, 0)
        array.remove(isFvgMitigated, 0)

// Bearish FVG process
if(isBearishFVG and isFvgToShow)

    // Add FVG into FVG's array
    box _box = box.new(left=bar_index - 2, top=low[3], right=bar_index[1], bottom=high[1], border_style=line.style_solid, border_width=1, bgcolor=bearishFvgColor, border_color=color.new(color.red, 100))
    array.push(fvgBoxes, _box)
    array.push(fvgTypes, false)
    array.push(isFvgMitigated, false)

    // Check if FVG to show is upper than user parameter
    if(array.size(fvgBoxes) > fvgHistoryNbr + 1)

        // Delete the FVG and its index from arrays
        box.delete(array.get(fvgBoxes, 0))
        array.remove(fvgBoxes, 0)
        array.remove(fvgTypes, 0)
        array.remove(isFvgMitigated, 0)

// Draw FVG
FVGDraw(fvgBoxes, fvgTypes, isFvgMitigated)

// Initialize value for bar 0
if(bar_index == 0)
    structureHighStartIndex := bar_index
    structureLowStartIndex  := bar_index
    structureHigh := high
    structureLow  := low

highest = bar_index > 10 ? ta.highest(10) : ta.highest(bar_index + 1)
highestBar = bar_index > 10 ? ta.highestbars(high, 10) : ta.highestbars(high, bar_index + 1)
lowest = bar_index > 10 ? ta.lowest(10) : ta.lowest(bar_index + 1)
lowestBar = bar_index > 10 ? ta.lowestbars(low, 10) : ta.lowestbars(low, bar_index + 1)
structureMaxBar = bar_index + get_structure_highest_bar(10)
structureMinBar = bar_index + get_structure_lowest_bar(10)
lowStructBreakPrice = isStructBodyCandleBreak ? close : low
highStructBreakPrice = isStructBodyCandleBreak ? close : high
isStuctureLowBroken = (lowStructBreakPrice < structureLow and lowStructBreakPrice[1] >= structureLow and lowStructBreakPrice[2] >= structureLow and lowStructBreakPrice[3] >= structureLow and bar_index[1] >  structureLowStartIndex and bar_index[2] >  structureLowStartIndex and bar_index[3] >  structureLowStartIndex) or (structureDirection == 2 and lowStructBreakPrice < structureLow)
isStructureHighBroken = (highStructBreakPrice > structureHigh and highStructBreakPrice[1] <= structureHigh and highStructBreakPrice[2] <= structureHigh and highStructBreakPrice[3] <= structureHigh and bar_index[1] >  structureHighStartIndex and bar_index[2] >  structureHighStartIndex and bar_index[3] >  structureHighStartIndex) or (structureDirection == 1 and highStructBreakPrice > structureHigh)

if(isStuctureLowBroken)
    // Check if structures to show is upper than user parameter
    if(array.size(structureLines) >= structHistoryNbr)

        // Delete the line and its index from arrays
        d.delete_line(array.get(structureLines, 0), array.get(structureLabels, 0))
        array.remove(structureLabels, 0)
        array.remove(structureLines, 0)


    // Create BOS line
    if(structureDirection == 1)
        array.push(structureLines, line.new(structureLowStartIndex, structureLow, bar_index, structureLow, xloc=xloc.bar_index, extend=extend.none, color=bearishBosColor, style=bosLineStyle, width=bosLineWidth))
        array.push(structureLabels, label.new((bar_index + structureLowStartIndex) / 2, structureLow, text="BOS", style=label.style_none, textcolor=bearishBosColor))

    // Create CHoCH line
    else
        array.push(structureLines, line.new(structureLowStartIndex, structureLow, bar_index, structureLow, xloc=xloc.bar_index, extend=extend.none, color=bearishChochColor, style=chochLineStyle, width=chochLineWidth))
        array.push(structureLabels, label.new((bar_index + structureLowStartIndex) / 2, structureLow, text="CHoCH", style=label.style_none, textcolor=bearishChochColor))

    // Update values for new structure
    structureDirection := 1
    structureHighStartIndex := structureMaxBar
    structureLowStartIndex  := bar_index
    structureHigh :=  high[bar_index - structureHighStartIndex] //highest
    structureLow  := low

// Check for breakout
else if(isStructureHighBroken)

    // Check if structures to show is upper than user parameter
    if(array.size(structureLines) >= structHistoryNbr)

        // Delete the line and its index from arrays
        d.delete_line(array.get(structureLines, 0), array.get(structureLabels, 0))
        array.remove(structureLabels, 0)
        array.remove(structureLines, 0)

    // Create BOS line
    if(structureDirection == 2)
        array.push(structureLines, line.new(structureHighStartIndex, structureHigh, bar_index, structureHigh, xloc=xloc.bar_index, extend=extend.none, color=bullishBosColor, style=bosLineStyle, width=bosLineWidth))
        array.push(structureLabels, label.new((bar_index + structureHighStartIndex) / 2, structureHigh, text="BOS", style=label.style_none, textcolor=bullishBosColor))

    // Create CHoCH line
    else
        array.push(structureLines, line.new(structureHighStartIndex, structureHigh, bar_index, structureHigh, xloc=xloc.bar_index, extend=extend.none, color=bullishChochColor, style=chochLineStyle, width=chochLineWidth))
        array.push(structureLabels, label.new((bar_index + structureHighStartIndex) / 2, structureHigh, text="CHoCH", style=label.style_none, textcolor=bullishChochColor))

    // Update values for new structure
    structureDirection := 2
    structureHighStartIndex := bar_index
    structureLowStartIndex  := structureMinBar
    structureHigh := high
    structureLow  := low[bar_index - structureLowStartIndex] //lowest
else
    if(high > structureHigh and (structureDirection == 0 or structureDirection == 2))
        if(not(isStructBodyCandleBreak) or not(isStructBodyCandleBreak and bar_index[1] > structureHighStartIndex and bar_index[2] >  structureHighStartIndex and bar_index[3] > structureHighStartIndex))
            structureHigh := high
            structureHighStartIndex := bar_index
    else if(low < structureLow and (structureDirection == 0 or structureDirection == 1))
        if(not(isStructBodyCandleBreak) or not(isStructBodyCandleBreak and bar_index[1] > structureLowStartIndex and bar_index[2] > structureLowStartIndex and bar_index[3] > structureLowStartIndex))
            structureLow := low
            structureLowStartIndex := bar_index

structureRange = math.abs(structureHigh - structureLow)

// Affichage de la structure actuelle
if(isCurrentStructToShow)
    d.delete_line(structureHighLine, na)
    d.delete_line(structureLowLine, na)
    structureHighLine := line.new(structureHighStartIndex, structureHigh, bar_index, structureHigh, xloc.bar_index, color=currentStructColor, style = currentStructLineStyle, width = currentStructLineWidth)
    structureLowLine := line.new(structureLowStartIndex, structureLow, bar_index, structureLow, xloc.bar_index, color=currentStructColor, style = currentStructLineStyle, width = currentStructLineWidth)

    // Affichage du Fibonnacci 1 de la structure actuelle
    if(isFibo1ToShow)
        d.delete_line(fibo1Line, fibo1Label)
        fibo1Price := structureDirection == 1 ? structureHigh - (structureRange - structureRange * fibo1Value) : structureLow + (structureRange - structureRange * fibo1Value)
        fibo1StartIndex := structureDirection == 1 ? structureHighStartIndex : structureLowStartIndex
        fibo1Line := line.new(fibo1StartIndex, fibo1Price, bar_index, fibo1Price, xloc.bar_index, color = fibo1Color, style = fibo1Style, width = fibo1LineWidth)
        fibo1Label := label.new(bar_index + 20, fibo1Price, text = str.tostring(fibo1Value) + "(" + str.tostring(fibo1Price) + ")", style = label.style_none, textcolor = fibo1Color)

    // Affichage du Fibonnacci 2 de la structure actuelle
    if(isFibo2ToShow)
        d.delete_line(fibo2Line, fibo2Label)
        fibo2Price := structureDirection == 1 ? structureHigh - (structureRange - structureRange * fibo2Value) : structureLow + (structureRange - structureRange * fibo2Value)
        fibo2StartIndex := structureDirection == 1 ? structureHighStartIndex : structureLowStartIndex
        fibo2Line := line.new(fibo2StartIndex, fibo2Price, bar_index, fibo2Price, xloc.bar_index, color = fibo2Color, style = fibo2Style, width = fibo2LineWidth)
        fibo2Label := label.new(bar_index + 20, fibo2Price, text = str.tostring(fibo2Value) + "(" + str.tostring(fibo2Price) + ")", style = label.style_none, textcolor = fibo2Color)

    // Affichage du Fibonnacci 3 de la structure actuelle
    if(isFibo3ToShow)
        d.delete_line(fibo3Line, fibo3Label)
        fibo3Price := structureDirection == 1 ? structureHigh - (structureRange - structureRange * fibo3Value) : structureLow + (structureRange - structureRange * fibo3Value)
        fibo3StartIndex := structureDirection == 1 ? structureHighStartIndex : structureLowStartIndex
        fibo3Line := line.new(fibo3StartIndex, fibo3Price, bar_index, fibo3Price, xloc.bar_index, color = fibo3Color, style = fibo3Style, width = fibo3LineWidth)
        fibo3Label := label.new(bar_index + 20, fibo3Price, text = str.tostring(fibo3Value) + "(" + str.tostring(fibo3Price) + ")", style = label.style_none, textcolor = fibo3Color)

    // Affichage du Fibonnacci 1 de la structure actuelle
    if(isFibo4ToShow)
        d.delete_line(fibo4Line, fibo4Label)
        fibo4Price := structureDirection == 1 ? structureHigh - (structureRange - structureRange * fibo4Value) : structureLow + (structureRange - structureRange * fibo4Value)
        fibo4StartIndex := structureDirection == 1 ? structureHighStartIndex : structureLowStartIndex
        fibo4Line := line.new(fibo4StartIndex, fibo4Price, bar_index, fibo4Price, xloc.bar_index, color = fibo4Color, style = fibo4Style, width = fibo4LineWidth)
        fibo4Label := label.new(bar_index + 20, fibo4Price, text = str.tostring(fibo4Value) + "(" + str.tostring(fibo4Price) + ")", style = label.style_none, textcolor = fibo4Color)

    // Affichage du Fibonnacci 1 de la structure actuelle
    if(isFibo5ToShow)
        d.delete_line(fibo5Line, fibo5Label)
        fibo5Price := structureDirection == 1 ? structureHigh - (structureRange - structureRange * fibo5Value) : structureLow + (structureRange - structureRange * fibo5Value)
        fibo5StartIndex := structureDirection == 1 ? structureHighStartIndex : structureLowStartIndex
        fibo5Line := line.new(fibo5StartIndex, fibo5Price, bar_index, fibo5Price, xloc.bar_index, color = fibo5Color, style = fibo5Style, width = fibo5LineWidth)
        fibo5Label := label.new(bar_index + 20, fibo5Price, text = str.tostring(fibo5Value) + "(" + str.tostring(fibo5Price) + ")", style = label.style_none, textcolor = fibo5Color)

plot(na)

barcolor((high <= high[1] and low >= low[1] and close >= open) ? #04fd11: na)
barcolor((high <= high[1] and low >= low[1] and open >= close) ? #f70303: na)

//-----------------------------------------------------------------------------//

//indicator("Filter out Weak pivot highs/lows", overlay = true)
lb =input.int(15, 'pivots: lookback/forward', group = 'Pivots highs & lows', tooltip = "larger number for more significant pivot highs / pivot lows")
atrMult =input.float(1.5, "Spikeyness Index", minval = 0, step =0.1, inline ='2', group = 'Pivots highs & lows', tooltip = "For catching only the 'spikier' pivot highs/pivot lows\n\nSetting to =0 will effectively remove this condition and plot standard pivot highs/lows\n\nIncreasing this number will filter out smooth/unimpressive pivot high&lows\n\nRepresents local ATR multiple for distance from local Moving average a high or low must be\n\nSetting of 1.5 seems optimal on 15m chart with pivot lookback/lookforward = 15")
useSpikeyCond =input.bool(true, "use spikey condition", inline ='3',group = 'Pivots highs & lows', tooltip ="toggle off to see how typical pivots are painted; to notice the difference/improvement")
confirmOnClose = input.bool(true, "wait 1x bar to confirm (avoid repainting)", inline ='4',group = 'Pivots highs & lows', tooltip = "default is ON, waits for realtime bar to close before confirming Pivot H/L\n\nToggle this off to get Pivot highs confirmed one bar earlier, but at the cost of sometimes causing repainting")
int x = confirmOnClose?1:0

pivHigh = ta.pivothigh(high, lb, lb)
isPivHigh = na(pivHigh)? false:true
atr = ta.atr(2*lb)
maH = ta.sma(high, 2*lb)
bool spikyH =  useSpikeyCond?pivHigh > maH+atrMult*atr:true 
var float ph = 0 
if isPivHigh[x]
    if spikyH[x]
        ph:=pivHigh[x]
        label.new(bar_index-(lb+x), high[lb+x], text ="High",color=#feffff)       

pivLow = ta.pivotlow(low, lb, lb)
isPivLow = na(pivLow)? false:true
maL = ta.sma(low, 2*lb)
bool spikyL =  useSpikeyCond? pivLow < maL-atrMult*atr:true 

var float pl = 0 
if isPivLow[x]
    if spikyL[x]
        pl:=pivLow[x]
        label.new(bar_index-(lb+x), low[lb+x], text ="Low", style = label.style_label_up, color = #feffff)

Overview

Fvg Fibo draws bullish, bearish, and mitigated gap zones and can shrink mitigated gaps. It marks break of structure and change of character lines, with an optional current structure line, and it can require a candle body to confirm a break. Two Fibonacci ratios, defaulting to 0.786 and 0.705, are drawn with user colors, styles, and widths. History limits control how many gaps and breaks stay visible. It does not generate trade entries or exits.

Details

Published by

Ahmed-GoCode on GitHub

Code credit

Ahmed - Quant-Edge Indicators, as written in the script's header

Type

Indicator, Pine Script v6

Draws

On the price chart

Category

SMC / ICT / price action, Support & resistance

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Topics

fair-value-gapfibonaccimarket-structurepine-scriptrsi-strategysmart-money-conceptstechnical-analysistradingviewalgorithmic-tradingcrypto-trading

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Display FVGbooltrueisFvgToShow
Bullish FVG Colorcolorcolor.new(#b2b5be, 70)bullishFvgColor
Bearish FVG Colorcolorcolor.new(#b2b5be, 70)bearishFvgColor
Mitigated FVG Colorcolorcolor.new(#b2b5be, 70)mitigatedFvgColor
Number of FVG to showint5fvgHistoryNbr
Reduce mitigated FVGboolfalseisMitigatedFvgToReduce
Break with candle's bodybooltrueisStructBodyCandleBreak
Display current structurebooltrueisCurrentStructToShow
Bullish BOS Colorcolorcolor.silverbullishBosColor
Bearish BOS Colorcolorcolor.silverbearishBosColor
BOS Stylestring-bosLineStyleOption
BOS Widthint1bosLineWidth
Show all 40 settings
SettingTypeDefaultVariable
Bullish CHoCH Colorcolorcolor.silverbullishChochColor
Bearish CHoCH Colorcolorcolor.silverbearishChochColor
CHoCH Stylestring-chochLineStyleOption
MSB Widthint1chochLineWidth
Current structure Colorcolorcolor.rgb(255, 4, 0)currentStructColor
Current structure Stylestring-currentStructLineStyleOption
Current structure Widthint1currentStructLineWidth
Number of break to showint10structHistoryNbr
isFibo1ToShowbooltrueisFibo1ToShow
fibo1Valuefloat0.786fibo1Value
fibo1Colorcolor#9598a1fibo1Color
fibo1StyleOptionstring-fibo1StyleOption
fibo1LineWidthint1fibo1LineWidth
isFibo2ToShowbooltrueisFibo2ToShow
fibo2Valuefloat0.705fibo2Value
fibo2Colorcolor#9598a1fibo2Color
fibo2StyleOptionstring-fibo2StyleOption
fibo2LineWidthint1fibo2LineWidth
isFibo3ToShowbooltrueisFibo3ToShow
fibo3Valuefloat0.618fibo3Value
fibo3Colorcolor#9598a1fibo3Color
fibo3StyleOptionstring-fibo3StyleOption
fibo3LineWidthint1fibo3LineWidth
isFibo4ToShowbooltrueisFibo4ToShow
fibo4Valuefloat0.5fibo4Value
fibo4Colorcolor#9598a1fibo4Color
fibo4StyleOptionstring-fibo4StyleOption
fibo4LineWidthint1fibo4LineWidth
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

ICT Equal Highs and Lows

by ArunKBhaskar
575 stars

This overlay indicator finds pivot highs and lows on the price chart and compares the last two highs and the last two lows. When the percentage difference between a pair is below the Equal HL threshold, it treats them as equal levels and draws a box. Left and

Indicator v5 SMC / ICT / price actionSupport & resistance
Updated 1 year ago · MPL-2.0 GitHub repository of ICT Equal Highs and Lows

DE-tracker

by Allen1212
303 stars

This indicator plots labels on the TradingView price chart to mark ARK Invest's buy and sell trades for the DE stock. Buy transactions appear in green with X1 or X2 multipliers showing the number of ARK ETFs involved on the same day; sells appear in red. The m

Indicator v4 Support & resistanceSMC / ICT / price action
Updated 2 years ago · None stated GitHub repository of DE-tracker

This Pine Script indicator plots a ZigZag on the price chart. It identifies reversal points when price moves more than a set percentage from the last pivot. The script calculates forecasts using zigzag data and labels detected geometric patterns including harm

Indicator v4 TrendSupport & resistance

Golden Bullet Strategy

by TradersPost
218 stars

The Golden Bullet Strategy is an overlay signal indicator based on Smart Money Concepts and time-based liquidity models. It identifies liquidity sweeps of a designated reference session range during a specified hunt window. It then confirms Market Structure Sh

Indicator v6 SMC / ICT / price actionSessions & time
Updated 3 months ago · None stated GitHub repository of Golden Bullet Strategy

Open Source Fractal

by cantolab
183 stars

This indicator implements the Fractal Model concept to plot market structure shifts, liquidity sweeps, and Change in State of Delivery (CISD) levels. It overlays custom higher-timeframe candle previews, open prices, and time markers directly on the price chart

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · MIT GitHub repository of Open Source Fractal

Swing Failure Signals

by Ganador1
154 stars

This indicator calculates pivot highs and pivot lows to detect liquidity sweeps and Swing Failure Patterns. It identifies when price breaks past recent key swing highs or lows within a configurable historical window, then looks for a quick reversal or change i

Indicator v6 SMC / ICT / price actionSupport & resistance
Updated 2 months ago · Apache-2.0 GitHub repository of Swing Failure Signals

More indicators

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers