@echo off setlocal enabledelayedexpansion echo ======================================== echo Market Data Proxy Starter echo ======================================== echo. REM Check if running as administrator (needed for hosts file modification) net session >nul 2>&1 if %errorLevel% == 0 ( echo [✓] Running as administrator ) else ( echo [✗] This script requires administrator privileges echo Right-click and "Run as administrator" echo. pause exit /b 1 ) echo. echo [1/4] Adding marketData to hosts file... set "hosts_file=%windir%\System32\drivers\etc\hosts" set "entry=127.0.0.1 marketData" REM Check if entry already exists findstr /C:"marketData" "%hosts_file%" >nul 2>&1 if !errorLevel! == 0 ( echo [✓] marketData already exists in hosts file ) else ( echo. >> "%hosts_file%" echo !entry! >> "%hosts_file%" echo [✓] Added marketData to hosts file ) echo. echo [2/4] Starting Node.js API server... echo Starting API on port 3001... REM Get current directory and store it set "PROJECT_DIR=%cd%" start "MarketDataAPI" cmd /k "cd /d "%PROJECT_DIR%" && npm start" REM Wait a moment for API to start timeout /t 5 /nobreak >nul echo. echo [3/4] Starting Nginx proxy server... REM Get current directory for nginx path set "NGINX_PATH=%cd%\nginx-1.24.0\nginx.exe" start "NginxProxy" "%NGINX_PATH%" REM Wait for Nginx to start timeout /t 3 /nobreak >nul echo. echo [4/4] Testing proxy connection... echo Testing basic connectivity... curl -s http://marketData >nul 2>&1 if !errorLevel! == 0 ( echo [✓] Proxy server is responding ) else ( echo [✗] Proxy server not responding goto :error ) echo. echo Testing API through proxy... curl -s http://marketData/api/health >nul 2>&1 if !errorLevel! == 0 ( echo [✓] API proxy is working correctly ) else ( echo [✗] API proxy not working goto :error ) echo. echo ======================================== echo SUCCESS! Proxy is ready! echo ======================================== echo. echo Your proxy is now running: echo - API Server: http://localhost:3001 echo - Proxy URL: http://marketData echo - MT5 URL: http://marketData/api/endpoint echo. echo You can now use http://marketData/api/ in your MT5 EA echo. echo Press any key to close this window... pause >nul goto :eof :error echo. echo ======================================== echo ERROR! Something went wrong echo ======================================== echo. echo Please check: echo 1. Is Node.js installed? echo 2. Run 'npm install' if dependencies are missing echo 3. Check if port 3001 is available echo 4. Check Nginx error logs in nginx-1.24.0/logs/ echo. echo Press any key to close this window... pause >nul exit /b 1