MQL5-Google-Onedrive/DEPLOY/deployment_package/ZoloBridge.mqh
google-labs-jules[bot] 96c04c22d2 Fix Invalid Volume (10014) in EXNESS_GenX_Trader and prepare VPS deployment package
- Created `mt5/MQL5/Include/MoneyFixed.mqh` to normalize calculated volumes against symbol limits (Min/Max/Step).
- Updated `mt5/MQL5/Experts/EXNESS_GenX_Trader.mq5` to use `CMoneyFixed` instead of `CMoneySizeOptimized`.
- Fixed syntax error in `mt5/MQL5/Include/ManagePositions.mqh` (missing `||` operator).
- Updated `DEPLOY/deployment_package/` with all necessary files (`EXNESS_GenX_Trader.mq5`, `MoneyFixed.mqh`, `ManagePositions.mqh`, `ZoloBridge.mqh`).
- Created `.vscode/extensions.json` for workspace recommendations.
2026-01-22 07:16:56 +00:00

54 lines
1.9 KiB
MQL5

//+------------------------------------------------------------------+
//| ZoloBridge.mqh |
//| Copyright 2024, GenX Solutions |
//+------------------------------------------------------------------+
#property copyright "Copyright 2024, GenX Solutions"
#property strict
#ifndef ZOLO_BRIDGE_MQH
#define ZOLO_BRIDGE_MQH
//+------------------------------------------------------------------+
//| Helper: Sanitize JSON String |
//+------------------------------------------------------------------+
string Zolo_SanitizeJSON(string text)
{
string res = text;
// Replace backslash first to avoid double escaping
StringReplace(res, "\\", "\\\\");
StringReplace(res, "\"", "\\\"");
StringReplace(res, "\n", " ");
StringReplace(res, "\r", " ");
StringReplace(res, "\t", " ");
return res;
}
//+------------------------------------------------------------------+
//| ZOLO Bridge Function |
//+------------------------------------------------------------------+
void SendSignalToBridge(string msg, bool enable, string url)
{
if (!enable || url == "") return;
string sanitized_msg = Zolo_SanitizeJSON(msg);
string body = "{\"event\":\"signal\",\"message\":\"" + sanitized_msg + "\"}";
char data[];
int len = StringToCharArray(body, data, 0, WHOLE_ARRAY, CP_UTF8);
if (len > 0) ArrayResize(data, len - 1); // Remove null terminator
char result[];
string result_headers;
string headers = "Content-Type: application/json";
int res = WebRequest("POST", url, headers, 5000, data, result, result_headers);
if (res != 200)
{
// Only print on failure to reduce log noise
PrintFormat("ZOLO WebRequest failed. Code: %d. URL: %s", res, url);
if(res == -1) Print("Error: ", GetLastError());
}
}
#endif // ZOLO_BRIDGE_MQH