FVG
Download scriptThis script is designed to identify and visually highlight specific types of price action on a trading chart known as "Fair Value Gaps" (FVG). These gaps represent moments where the market moves so rapidly that it leaves behind an imbalance, which traders often watch for potential price reactions or returns.
How the Logic Works
The script automatically scans your chart's historical data to find these imbalances and draws clear visual boxes on your screen to mark them. Here is the step-by-step breakdown of the logic:
1. Identifying Market Imbalances The tool looks at the relationship between three consecutive candles (price bars) to determine if a gap has formed:
- Bullish Gaps (Buy Ranges): The script checks for a strong upward move where the "low" price of a current candle is higher than the "high" price of a previous candle. If this happens alongside a green candle, it marks a potential area of interest for buyers.
- Bearish Gaps (Sell Ranges): Conversely, it looks for sharp downward moves where the "high" price of a current candle is lower than the "low" price of a previous candle. If this occurs with a red candle, it identifies a potential area of interest for sellers.
2. Visual Representation Once these gaps are detected, the script automatically draws geometric rectangles on your chart:
- Blue Boxes: These represent "Buy Ranges." They highlight zones where the market moved up quickly, potentially leaving a "gap" that price might revisit.
- Red Boxes: These represent "Sell Ranges." They highlight zones where the market dropped aggressively.
3. Dynamic Chart Management To keep your trading workspace clean and organized, the script includes several automated maintenance features:
- Real-Time Updates: The indicator is designed to refresh as new data comes in, ensuring that the marks stay relevant to the current price action.
- Smart Cleanup: It manages the memory of the chart by deleting old objects automatically. This prevents your screen from becoming cluttered with outdated information and ensures the platform runs smoothly without lag.
- Automatic Removal: When you remove the indicator from your chart, it is programmed to clean up all the boxes it drew, leaving your chart exactly as you found it.
Summary for Traders Instead of manually hunting for price gaps, this script automates that process for you. It filters the "noise" of the market to highlight specific imbalances, providing you with a visual roadmap of where significant momentum occurred and where the market might react in the future.
ÿþ/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
/ / | F a i r V a l u e G a p I n d i c a t o r |
/ / | C o p y r i g h t 2 0 2 4 , H i e u H o a n g |
/ / + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
# p r o p e r t y c o p y r i g h t "