Memory alignment issue with C++20 DLL bridge into MT5 MQL5 EA (Lock-free SPSC context)

 

Hi everyone,

I am currently optimizing a ultra-low latency ingestion layout between an external bare-metal C++20 HFT execution core and an MT5 EA via a custom native DLL bridge using lock-free Single Producer Single Consumer (SPSC) ring buffers.

During volatile gold tick regimes (XAUUSD ), the core engine handles the internal wire baseline comfortably at 150ns - 247ns using flat contiguous cache arrays. It enforces an in-memory Anti-Trap Interceptor to process Level 3 data structures within absolute O(1) time complexity.

However, when scaling the packet synchronization loops within a 1ms timer gate down to an exact 20-pips execution boundary , I am noticing occasional serialization drag at the terminal interface. The target metrics are structured as follows:
  • Memory structures: Aligned to 64-byte L1 CPU cache boundaries via alignas(64) .
  • Data ingestion: Zero-allocation arrays parsing Order Flow Imbalance (OFI) metrics.

Has anyone successfully eliminated standard Windows OS thread-switching latency inside an MQL5 DLL import layer when passing active pointers from contiguous C++ memory slots?

(Note: If any senior algorithmic engineer or institutional developer wants to cross-verify the raw .html interface simulator or review the complete cache block architecture to locate the pipeline drag, let me know. I can share the repository manual setup via private message).
 

Sorry but.. Question is not making sense ..

what is internal wire baseline comfortably at 150ns - 247ns?

what is Anti-Trap Interceptor / absolute O(1) Level 3 structures?


Thread switching can usually take 1 to 3 or 5 ms in micro processors, NS no way..