FVG indicator

 avatar
user_6299896
plain_text
10 days ago
762 B
2
Indexable
Never
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © leonidasbuechler

//@version=5
indicator("Fair Value Gaps", overlay = true)

fvg1 = (close[1] - open[1] > 0.0010) or (open[1] - close[1] > 0.001)
fvg2 = (high[2] < low) or (open[2] > high)
fvg = fvg1 and fvg2

if fvg and close[1] > open[1] and low - high[2] > 0.0005
    box.new(bar_index - 2, low, bar_index + 10, high[2], xloc = xloc.bar_index, bgcolor = color.new(color.green, 80), border_color = color.new(color.green, 100))

if fvg and open[1] > close[1] and low[2] - high > 0.0005
    box.new(bar_index - 2, high, bar_index + 10, low[2], xloc = xloc.bar_index, bgcolor = color.new(color.red, 80), border_color = color.new(color.green, 100))
Leave a Comment