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精神,此脚本的作者已将其开源,以便交易者可以理解和验证它。向作者致敬!您可以免费使用它,但在出版物中重复使用此代码受网站规则约束。 您可以收藏它以在图表上使用。

想在图表上使用此脚本?

免责声明