Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

Metatrader 4 Expert Advisor | Semi-HFT Grid Bot Two-sided seed-bump-martingale grid with basket take profi…

Fresh MQL5 code release – perfect for enhancing your MT4/MT5 strategies.

Image for Semi-HFT Grid Bot  Two-sided seed-bump-martingale grid with basket take profit

⚠ Read before anything else

Inputs

Symbol profile

Input Default Meaning
SymbolProfile PROFILE_AUTO Auto-detect XAUUSD vs NAS100/US100 from the symbol name, or force one

XAUUSD / metals

Input Default Meaning
Metals_SeedLotNear 0.02 Lot for level 1 each side
Metals_SeedLotFar 0.01 Lot for levels 2–3 each side
Metals_RecoveryBumpLot 0.05 Lot used from Phase 2 onward
Metals_GridStepPoints 50 Spacing between levels, in points
Metals_MaxSpreadPoints 40 Don't arm a new seed grid if spread exceeds this

NAS100 / US100

Smooth out market noise with the Heiken Ashi Expert Advisor for MT4 and MT5. Reliable trend-following automation. Details here.

Input Default Meaning
Index_SeedLotNear / Index_SeedLotFar / Index_RecoveryBumpLot 0.20 / 0.10 / 0.50 Same roles as above, index-sized
Index_GridStepPoints 50 Re-check against your broker's index point size
Index_MaxSpreadPoints 150 Indices typically quote wider spreads in points

Shared

Input Default Meaning
MagicNumber 990011 Order identification
MartingaleMultiplier 2.0 Doubling factor once Phase 3 activates
BasketTP_USD 2.00 Close everything at this combined floating profit
BasketSL_USD 0 Emergency close at this floating loss; 0 = disabled
Slippage 5 Points
LogOrderErrors true Print GetLastError() detail on any failed order

Setup notes:

Check Metals_GridStepPoints / Index_GridStepPoints against your broker's actual point size and MODE_STOPLEVEL for the symbol before running — the EA will auto-widen an undersized step, but it's worth understanding what spacing you'll actually get rather than relying on the auto-correction.

BasketTP_USD and BasketSL_USD are in account currency, not pips or percent — a small BasketTP_USD combined with larger lot sizes from the martingale phase means the basket can close very quickly once it's in that phase.

If the EA restarts (terminal restart, VPS reboot) while a grid is already active, OnInit() detects existing orders under its magic number and recovers the grid's base price from the B1/S1 level rather than starting a fresh, potentially overlapping grid.

Notes and limitations:

This is a specific, documented grid mechanic reverse-engineered from observed behaviour, not a tuned or optimised trading system, and it carries the structural risks inherent to any martingale approach: a strong sustained trend against one side will keep escalating that side's exposure through Phase 3. There is no cap on how far the grid can extend beyond level 5, and BasketSL_USD is the only hard backstop, disabled by default. Back-test across varied market conditions (trending and ranging) and forward-test on demo before drawing any conclusions about its viability, and size the seed/bump/martingale lots conservatively relative to account equity.


Credits / originality statement

This EA is an original implementation, reverse-engineered by the author from a screen recording and annotated screenshots of a "Semi HFT Algo Trading bot," then extended with multi-symbol support, self-healing reconciliation, and error logging not present in the original observation. It has no external indicator or DLL dependencies.


Build better strategies with RobotFX professional tools – check them out.

77546

Best MetaTrader Indicators + Profitable Expert Advisors