Files
noteQuant-backtest/backend/indicators/fvg.py
T
moen0 bcf6348756 fvg and ob indicators
Front-end start
2026-04-10 19:54:56 +02:00

27 lines
616 B
Python

def find_fvgs(candles):
fvgs = []
for i in range(2, len(candles)):
c1 = candles[i - 2]
c2 = candles[i - 1]
c3 = candles[i]
# Bullish
if c1.high < c3.low:
fvgs.append({
"index": i - 1,
"type": "bullish",
"top": c3.low,
"bottom": c1.high
})
# bearish
elif c1.low > c3.high:
fvgs.append({
"index": i - 1,
"type": "bearish",
"top": c1.low,
"bottom": c3.high
})
return fvgs