Fair Value Gaps
Fair Value Gaps is an indicator drawn over the price chart.
statesmart money
indicator "Fair Value Gaps"pane: priceinput keep = 15input min_gap = 0.5state gaps: list<Zone> = []for gap in fair_value_gaps(min_size: min_gap, new_only: true):gaps.push(gap)gaps = gaps.filter(g => not g.mitigated).keep_last(keep)for g in gaps:box id: g.id, from: (g.formed_bar, g.top), to: (bar.index, g.bottom), color: if g.bullish then teal.fade(75) else orange.fade(75)label if g.bullish then "FVG +" else "FVG -", at: (g.formed_bar, g.mid), color: graySample data. Not a result. The real AlgoBarsX engine ran this exact script on made-up bars, and this replays what it drew and did. It shows no profit or loss, and it says nothing about how the script would do in a real market.
Replay of this script on 150 sample bars: 0 lines drawn.
Fair Value Gaps is an indicator drawn over the price chart.
You can change 2 inputs: keep (default 15) and min_gap (default 0.5).
It remembers gaps from one bar to the next.
It calculates gaps as gaps.filter(g => not g.mitigated).keep_last(keep).
On each bar, it goes through each gap in the fair value gaps and adds gap to gaps.
On each bar, it goes through each g in gaps and draws a box and labels if g.bullish then "FVG +" else "FVG -".