Join our fan page
- Views:
- 97
- Rating:
- Published:
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

Detects bullish and bearish fair value gaps (three-candle imbalances) on closed bars only, so zones don't repaint, and tracks each zone until it's mitigated. Zone state and price levels are exposed through iCustom buffers, so an EA can read them without parsing chart objects.
A bullish gap is formed when the high of candle 1 is below the low of candle 3; a bearish gap is the mirror. Bar 0 is never used for detection or mitigation. Each zone is drawn as a rectangle that extends right until it's mitigated.
| Input | Default | Meaning |
|---|---|---|
| InpMinSizeMode | MIN_POINTS | How the minimum gap size is measured: points, or a fraction of ATR. |
| InpMinSize | 0.0 | Minimum gap size (points, or ATR multiplier). 0 keeps every gap. |
| InpAtrPeriod | 14 | ATR period for MIN_ATR_FRACTION, 1–500. |
| InpMitigation | MIT_FULL_FILL | MIT_TOUCH: the zone is mitigated when price enters it. MIT_FULL_FILL: mitigated only when price crosses the whole zone. |
| InpBullColor | clrLimeGreen | Bullish zone color. |
| InpBearColor | clrTomato | Bearish zone color. |
| InpMitigatedColor | clrGray | Mitigated zone color. |
| InpShowMitigated | true | Keep mitigated zones on the chart (false deletes them). |
| InpMaxZones | 100 | Most recent zones tracked and drawn, 1–5000. |
| InpHistoryBars | 3000 | Bars scanned on the first calculation, 100–100000. |
Zone states: 0 none, 1 active, 2 touched, 3 mitigated. "Touched" means partially filled: price entered the zone but didn't cross it. It only occurs in MIT_FULL_FILL mode; in MIT_TOUCH the first entry mitigates the zone.
iCustom buffers (not plotted, visible in the Data Window). Values are written on the bar of candle 3, the bar where the gap is confirmed:
- 0: state (0–3), updated as the zone changes
- 1: top price (EMPTY_VALUE if no gap)
- 2: bottom price (EMPTY_VALUE if no gap)
- 3: direction (+1 bullish, -1 bearish, 0 none)
Zones dropped by InpMaxZones keep their last buffer state.
int h = iCustom(_Symbol, _Period, "FairValueGaps"); double st[1], top[1], bot[1], dir[1]; if(h != INVALID_HANDLE && CopyBuffer(h, 0, 1, 1, st) == 1 && CopyBuffer(h, 1, 1, 1, top) == 1 && CopyBuffer(h, 2, 1, 1, bot) == 1 && CopyBuffer(h, 3, 1, 1, dir) == 1 && dir[0] != 0) PrintFormat("FVG on bar 1: dir %d, %.5f-%.5f, state %d", (int)dir[0], bot[0], top[0], (int)st[0]);
No alerts, no trading, no DLL or WebRequest. Chart objects use the FVGZ_ prefix and are removed with the indicator.
Prop Firm Live Daily Breach Line (OrderCalcProfit and iCustom Ready)
Real-time daily drawdown buffer monitor and exact breach price line indicator for prop firm accounts. Features 00:00 server-time deal history reconstruction (including entry commissions), 00:00 HWM snapshot locking, two-stage OrderCalcProfit cross-rate calibration, and iCustom() data buffers for Expert Advisors.
Leverage Monitor – Real Leverage, Margin Tiers, Swap, Commission and Spread
See the real leverage of every Market Watch symbol, including floating margin tiers, with swap, commission and live spread in one panel.
Algo: EMA Trend Cross on Closed Bars — XAUUSD M30
Free educational EA — a single-position trend-following EMA crossover system for XAUUSD M30, released as open source for beginners to study trade ownership guards, preflight order validation, risk-based lot sizing, and server-time session filtering. This code demonstrates how a strategy - identifies and manages only its own positions and orders through MagicNumber and comment tags, - wraps CTrade with an OrderCheck preflight that blocks invalid or margin-breaking requests, - sizes each trade from a fixed stop-loss and risk percentage, - and restricts entries to a configurable broker session window with a daily close-all — all evaluated on completed bars only, so signals never repaint.
MACD Signals
Indicator edition for new platform.