Market Data Service is a high-performance financial data API that provides comprehensive Symbol prices of different markets through both RESTful endpoints and real-time WebSocket connections.

MT5_OPERATION.md 1.9KB

MT5 Expert Advisor Operation Guide

Configuration Settings

// RETRY SETTINGS
input int    MaxRetries = 3;       // Number of send attempts
input int    InitialDelayMs = 1000; // First retry delay (milliseconds)

// API SETTINGS
input string ApiBaseUrl = "http://market-price.insightbull.io";
input string ApiKey = "";

Windows Setup with Nginx Proxy ✅ RECOMMENDED

Your Current Working Setup

  1. Start Node.js server:

    node src/server.js
    
  2. Start Nginx proxy (run as administrator):

    powershell -ExecutionPolicy Bypass -Command "cd nginx-1.24.0; .\nginx.exe"
    # OR: Right-click nginx.exe → "Run as administrator"
    
  3. Configure MT5 EA:

    • ApiBaseUrl: Use http://market-price.insightbull.io (nginx proxy)
    • This provides better performance and reliability
  4. Stop services: ```bash

    Stop Nginx

    taskkill /f /im nginx.exe

# Stop Node.js (Ctrl+C in terminal or) taskkill /f /im node.exe


### Alternative Using Batch Files
```bash
# Start everything (run as administrator)
start_proxy.bat

# Stop everything
stop_proxy.bat

Direct Connection (without Nginx)

If not using Nginx proxy:

  • ApiBaseUrl: Use http://localhost:3001
  • ApiBaseUrl: Use http://127.0.0.1:3001

Failure Recovery Behavior

  1. Retry Sequence

    • Attempt 1: Immediate send
    • Attempt 2: 1 second delay
    • Attempt 3: 2 second delay
    • Attempt 4: 4 second delay
  2. Permanent Failures
    After exhausting retries:

    Print("Permanent failure: ", result, " - ", error);
    // TODO: Implement dead letter queue storage
    
  3. Critical Errors

    • Network failures: Retried
    • 4xx Client errors: Not retried
    • 5xx Server errors: Retried

Data Precision

All numeric values use MT5's double type (15-digit precision) mapped to: ```javascript // API expects DECIMAL(18,15) Joi.number().precision(15)