Simple Fair Value Gap (FVG) Detector – Code Snippet

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #266124 quote

    Hello everyone, I want to share a simple but effective code snippet I use to detect Fair Value Gaps (FVG). It highlights both Bullish (green) and Bearish (red) imbalances based on a standard 3-candle pattern. You can easily integrate this logic into your own strategies as a trend or entry filter. Here is the code:

    // --- FAIR VALUE GAP (FVG) DETECTION ---
    
    
    MinGap = 2 * pipsize 
    
    
    // 1. Bullish FVG
    BullishFVG = (Low > High[2]) AND (Low - High[2] >= MinGap)
    
    
    // 2. Bearish FVG
    BearishFVG = (High < Low[2]) AND (Low[2] - High >= MinGap)
    
    
    // --- VISUAL REPRESENTATION ---
    IF BullishFVG THEN
       DrawRectangle(barindex[2], High[2], barindex, Low) coloured(0,255,0,50) bordercolor(0,255,0,0) 
    ENDIF
    
    
    IF BearishFVG THEN
       DrawRectangle(barindex[2], Low[2], barindex, High) coloured(255,0,0,50) bordercolor(255,0,0,0) 
    ENDIF
    
    
    RETURN
    
    

    This is the core mathematical logic I use to filter imbalances in my automated systems. If you want to see how I trade these gaps fully automated on Micro Nasdaq (MNQ) and Micro Gold (MGC), you can test my complete strategy free for 30 days here: https://market.prorealcode.com/product/quantra-algorithmic-nasdaq-gold-trend-duo/

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

Simple Fair Value Gap (FVG) Detector – Code Snippet


ProBuilder: Indicators & Custom Tools

New Reply
Summary

This topic contains 1 voice and has 0 replies.

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 11/09/2026
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...