Quick summary#
Core strategy: Active grid trading (not pure DCA/martingale). The bot places a series of Limit and Stop orders across a price zone you choose, refills them every 5 seconds as orders hit take profit, and accumulates profit from price swings. If price moves too far the wrong way, the bot switches to DCA recovery mode with a trailing TP based on the average price of the whole basket. A Trend AI module (a heuristic across 4 timeframes: M30/H1/H4/D1) suggests the grid direction but never switches mode on its own.
Recommended pairs & timeframes: XAUUSD / XAUUSDm / XAUUSDc (gold), M5 or M15. Technically it runs on any timeframe, but the bot has only been tested on gold.
Best for: Traders who already understand grid trading and DCA, with at least $500 in capital (ideally $5,000+), who are ready to watch the price zone and adjust the ceiling/floor when the market breaks out of the range. Not suitable for a fully "set and forget" approach or for very small accounts.
Risk management:
- 3 layers of account protection: Daily target +5% (locks in profit) → Daily loss −5% (daily stop) → Equity stop −8% (long-term capital protection per session)
- Maximum DCA cap (InpMaxDCACount) + automatic lot scale-down when margin runs out
- Spread filter — skips new orders when spread > 60 points (avoids bad fills during news)
- ATR dynamic spacing — spacing and TP expand and contract with volatility instead of staying fixed
- All 3 protection layers are OFF by default — you must turn them on yourself (InpUseMaxDrawdown, InpUseEquityStop, InpUseDailyTarget) before running on a live account
Risk warning from FN Trading Lab: Grid + DCA is still a strategy that adds positions when the market moves against you. If price breaks out strongly from the selected zone and the DCA chain runs long, the account can suffer a deep drawdown or be wiped out, especially with the "Aggressive" setup. The bot ships with all equity/drawdown/daily-target protections switched off — you must enable them and choose a sensible price zone yourself. Past performance (backtest/demo) does not guarantee future results. Only trade with money you can afford to lose entirely. This is not investment advice.
1. First-time setup (one time only)#
When does the bot require verification?
- Demo account: never — test freely with any broker
- Live account, first 14 days: trial period — runs without registration
- Live account, after 14 days: requires verification with the FNTradingLab API
1.1 Register a trading account through the FNTradingLab link
- Go to fntradinglab.com → choose a broker (TMGM / XM / Vantage / Exness)
- Click the FNTradingLab affiliate link → open a trading account (MT4/MT5) with that broker
- Deposit funds and get your MT4/MT5 login from the broker
- Log in to MetaTrader 5 with that account
Each MT4/MT5 login has its own trial, stored in a per-terminal GlobalVariable.
1.2 Whitelist the FNTradingLab API URL in MT5
- MT5 → Tools → Options (Ctrl+O)
- Expert Advisors tab
- Tick "Allow WebRequest for listed URL"
- Click Add and enter exactly:
https://api.fntradinglab.com - Click OK to save
- Detach the EA and attach it again
Note: The URL must be exact — no trailing "/", no "www", and it must include "https://". If a single character is wrong, MT5 will not match it and the bot reports INIT_FAILED.
1.3 Install the .ex5 file
- MT5 → File → Open Data Folder
- Go to MQL5\Experts\ → create a folder named FNTradingLab
- Copy the .ex5 file into it
- MT5 → View → Navigator (Ctrl+N) → right-click Expert Advisors → Refresh
1.4 Turn on Auto TradingMake sure the AutoTrading button on the toolbar is green. If it is red, click it once to turn it on.
2. Start the bot#
2.1 Attach it to a chart
- Open an XAUUSDm M5 chart (or the pair/timeframe you want)
- Navigator → Expert Advisors → FNTradingLab → drag it onto the chart
- Inputs tab → adjust if needed (see section 4)
- Click OK
2.2 Successful verification — check the log in Toolbox → Experts (log lines appear exactly as the bot prints them):
Verified live account:GRID v1 | FNTradingLab x AI khởi động. Magic:100100 Mode:TREND_BUY[Setup] Lot=0.10 | Risk=40.0% | ...[Verify] OK login=12345678 exchange=xm rebate=$150.50Demo account (verification skipped automatically):[Verify] Bỏ qua — account demo (login=12345678)Live account, first run (trial starts):[Trial] Bắt đầu trial period 14 ngày cho login 12345678[Trial] Đang trial: ngày 1/14 (còn 13 ngày). Bỏ qua verify.If you see "KHÔNG đăng ký" (not registered) after the trial ends → go back to section 1.1.
2.3 On-chart dashboard — the top-left corner of the chart shows: status, grid mode, grid zone, number of levels, buy/sell lots for the day, daily P/L, floating loss, DD limit, number of DCA orders, AI suggestion, and quick-control buttons.
3. Basic usage#
3.1 Step 1 — Select the grid zone
- Two clicks: press CHỌN VÙNG (Select zone) → click the high price point → click the low price point
- Shortcuts: Shift+H sets the ceiling (TRẦN), Shift+L sets the floor (SÀN)
- Drag the lines: drag the 2 horizontal lines (ceiling line on top, red floor line below) to adjust
Note: The chart must have focus before you press a shortcut. Do not use Ctrl+H/Ctrl+L (MT5 intercepts them). The ceiling must be above the floor, and the current price must be inside the zone. A zone 10–30 USD wide works well on gold.
3.2 Step 2 — Deploy: click TRIỂN KHAI (Deploy) or press Ctrl+. — the bot calculates ATR and spacing/TP, opens 1 market entry order and places a series of limit + stop orders across the zone.
3.3 Step 3 — Let the bot run and monitor it: it takes profit on each order, refills every 5 seconds, enters DCA when needed and halts when the target or loss limit is hit.
3.4 Pause / full stop:
Action | Shortcut | Effect |
|---|---|---|
Pause | Ctrl+. | Deletes pending orders, keeps open positions |
Resume | Ctrl+. | Re-places the pending grid |
Close all | Shift+X | Closes positions + deletes pending orders, state returns to 0 |
Auto-recover | Ctrl+. | If HALTED, resets and deploys again |
4. Detailed settings#
4.1 Grid settings
- InpGridMode (TREND_SELL): grid direction, TREND_BUY/TREND_SELL
- InpUpperPrice / InpLowerPrice (0.0): ceiling/floor — best set with Shift+H/L
- InpAmplitudePips (200.0): zone width in auto mode
- InpGridSpacingPips (25.0): distance between levels (when ATR is off)
- InpTPPips (25.0): TP for grid limit + stop orders
4.2 Lot settings
- InpLotType (LOT_FIXED): FIXED or PROGRESSIVE (+20% per level)
- InpLotSize (0.06): fixed lot; 0 = calculated from equity
- InpMaxRiskPercent (40.0): % of equity for the worst case (only applies when LotSize = 0)
- InpRefillCount (10): number of limit orders re-placed per 5-second cycle
4.3 Risk management
- InpStopOnOutOfRange (false): true = halt when price leaves the zone; false = switch to DCA (recommended)
- InpUseMaxDrawdown (false): enable the daily loss limit
- InpMaxDrawdownPct (5.0): maximum daily loss threshold
- InpMaxOpenOrders (0): maximum total orders
- InpMaxPositionsPerSide (1000): maximum positions per side
4.4 DCA & trailing TP
- InpDCAMultiplier (1.5): 1.5 safe · 2.0 aggressive · >2.0 dangerous
- InpMaxDCACount (0): ⚠ 0 = unlimited — recommended 5–7
- InpDCASpacingPct (0.1): DCA spacing as % of price
- InpDCATriggerLossPct (30.0): floating-loss threshold that triggers DCA
- InpBasketTargetPips (28.0): minimum basket profit before trailing starts
- InpTrailingDistancePips (18.0): trailing TP distance
4.5 ATR dynamic spacing
- InpUseATRSpacing (true), InpATRTimeframe (M15), InpSpacingATRMult (0.3), InpTPATRMult (0.7), InpATRMinPips/MaxPips (20/200)
4.6 Equity protection
- InpUseEquityStop (false) ⚠ OFF by default — recommended ON for live accounts
- InpEquityStopPct (8.0): halt when equity falls 8%
- InpUseDailyTarget (false), InpDailyTargetPct (5.0)
- InpUseSpreadFilter (false), InpMaxSpreadPoints (60.0)
4.7 Trend AI: InpUseTrendAI (true), InpTrendBarsCount (30), InpTrendPctThreshold (0.20)
4.8 Account verification: The logic lives in the FNVerify.mqh module and has no inputs to change or bypass it. Responses are signed with RSA-2048 + SHA-256 and verified with a public key hard-coded in the .ex5, which prevents forgery and MITM attacks. Default trial: 30 days on demo, 14 days on live, keyed by (exchange, login, mode) on the backend.
4.9 Rebate: InpShowRebate (true), InpRebatePerLot (9.9 USD, for reference)
4.10 General: InpMagicNumber (100100), InpMaxSlippage (10), dashboard colors/position
5. How it works#
5.1 Grid trading: TREND_BUY places BuyLimit orders below price and BuyStop orders above price; TREND_SELL is the mirror image. Each order has its own fixed TP.
5.2 Refill: Every 5 seconds the bot scans the grid and re-places limit orders on empty levels, up to InpRefillCount per cycle. It stops refilling when floating loss ≥ the trigger threshold.
5.3 DCA: Triggers when floating loss ≥ the threshold, or when price leaves the zone on the wrong side with losing positions open. In DCA mode the bot deletes pending Stop orders and the remaining TP Limit orders, opens a market order with lot = deepest lot × multiplier, and adds another DCA order each time price moves one more spacing step away, capped at InpMaxDCACount.
Lot sequence with a 1.5 multiplier: DCA1 = 1.5x, DCA2 = 2.25x, DCA3 = 3.4x, DCA4 = 5.1x, DCA5 = 7.6x (19.8x cumulative). If an order fails with "not enough money", the bot halves the lot and retries.
5.4 Recovery: The bot calculates the weighted average price and sets the basket TP at avg ± 200 pips. When price passes the target, trailing follows the extreme. Once all positions hit TP → Halt, waiting for the user to reset.
5.5 Trend AI: Analyzes 30 candles on M30/H1/H4/D1 and scores each timeframe from −2 to +2, for a total of −8 to +8 (≥ +5 Strong Buy … ≤ −5 Strong Sell). It is a suggestion only and never changes mode on its own.
6. Account protection — 3 layers#
- Daily target: daily equity ≥ +5% → Halt + close all, profit locked
- Daily loss: daily equity ≤ −5% → Halt + close all, loss cut in time
- Equity stop: equity down ≥ 8% since the EA was attached → Halt + close all
Extra layers: DCA cap + automatic lot scale-down; spread filter (> 60 points → order skipped).
7. Setup by profile#
Conservative (1–2%/day): LotSize=0.05, MaxRiskPercent=25, RefillCount=3, DCAMultiplier=1.4, MaxDCACount=4, DCASpacingPct=0.50, BasketTargetPips=300, EquityStopPct=5, DailyTargetPct=2.0, MaxDrawdownPct=3.0. Target 20–40%/month, ideal for accounts under $5k.
Default (3–5%/day): use the default values in section 4. Suitable for $5k–$20k accounts.
Aggressive (5–8%/day): LotSize=0.20, MaxRiskPercent=50, RefillCount=7, DCAMultiplier=2.0, MaxDCACount=7, DCASpacingPct=0.20, BasketTargetPips=150, EquityStopPct=12, DailyTargetPct=8.0, MaxDrawdownPct=8.0. Target 60–100%/month, high blow-up risk — only use it if you accept losing 1–2 accounts per year.
Small account (< $1k): LotSize=0, MaxRiskPercent=20, RefillCount=2, DCAMultiplier=1.3, MaxDCACount=3, DailyTargetPct=3.0.
8. Shortcuts & buttons#
Action | Shortcut |
|---|---|
Pick ceiling | Shift+H |
Pick floor | Shift+L |
Deploy / Auto-recover | Ctrl+. |
Close all | Shift+X |
Do not use Ctrl+H/L/X (MT5 reserves them for system menus). The chart must have focus for shortcuts to work.
9. Bot states#
State | Name | Description |
|---|---|---|
0 | IDLE/TẮT | Waiting for TRIỂN KHAI (Deploy) |
1 | ACTIVE/BẬT | Running the grid, can switch to DCA |
3 | DCA MODE | Recovering, does not return to state 1 |
4 | HALTED | Everything closed, waiting for reset |
10. Logs & monitoring#
- Experts tab: logs [Setup], [Verify], [Deploy], [Trigger DCA], [DCA scale-down], [Equity stop], [Daily target], [Spread block], [Shortcut]
- Trade tab: order comments FNGRID_* (FNGRID_MARKET, FNGRID_L5, FNGRID_DCA0, FNGRID_REFILL_L8)
- Journal tab: MT5 system errors
11. Troubleshooting#
- Verify fail: the trial has ended and the account is not registered for rebate → register again at fntradinglab.com
- "WebRequest chưa được cho phép" (WebRequest not allowed): redo section 1.2 with the exact URL https://api.fntradinglab.com
- "Không xác định được exchange" (broker not detected): set InpExchangeSlug manually
- BuyLimit "invalid price": lower RefillCount, raise ATRMinPips or GridSpacingPips
- DCA fail "not enough money": the bot scales down automatically; if it still fails, lower LotSize/MaxDCACount/DCAMultiplier or deposit more
- State 4 won't deploy: press Ctrl+. to reset and deploy
- Shortcuts don't work: click the chart to give it focus, check the [Shortcut] log, detach/attach again if needed
- Range doesn't cover the price: pick the zone again with Shift+H/L
- The bot deletes the zone GlobalVariables by itself: the old zone is stale, pick a new one
12. FAQ#
- Multiple pairs? One EA per chart, each with a different magic number. Currently tested on XAU only.
- Multiple timeframes on the same pair? Yes, with different magic numbers; the bot syncs the zone across charts.
- Should I backtest? Yes — 6–12 months of XAU data, optimizing DCAMultiplier/SpacingATRMult/EquityStopPct.
- Is 5%/day realistic? Possible on high-volatility days, but a sustainable average is 1–3%/day. A reasonable target: 15–30%/month.
- Is it real AI/ML? It is a simple heuristic, not a neural network.
- Blocked by the broker? Some brokers do not allow grid/martingale — check their terms or use an FNTradingLab partner broker.
- Bot updates? The vendor ships a new .ex5 file — replace the file and restart the EA.
- Telegram alerts? Not available in the current version.
13. Production workflow#
- Week 1: Demo + Strategy Tester, optimize the 3 main inputs, forward-test on demo for 5–7 days
- Weeks 2–3: Live with small lots (0.01–0.05), track metrics; pass criterion: forward results ≥ 70% of backtest
- Week 4+: Scale lots to 0.10–0.20, withdraw 50% of profit each month, re-tune every quarter
Red flags → turn the bot off and review: 3 consecutive days with DD > 5% · average DCA depth > 4 · forward results deviate from backtest by > 30% · spread filter blocks > 30% of orders
14. Contact & support#
Website: fntradinglab.com · Bot vendor: FN Trading Lab · Current version: v1.00
Disclaimer: Trading involves risk. The "Aggressive" setup can blow the account. Only use money you can afford to lose. This is not investment advice.
