ILoveTrading Documentation

MetaTrader 4 & MetaTrader 5 Synchronization

The MetaTrader 4 (MT4) and MetaTrader 5 (MT5) synchronization module directly bridges your desktop trading terminal to the ILoveTrading journal and behavioral intelligence engine. Engineered natively in MQL4 and MQL5, the Expert Advisor (EA) delivers automated execution capture, sub-millisecond telemetry ingestion, and native on-chart historical trade mapping.


1. System Architecture & Trade Telemetry

The EA operates non-blockingly within MetaTrader’s event-driven architecture, ensuring zero impact on order routing, execution speed, or tick processing latency.

Captured Execution Attributes

When an order is opened, modified, or closed, the EA captures and securely transmits:

  • Order Ticket & Magic Number: Unique broker ticket ID and EA identifier.
  • Symbol & Asset Class: Raw broker instrument (e.g., EURUSD.pro, US30.cash, XAUUSD).
  • Order Type & Sizing: Direction (Long/Short), lot volume, and fractional fills.
  • Price Milestones: Exact entry price, exit price, and planned TP/SL levels.
  • Cost Structure: Broker commission, spread cost, and overnight swap fees.
  • Timestamps: Microsecond-precision open and close server timestamps.

Automatic Account Discovery & Normalization

Upon initial transmission, ILoveTrading automatically identifies the terminal's account number, account currency, broker server name, and leverage. It assigns incoming executions to the matching account profile without requiring manual account registration.

Normalized Risk Units (R-Multiple Computation)

When an order includes a valid initial Stop Loss, the engine computes normalized R-multiples:

Formula / Calculation

R-Multiple = (Exit Price - Entry Price) / (Entry Price - Initial Stop Loss)

This normalizes dollar performance into risk units (1R), allowing statistical comparability across variable lot sizes and account balances.


2. On-Chart Historical Drawing Engine

The EA includes a built-in visual drawing module that projects recent trade executions directly onto your MetaTrader charts for post-session trade analysis.

Visual Components Rendered

  1. Execution Markers: Color-coded arrows marking exact entry and exit price bars.
  2. Planned Boundary Projections: Horizontal boundary lines showing initial Stop Loss and Take Profit levels at the moment of entry.
  3. Trade Path Vector: Vector lines connecting entry to exit, illustrating holding duration and market excursion during the trade.
       [Entry Arrow ▲] ─────────────────────┐ (Trade Path Vector)
                                             │
                                             ▼
                                      [Exit Marker ●]
       ═══════════════════════════════════════════════ (Planned SL Level)

Anti-Clutter & Chart Performance Optimization

  • Smart Stacking: Vertically stacks multiple execution markers when scalping or scaling into positions on the same candle.
  • Wick Clearance: Offsets text annotations above candle highs and below candle lows to keep price action and order blocks unobstructed.
  • 14-Day Rolling Window: Automatically cleans up historical chart objects older than 14 trading days to prevent terminal memory leaks and preserve charting FPS.

3. Step-by-Step Installation Guide

Step 1: Download the Expert Advisor

Navigate to the Integrations menu in your ILoveTrading dashboard and download the compiled EA:

  • MetaTrader 4: ILoveTrading_AutoTrade_MT4.ex4
  • MetaTrader 5: ILoveTrading_AutoTrade_MT5.ex5

Step 2: Whitelist WebRequest URL

MetaTrader requires explicit authorization for outgoing HTTPS requests:

  1. In MetaTrader, open Tools > Options (or press Ctrl + O).
  2. Navigate to the Expert Advisors tab.
  3. Check "Allow WebRequest for listed URL".
  4. Add: https://ilove.trading
  5. Check "Allow DLL imports" (required for SSL handshake verification).
  6. Click OK.

Warning

[!WARNING] If https://ilove.trading is not listed in your WebRequest settings, MetaTrader will reject transmissions with Error 4060 (ERR_FUNCTION_NOT_ALLOWED).

Step 3: Attach the EA to a Chart

  1. In MetaTrader, open the data folder: File > Open Data Folder.
  2. Move the .ex4 or .ex5 file into MQL4/Experts or MQL5/Experts.
  3. In the Navigator panel (Ctrl + N), right-click Expert Advisors and select Refresh.
  4. Drag ILoveTrading_Sync onto any single chart (e.g., EURUSD Daily).
    • Note: One chart instance captures all trades across all currency pairs and asset classes for that account.
  5. In the Inputs window, enter your Universal Token (generated under Integrations or Settings > Accounts).
  6. Ensure Algo Trading / AutoTrading is enabled in the MetaTrader top toolbar.

4. Diagnostics & Status Codes

Error CodeMeaningResolution
4060ERR_FUNCTION_NOT_ALLOWEDWhitelist https://ilove.trading in Tools > Options > Expert Advisors.
4014ERR_INVALID_TOKENVerify and re-copy your Universal Token from the Integrations menu.
4001ERR_NO_INTERNETCheck terminal network connection or VPS firewall settings.

Tip

[!TIP] Continuous Synchronization: Run your MetaTrader terminal on a Virtual Private Server (VPS) to guarantee 24/7 trade capture even when your primary workstation is offline.

Important

[!IMPORTANT] Historical Sync: On first launch, the EA synchronizes your last 90 days of closed trade history to populate your performance baseline immediately. **: For continuous journaling of swing positions and automated strategies, run your MetaTrader terminal on a low-latency Virtual Private Server (VPS).

ILoveTrading Institutional Analytics

Trading on MetaTrader?

Sync your MT4 or MT5 account and automatically audit your cognitive biases and trading performance.

Get Started 100% Free
SPONSORGoogle AdSense
Google AdSense Banner