Fair Value Gaps

Fair Value Gaps is an indicator drawn over the price chart.

statesmart money

fair-value-gaps.abx
1indicator "Fair Value Gaps"
2pane: price
3
4input keep = 15
5input min_gap = 0.5
6
7state gaps: list<Zone> = []
8
9for gap in fair_value_gaps(min_size: min_gap, new_only: true):
10gaps.push(gap)
11gaps = gaps.filter(g => not g.mitigated).keep_last(keep)
12
13for g in gaps:
14box 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)
15label if g.bullish then "FVG +" else "FVG -", at: (g.formed_bar, g.mid), color: gray
What this script says

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 -".

Try this in the Terminal. AlgoBars is free: $0 a month, no card needed.

Create my free account