Grid Market Facilitation Index EA
- 专家
- 版本: 3.12
- 激活: 5
LET VOLUME CONFIRM THE MOVE BEFORE THE FIRST LEVEL
Grid Market Facilitation Index EA holds back its opening order until a bar shows range and participation growing together, the classic Bill Williams "Green" bar, takes its side from where that bar closed against a moving average, and then hands over to a disciplined ladder engine that banks small net gains and trims its oldest positions piece by piece.
Try it at no cost first: open the MetaTrader 5 Strategy Tester, pick a symbol, tick visual mode and press Start. The coloured Market Facilitation Index histogram appears under the price chart, an arrow marks every candle that launched a cycle, and the new MFI Zone row tells you on each bar whether the market is Green, Fading, Faking or Squatting. Your broker's own history, your own settings, zero risk.
- Entry: a fresh Green MFI bar (MFI rising and volume rising) on a closed candle; close above the trend average arms a buy cycle, close below arms a sell cycle.
- Filters: optional block after a Fake bar, optional Squat-before-Green breakout rule, optional minimum volume increase, and a choice of how many Green bars in a row are required.
- MFI Zone row (new): current zone, MFI value, volume change in percent and how many bars the zone has lasted.
- Engine: buy and sell ladders side by side, ATR distances, net group closures after swap and commission, partial slicing of the heaviest order.
- Multi-chart safe: saved state is keyed to the account, symbol and both magic numbers, and a start-up lock refuses a magic that another chart already uses.
FIRST STEPS
- Symbol and period: EURUSD H1 or XAUUSD H1 are friendly places to begin; any instrument and timeframe works.
- Settings: keep the shipped values at first. The opening lot is 0.01, every extra level adds 0.01 and one order can never exceed 1.0 lot.
- Balance: size the deposit so it can survive a long trend against an open ladder. On small accounts stay at 0.01.
- Observe first: set RunMode to scan only (the file ships armed), watch which plans the panel builds, then switch to armed with the panel button when they make sense to you.
- Hedge cycle: keep it switched off until the plain grid is familiar.
WHAT THE MARKET FACILITATION INDEX ADDS TO A GRID
Many grids open at an arbitrary moment and then sit in a dead range, stacking levels that never reach a target. Bill Williams designed the Market Facilitation Index to show how easily price travels per unit of volume. On its own the number says little; the insight comes from comparing each bar with the one before it, which sorts every candle into four groups:
- Green - MFI up and volume up. New participants are joining and price is moving with them.
- Fade - MFI down and volume down. Interest is draining away; the market is losing energy.
- Fake - MFI up but volume down. Price slides easily, yet few traders back the move.
- Squat - MFI down while volume rises. Buyers and sellers fight hard in a narrow range, often just before a break.
The EA reads the built-in iBWMFI indicator with tick or real volume and waits for a Green bar that follows a non-Green bar, so a long Green stretch counts once rather than firing again and again. You may ask for two or more Green bars in a row, refuse signals right after a Fake bar, demand that a Squat came first, or set a minimum volume rise. Because the MFI has no direction, the side is decided by the signal candle's close against a moving average of price whose length and method you choose. Afterwards the direction permissions, the reverse switch and the bar spacing between signals are applied. Only completed candles are used, so arrows stay exactly where they were placed.
NEW IN VERSION 3.12
MFI Zone row. One glance answers the question every grid trader asks: is anybody actually trading this move? The row prints the zone of the last closed bar (GREEN, FADE, FAKE or SQUAT), the MFI reading, the volume change against the previous bar as a signed percent, and a counter of how many bars that zone has held. It reads the same indicator handle that produces signals, so the panel and the logic never disagree.
Histogram and arrows on the chart. On live and visual charts the four-colour MFI histogram is attached in its own subwindow and removed again with the EA; each candle that started a cycle receives an arrow.
Independent memory per chart. Stored values, retry queues and hedge bookkeeping use keys made from account, symbol and both magic numbers, and every position loop filters by symbol and magic, so two charts on one account never mix their books.
Honest margin check. Before every level the terminal calculates the real margin of that order and compares it, with a buffer, to free margin. Large accounts are not refused valid levels.
Careful defaults. A conservative lot ceiling and netting margin cap mean an untouched installation already stays within sensible limits.
ONE CYCLE FROM SIGNAL TO SETTLEMENT
1. Watching. Fade, Fake and Squat bars open nothing. The MFI Zone row and the signal gate show what the market is doing and how many bars remain before another signal may be accepted.
2. Opening. A fresh Green run that passes your filters and closes clearly on one side of the trend average opens the first level, after the direction switches and bar gap are checked. The candle gets an arrow.
3. Laddering. As price drifts away from the start, further levels join. The buy and sell ladders can run together, each with its own anchor and count, or a single side can trade. Distances follow ATR between a floor and a ceiling, or stay fixed in points.
4. Banking. The scanner combines the oldest and newest orders of a side and closes the group once their net result after swap and commission beats your target. If the oldest order is too heavy to close in one go, only a slice is removed, paid for with profit already sitting in newer orders. Bounce by bounce, the biggest exposure shrinks.
5. Housekeeping. A reopen guard stops closures that would put the same level straight back. Each closure is confirmed in deal history, failed legs are retried, and a plan is cancelled when positions changed between scan and send.
6. Optional hedge cycle. Off as shipped. When enabled it keeps a balanced pair on a symbol you choose and unwinds it in equal slices funded by a small surcharge on grid closures. It exists to generate turnover; spread, commission and swap still apply.
THE PANEL
The panel lives on the left of the chart, leaving the price scale and the right side clear. Its main card shows symbol and magic, a status badge, grid mode, lot step, current spacing, banked result, the signal gate and the MFI Zone row. Plan cards show the next closure for each side with a close button, and a table lists open orders. Buttons switch armed or scan-only mode, pause, chart marks and slicing. It can be dragged or folded, sizes itself to its text on any screen, and is skipped completely in non-visual optimisation so test passes stay fast.
ALL INPUTS
Grid - how levels are opened
- TradeMode - buy and sell ladders together (default) or a single direction.
- GridSpacePoints - level gap in points when fixed spacing is selected (25).
- GridSpaceMultiplier - each further gap is stretched by this factor; 1.0 keeps gaps equal.
- MaxGridLevels - highest number of levels one ladder can hold.
- UpDirectionIsBuy - true gives upward moves to the buy ladder; false swaps them.
- EAMagicNumber - grid order identifier, 9753920 by default; use a different one on each chart.
- GridOrderComment - label written on grid orders.
- OneOrderPerBar - at most one new level per candle.
Lot ladder
- InitialLotSize - size of the first level (0.01).
- LotSizingMode - add a fixed step per level (default) or multiply.
- LotMultiplier - growth factor for multiply mode only (1.25).
- LotAddStep - size added per level in add mode; 0 keeps all levels equal.
- MaxOrderVolume - largest allowed single order (1.0).
- UseAutoLot - scales the starting size with your balance.
- AutoLotBaseBalance - balance that matches the starting size in auto mode.
- AutoLotAllowDecrease - lets auto sizing drop under the starting size after losses.
ATR spacing
- GridSpacingMode - ATR-based distance (default) or fixed points.
- ATRTimeframe, ATRPeriod, ATRBarShift - timeframe, length (14) and candle used for ATR; 1 means the last closed candle.
- ATRSpacingFactor - multiplier that turns ATR into a level distance.
- ATRMinSpacingPts, ATRMaxSpacingPts - minimum (50) and maximum (5000) distance in points; 0 lifts that limit.
- ATRFreezeOnStart - keeps the first calculated distance for the entire cycle.
Profit target
- DesiredProfitPerClosure - base amount of money each closure should keep (2.0).
- ProfitMultiplier - final factor on that amount, from 1.00 to 2.00.
- ProfitTargetMode - fixed target or one that grows with the book (scaled, default).
- ProfitVolumePower, ProfitDepthBonus, ProfitMaxMultiple - how a scaled target responds to volume and depth, and its maximum multiple.
- ProfitMaxReachFraction - keeps the target reachable within a fraction of one step.
Fragment scanner
- UseMultiLegScan - tries groups of several orders before the plain oldest/newest pair.
- MaxOldestLegs, MaxNewestLegs - orders a group may take from the old end (3) and new end (6).
- ScanPriority - tie-break rule when several groups qualify.
- NeverBankLessThanPair - a group must also beat what the simple pair would bank.
- RequireCloseVolumeExceedsTarget, MinCloseVolumeRatio - closing orders must outweigh the old order by at least this ratio (1.5).
Target slicing - partial closes
- EnableTargetSlicing - allows closing part of the oldest order when the whole lot is out of reach.
- FragProfitWeightPower - weight of profit per closing lot (1 = proportional).
- FragMinSlicePercent - smallest slice as a percent of the target order (20).
- FragAllowMultiCloser - several newer orders may fund one slice together.
- FragPreferFullClosure - chooses a full closure when both kinds qualify.
Reopen guard
- ReopenGuard - prevents closures that would immediately reopen a level.
- ReopenGuardCushion - safety distance as a share of one step (0.90).
Account protection
- MinMarginLevelPercent - no new levels under this margin level; 0 turns it off.
- MaxAccountRiskPercent - no new levels once floating loss passes this percent of balance; 0 turns it off.
- NetMaxMarginPercent - netting accounts only: caps the merged position's margin at this percent of equity (5).
- MaxTotalOrders - hard limit of grid orders per side.
Execution and verification
- RunMode - armed trading or scan only.
- CloseSequence - which leg of a closure is sent first (oldest by default).
- MaxSlippagePoints - accepted slippage (30).
- MaxSpreadPoints - trading waits while spread is above this.
- MinSecondsBetweenClosures - pause between two closures on one side (5).
- CloseAttemptsPerLeg, VerifyTimeoutSeconds - send attempts per leg (3) and how long a pending leg is checked (90).
- DeferWhenMarketClosed, MarketClosedRetrySeconds - when the session is closed, wait and retry at this interval instead of stopping.
- AutoResumeAfterSeconds - clears a halt automatically after this many seconds (300); 0 waits for you.
- AbortIfBookChanged - drops a plan when any leg changed between scan and send.
- UseFullCommission, CommissionPerLot - count round-trip commission, with a manual per-lot value when history lacks it.
- CloseOrderComment - label on closing deals.
Hedge cycle
- EnableHedgeCycle - turns the hedge engine on; off by default.
- HedgeSymbols - comma-separated symbols for the pair; repeat a symbol to give it more turns.
- HedgeSymbolRotation - how the next cycle's symbol is chosen.
- HedgeMaxSymbolsInTester - Strategy Tester only: limits rotation to this many symbols.
- HedgeCycleLots, HedgeSliceLots - size of each side and size removed per slice.
- HedgeFragmentBonus, HedgeBonusIsPercent - extra above slice cost, as percent or flat money.
- HedgeMaxSurcharge, HedgeMaxSurchargePercent - money and percent caps on how far a closure target may be raised.
- HedgeMagicNumber - hedge leg identifier, 9753921 by default; must differ from the grid magic.
- HedgeReopenOnFinish - opens a fresh pair once one is finished.
- HedgeStartRequiresTrade - waits for grid activity before the first pair.
- HedgeIntegritySeconds, HedgeAutoRepair, HedgeNakedAction - check interval for both legs and the response when one is missing.
- HedgeMaxSpreadPoints, HedgeSlippagePoints, HedgeAttemptsPerLeg, HedgeVerifyTimeout - spread, slippage, retry and verification limits for hedge orders.
- HedgeCommissionPerLot, HedgeOrderComment - commission fallback and label for hedge deals.
Weekly cash day
- WeeklyCashDay - pauses new cycles and slices around your usual withdrawal time.
- CashDayOfWeek, CashCutoffHour - weekday (0 = Sunday) and server hour after which no slice is sent.
Panel and chart
- ShowPanel - shows or hides the panel.
- PanelX, PanelY, PanelCorner - distance from the chart edges and preferred corner.
- PanelFontSize - base font size (9).
- ShowArabic - adds an Arabic line under each English label.
- ShowChartMarks - draws levels and closure plans on the price chart.
- MaxTableRows - open orders listed per ladder (13).
Entry trigger
- EntryTriggerMode - what arms the first level; the Market Facilitation Index strategy by default.
- SignalBarShift - candle evaluated; 1 is the last closed bar, smaller values are rejected.
- SignalBarsDelay - bars needed between two accepted signals (30).
- SignalValidBars - how long a signal remains usable, in bars (3).
- SignalAllowBuy, SignalAllowSell - enable or block each direction.
- SignalReverse - swaps buy and sell.
Market Facilitation Index - the signal
- InpMFITF - timeframe for the MFI, the volume comparison and the trend average.
- MfiVolumeType - tick volume (default, available everywhere) or real exchange volume where your broker supplies it.
- MfiTrendPeriod - length of the price average that decides buy or sell (34).
- MfiTrendMethod - averaging method for that line (exponential by default).
- MfiGreenBars - Green bars required in a row to form a signal (1).
- MfiBlockAfterFake - ignores a Green run that comes straight after a Fake bar (on).
- MfiSquatBoost - accepts only Green runs that follow a Squat bar, a stricter breakout style (off).
- MfiMinVolumeRise - minimum volume increase in percent on the Green bar; 0 accepts any rise.
- InpShowMFIWindow - attaches the MFI histogram in a subwindow on live and visual charts.
- InpShowSignalArrows - puts an arrow on each candle that armed a cycle.
Debug
- DebugMode - writes detailed decision notes to the Experts journal.
COMMON QUESTIONS
No cycle for a long time - is something wrong? Check the MFI Zone row. A run of FADE or FAKE bars means participation is missing, and the EA waits on purpose. Turning off MfiBlockAfterFake or MfiSquatBoost gives more signals; raising MfiGreenBars or MfiMinVolumeRise gives fewer.
Tick volume or real volume? Forex brokers only publish tick volume, so keep the default there. On exchange-traded symbols real volume can be selected; if it is missing the EA falls back to tick volume.
Several charts at once? Yes, with a separate pair of magic numbers on each; the start-up lock warns you if two charts collide.
Extra files needed? None. No DLLs and no external indicators; hedging and netting accounts are both handled.
DAILY ROUTINE
Attach the EA, allow algorithmic trading and check that the panel shows up. Read the MFI Zone row first: a long SQUAT streak often comes before a burst, while GREEN with a big volume jump means price is travelling fast and ladders may deepen quickly. The plan cards show what each side still needs for its next closure. Pause before news you prefer to avoid, use scan only to watch without risk, and keep magic numbers unique per chart.
REALISTIC EXPECTATIONS
Waiting for volume to confirm a move improves when a cycle starts; it does not make trading risk-free. A strong trend against an open ladder can produce a deep floating loss, and there is no stop loss that closes everything for you; the EA defends itself by refusing new levels. Spread, swap, commission, the symbol and your lot size all shape results, and past test results never promise future returns. Run your own Strategy Tester checks, start with small lots and grow only when you know how far your instrument usually travels.
Once you have used Grid Market Facilitation Index EA in testing or live trading, an honest review describing your real experience, positive or critical, is very welcome. It helps other traders choose and guides the next updates.
