OPEN-SOURCE SCRIPT

TTP IFVG Signals With EMA /ICT Gold scalping

84
This script uses original logic and alerting rules. in Japan
finding ICT IFVG and EMA conditions.

#IFVG, Forex, ICT, EMA, Scalping, Indicator

This indicator automatically finds IFVG (Imbalance / Fair Value Gap) zones and gives you a buy or sell signal when price comes back and breaks out through that gap.
It also draws a colored box over the gap so you can see the zone visually, and it raises alerts when a new signal appears.

High-level logic:
On every bar, the script looks back up to “IFVG_GapBars” bars.
For each offset i it checks a 3-candle pattern:
– If the low of the newer candle is above the high of the older candle: bullish FVG (price jumped up, leaving a gap).
– If the high of the newer candle is below the low of the older candle: bearish FVG (price jumped down, leaving a gap).

When a valid FVG is found:
– For a bullish FVG it looks for a later close that breaks down through that gap (sell signal).
– For a bearish FVG it looks for a later close that breaks up through that gap (buy signal).
– A moving-average trend filter must agree (downtrend for sells, uptrend for buys).
– It checks that price has not already “filled” the gap before the breakout.

If all conditions are satisfied, it:
– Sets signal_dir = 1 for a buy, or -1 for a sell.
– Draws a box from the original FVG bar to the bar just before the breakout (extended a bit to the right), between the gap high and gap low.
– Plots an ▲ label for buys or ▼ label for sells.
– Triggers the corresponding alert conditions.

Now the parameters:

PipSizeMultilier (PipSizeManual)
Multiplies the symbol’s minimum tick size (syminfo.mintick).
It is used when converting “MinFVG_Pips” into an actual price distance.
If you feel the indicator is too sensitive (too many small gaps), you can increase this multiplier to effectively require a larger price difference.

TickSize
Internal value = syminfo.mintick * PipSizeMultiplier.
This is the actual price step the script uses as a “pip” when checking minimum gap size.

FVG Search Lookback (IFVG_GapBars)
How many bars back from the current bar the script will scan for a 3-candle FVG pattern.
Larger value = it can find older FVGs, but loop cost is higher.

Min FVG Size (Pips/Points) (MinFVG_Pips)
Minimum allowed size of the gap, measured in “pips/points” using TickSize.
If the vertical distance between the gap high and gap low is smaller than this, the gap is ignored.
0.0 means “no size filter” (every FVG is allowed).

FVG Epsilon (Price Units) (FVG_EpsPoints)
Tolerance for the FVG detection.
It is subtracted/added in the condition that checks “low > old high” or “high < old low”.
0.0 means strict gap (no overlap at all). A small positive epsilon allows tiny overlaps to still count as a gap.

Show IFVG Zones (ShowZones)
If true, the script draws a box over the IFVG zone when a signal is confirmed.
If false, no boxes are drawn; you only see the ▲ / ▼ markers and alerts.

Buy Zone Color (ZoneColorBuy)
Fill color and border color for boxes created from bearish FVGs that later produce a buy signal.

Sell Zone Color (ZoneColorSell)
Fill color and border color for boxes created from bullish FVGs that later produce a sell signal.

Box Extension (Bars) (BoxExtension)
How many extra bars to extend the right side of the box beyond the breakout bar.
The internal right coordinate is “bar_index - 1 + BoxExtension”.
Increase this if you want the zone to visually extend further into the future.

MA Period (MA_Period)
Lookback length of the moving average used as a trend filter.

MA Type (MA_Kind)
Type of moving average: “SMA” or “EMA”.
If SMA is chosen, the script uses ta.sma; if EMA, it uses ta.ema.

Moving-average filter behavior:
For sell signals (from bullish FVG): MA must be sloping down (MA < MA[1]) and price must be below MA.
For buy signals (from bearish FVG): MA must be sloping up (MA > MA[1]) and price must be above MA.
If these conditions are not satisfied, the FVG is ignored even if the gap and breakout conditions are met.

Signals and alerts:
signal_dir = 1 → buy signal, ▲ label below the bar, “IFVG Buy Alert” / “IFVG Buy/Sell Alert” can fire.
signal_dir = -1 → sell signal, ▼ label above the bar, “IFVG Sell Alert” / “IFVG Buy/Sell Alert” can fire.
signal_dir = 0 → no new signal on this bar.

In short:
This indicator finds 3-candle IFVG gaps, filters them by size and trend, waits for a clean breakout through the gap, draws a box on the original gap zone, and gives you a clear buy or sell signal plus alerts.


Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.