OPEN-SOURCE SCRIPT
Swing Trend FVG / IFVG Entry Clean

Swing Trend FVG / IFVG Entry Clean
Swing Trend FVG / IFVG Entry Clean is a structure-based entry indicator designed to identify higher-quality setups using true swing points, trend context, and Fair Value Gaps (FVGs) / Inverse Fair Value Gaps (IFVGs).
The goal of this tool is not to generate more signals - it is built to generate better signals by requiring price to show:
a valid swing start
directional structure
displacement
a meaningful imbalance zone
and a qualified entry condition
This makes it best suited for traders who want cleaner continuation and reversal-style entries inside structured price action, rather than random signals in chop.
How the indicator works
The indicator follows a structured sequence:
Find a swing start
Check trend context
Wait for displacement
Require an FVG or IFVG
Only then allow an entry
Optionally wait for a retest
If there is no Fair Value Gap or Inverse Fair Value Gap, there is no signal.
Core logic
1) Swing-start detection
The indicator can detect swing starts using:
5-Candle Pivot
2-Candle Reversal
Both
A swing start is designed to identify the beginning of a meaningful move rather than a random candle in the middle of consolidation.
5-Candle Pivot
This is the stronger, more classic pivot model.
A bullish pivot is formed when the center candle makes the lowest low relative to the 2 candles on each side.
A bearish pivot is formed when the center candle makes the highest high relative to the 2 candles on each side.
This creates the V-shape or inverted V-shape structure that often marks a true swing.
2-Candle Reversal
This is the faster swing model.
A bullish 2-candle swing looks for a strong rejection wick followed by a stronger confirmation candle.
A bearish 2-candle swing does the opposite.
This can help catch earlier reversals before a full 5-candle pivot is confirmed.
Optional sweep filter
You can also require the swing to sweep a prior pivot, which can help remove weaker starts and focus on more meaningful liquidity grabs.
2) Trend filter
The indicator includes a trend filter that can be turned on or off.
Available modes:
Off
EMA Only
Structure Only
EMA + Structure
This allows the indicator to work either:
as a stricter trend-following tool
or as a more flexible structure-only tool
EMA trend logic
Bullish trend:
price above fast EMA
fast EMA above slow EMA
Bearish trend:
price below fast EMA
fast EMA below slow EMA
Structure trend logic
The indicator also uses hidden market structure logic without drawing trendlines on the chart.
Available structure strength modes:
2-Point
3-Point
Both
2-Point structure
Faster trend confirmation using the most recent pivots.
3-Point structure
Stronger trend confirmation using a more developed sequence of pivots.
Both
This is the strictest option and is designed for traders who want better filtering, not more setups.
3) Displacement requirement
After a valid swing start, price must show displacement.
This is measured using ATR-based expansion, so the indicator only accepts moves that have enough strength to suggest real momentum rather than drift.
If the move does not show enough displacement, the setup is ignored.
4) Fair Value Gap and Inverse Fair Value Gap logic
This indicator focuses only on:
FVG
IFVG
FVG
A standard Fair Value Gap is created when price leaves an imbalance between candles.
IFVG
An Inverse Fair Value Gap is formed when a previously respected FVG is invalidated and flips role:
a broken bearish FVG can become a bullish IFVG
a broken bullish FVG can become a bearish IFVG
This lets the indicator work with both fresh imbalances and flipped imbalance zones.
5) Minimum zone size filter
The indicator lets you define the minimum size of the FVG / IFVG in ticks.
This is important because:
larger gaps often reflect stronger momentum
smaller gaps are more likely to be noise
If the FVG or IFVG is too small, the setup is ignored.
This helps improve quality by avoiding weak zones.
6) Entry mode
You can choose between two entry models:
Gap Close
As soon as the candle closes and creates the FVG or IFVG, the signal can trigger immediately.
This is the more aggressive entry style and is useful when strong momentum often continues without a clean retest.
Retest
The indicator waits for price to return into the FVG / IFVG zone before signaling.
This is the more conservative entry style and can offer cleaner risk placement.
Optional refined-half retest
You can also require price to retest deeper into the zone, including the Consequent Encroachment (CE) midpoint region.
Visual features
The indicator can display:
Bullish and bearish zones
CE midpoint lines
Start markers
Entry signals
Zone labels (FVG / IFVG)
You can customize:
bull zone color
bear zone color
CE line colors
start marker style
start marker text
start marker size
bull / bear start marker colors
entry label size
zone extension length
This makes it easy to keep the chart clean while still showing the key structure.
Suggested settings
These are good starting settings if your goal is better signals, not more signals.
Conservative trend-following setup
Swing Detection Mode: 5-Candle Pivot
Require Sweep Of Prior Pivot: Off to start, then test On
Trend Filter: On
Trend Mode: EMA + Structure
Structure Strength: 3-Point
Min Displacement ATR x: 0.6
Use FVG: On
Use IFVG: On
Minimum FVG Size In Ticks: 8
Minimum IFVG Size In Ticks: 8
Entry Mode: Gap Close
Use CE Midpoint: On
Retest Must Reach Refined Half: Off
Use Volume Confirmation: On
Volume > Average x: 1.0 to 1.2
Stricter filtering
If you want even fewer but stronger setups:
Structure Strength: Both
Require Sweep Of Prior Pivot: On
Entry Mode: Retest
Faster detection
If you want earlier starts:
Swing Detection Mode: Both
Best use case
This indicator is best used for traders who want to identify:
structured swing starts
momentum-based imbalances
FVG / IFVG continuation or reversal-style entries
cleaner setups inside trend context
It is especially useful for traders who like combining:
swing structure
displacement
imbalance zones
retest logic
momentum filtering
Notes
3-Point structure is generally stronger than 2-point structure.
Both structure mode is the strictest and may reduce signal count significantly.
Gap Close mode is more aggressive.
Retest mode is more selective.
Small FVGs and IFVGs are filtered out using tick-size thresholds, which can help avoid weaker zones.
Swing Trend FVG / IFVG Entry Clean is a structure-based entry indicator designed to identify higher-quality setups using true swing points, trend context, and Fair Value Gaps (FVGs) / Inverse Fair Value Gaps (IFVGs).
The goal of this tool is not to generate more signals - it is built to generate better signals by requiring price to show:
a valid swing start
directional structure
displacement
a meaningful imbalance zone
and a qualified entry condition
This makes it best suited for traders who want cleaner continuation and reversal-style entries inside structured price action, rather than random signals in chop.
How the indicator works
The indicator follows a structured sequence:
Find a swing start
Check trend context
Wait for displacement
Require an FVG or IFVG
Only then allow an entry
Optionally wait for a retest
If there is no Fair Value Gap or Inverse Fair Value Gap, there is no signal.
Core logic
1) Swing-start detection
The indicator can detect swing starts using:
5-Candle Pivot
2-Candle Reversal
Both
A swing start is designed to identify the beginning of a meaningful move rather than a random candle in the middle of consolidation.
5-Candle Pivot
This is the stronger, more classic pivot model.
A bullish pivot is formed when the center candle makes the lowest low relative to the 2 candles on each side.
A bearish pivot is formed when the center candle makes the highest high relative to the 2 candles on each side.
This creates the V-shape or inverted V-shape structure that often marks a true swing.
2-Candle Reversal
This is the faster swing model.
A bullish 2-candle swing looks for a strong rejection wick followed by a stronger confirmation candle.
A bearish 2-candle swing does the opposite.
This can help catch earlier reversals before a full 5-candle pivot is confirmed.
Optional sweep filter
You can also require the swing to sweep a prior pivot, which can help remove weaker starts and focus on more meaningful liquidity grabs.
2) Trend filter
The indicator includes a trend filter that can be turned on or off.
Available modes:
Off
EMA Only
Structure Only
EMA + Structure
This allows the indicator to work either:
as a stricter trend-following tool
or as a more flexible structure-only tool
EMA trend logic
Bullish trend:
price above fast EMA
fast EMA above slow EMA
Bearish trend:
price below fast EMA
fast EMA below slow EMA
Structure trend logic
The indicator also uses hidden market structure logic without drawing trendlines on the chart.
Available structure strength modes:
2-Point
3-Point
Both
2-Point structure
Faster trend confirmation using the most recent pivots.
3-Point structure
Stronger trend confirmation using a more developed sequence of pivots.
Both
This is the strictest option and is designed for traders who want better filtering, not more setups.
3) Displacement requirement
After a valid swing start, price must show displacement.
This is measured using ATR-based expansion, so the indicator only accepts moves that have enough strength to suggest real momentum rather than drift.
If the move does not show enough displacement, the setup is ignored.
4) Fair Value Gap and Inverse Fair Value Gap logic
This indicator focuses only on:
FVG
IFVG
FVG
A standard Fair Value Gap is created when price leaves an imbalance between candles.
IFVG
An Inverse Fair Value Gap is formed when a previously respected FVG is invalidated and flips role:
a broken bearish FVG can become a bullish IFVG
a broken bullish FVG can become a bearish IFVG
This lets the indicator work with both fresh imbalances and flipped imbalance zones.
5) Minimum zone size filter
The indicator lets you define the minimum size of the FVG / IFVG in ticks.
This is important because:
larger gaps often reflect stronger momentum
smaller gaps are more likely to be noise
If the FVG or IFVG is too small, the setup is ignored.
This helps improve quality by avoiding weak zones.
6) Entry mode
You can choose between two entry models:
Gap Close
As soon as the candle closes and creates the FVG or IFVG, the signal can trigger immediately.
This is the more aggressive entry style and is useful when strong momentum often continues without a clean retest.
Retest
The indicator waits for price to return into the FVG / IFVG zone before signaling.
This is the more conservative entry style and can offer cleaner risk placement.
Optional refined-half retest
You can also require price to retest deeper into the zone, including the Consequent Encroachment (CE) midpoint region.
Visual features
The indicator can display:
Bullish and bearish zones
CE midpoint lines
Start markers
Entry signals
Zone labels (FVG / IFVG)
You can customize:
bull zone color
bear zone color
CE line colors
start marker style
start marker text
start marker size
bull / bear start marker colors
entry label size
zone extension length
This makes it easy to keep the chart clean while still showing the key structure.
Suggested settings
These are good starting settings if your goal is better signals, not more signals.
Conservative trend-following setup
Swing Detection Mode: 5-Candle Pivot
Require Sweep Of Prior Pivot: Off to start, then test On
Trend Filter: On
Trend Mode: EMA + Structure
Structure Strength: 3-Point
Min Displacement ATR x: 0.6
Use FVG: On
Use IFVG: On
Minimum FVG Size In Ticks: 8
Minimum IFVG Size In Ticks: 8
Entry Mode: Gap Close
Use CE Midpoint: On
Retest Must Reach Refined Half: Off
Use Volume Confirmation: On
Volume > Average x: 1.0 to 1.2
Stricter filtering
If you want even fewer but stronger setups:
Structure Strength: Both
Require Sweep Of Prior Pivot: On
Entry Mode: Retest
Faster detection
If you want earlier starts:
Swing Detection Mode: Both
Best use case
This indicator is best used for traders who want to identify:
structured swing starts
momentum-based imbalances
FVG / IFVG continuation or reversal-style entries
cleaner setups inside trend context
It is especially useful for traders who like combining:
swing structure
displacement
imbalance zones
retest logic
momentum filtering
Notes
3-Point structure is generally stronger than 2-point structure.
Both structure mode is the strictest and may reduce signal count significantly.
Gap Close mode is more aggressive.
Retest mode is more selective.
Small FVGs and IFVGs are filtered out using tick-size thresholds, which can help avoid weaker zones.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.
Açık kaynak kodlu komut dosyası
Gerçek TradingView ruhuyla, bu komut dosyasının mimarı, yatırımcıların işlevselliğini inceleyip doğrulayabilmesi için onu açık kaynaklı hale getirdi. Yazarı tebrik ederiz! Ücretsiz olarak kullanabilseniz de, kodu yeniden yayınlamanın Topluluk Kurallarımıza tabi olduğunu unutmayın.
Feragatname
Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.