OPEN-SOURCE SCRIPT

FVG (ICT) with Swing Levels

This indicator, called "Fair Value Gaps (ICT) with Swing Levels", overlays on the main chart and does the following:

Initial Setup:

It defines user-adjustable parameters:

lookback: Lookback period to keep FVGs visible.
swingPeriod: Period for calculating swing highs and lows.
bullColor and bearColor: Colors for bullish and bearish FVGs.




Fair Value Gaps (FVGs) Detection:

Uses a function to identify FVGs by comparing candle high and low prices.
A bullish FVG forms when the low of two candles ago is higher than the high of the current candle.
A bearish FVG forms when the high of two candles ago is lower than the low of the current candle.


Swing Levels Calculation:

Calculates swing highs and lows over the specified period.
These swing levels define the current market range.


Current Range Verification:

Implements a function to check if an FVG is within the range defined by swing levels.
This ensures only the most relevant FVGs for the current market situation are displayed.


FVG Drawing:

When it detects an FVG (bullish or bearish) within the current range, it draws a box on the chart.
Boxes extend from the bar where the FVG formed to the current bar.
Bullish FVGs are drawn in green and bearish in red (colors are customizable).


Old FVGs Management:

On each new bar, the indicator checks all existing FVG boxes.
It removes boxes that are outside the specified lookback period.
It also removes boxes that are no longer within the current range of swing levels.


Swing Levels Visualization:

Draws lines on the chart to show swing highs (in blue) and swing lows (in purple).
These lines help visualize the current market range.


Continuous Update:

The indicator updates on each new candle, constantly refreshing FVGs and swing levels.



In summary, this indicator identifies and visualizes Fair Value Gaps according to the ICT methodology, filtering them based on higher timeframe swing levels. This helps traders focus on the most significant FVGs within the current market context, reducing visual noise and potentially improving trading decision-making.
fairvaluegapFractalfvgictictconceptsictfvgictstudent

สคริปต์โอเพนซอร์ซ

ด้วยเจตนารมณ์หลักของ TradingView ผู้เขียนสคริปต์นี้ได้เผยแพร่เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถเข้าใจและตรวจสอบได้ ต้องขอบคุณผู้เขียน! ที่ให้คุณใช้ได้ฟรี แต่การนำโค้ดนี้ไปใช้ในการเผยแพร่ซ้ำจะต้องอยู่ภายใต้ กฎระเบียบการใช้งาน คุณสามารถตั้งเป็นรายการโปรดเพื่อใช้บนชาร์ตได้

ต้องการที่จะใช้สคริปต์นี้บนชาร์ตใช่ไหม?

คำจำกัดสิทธิ์ความรับผิดชอบ