Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

JSON Library for LLMs - library for MetaTrader 5

author EAcpu | 6 reads | 0 comments |

JSON Library for LLMs - library for MetaTrader 5

JSON Library for LLMs - library for MetaTrader 5

JSON Library for LLMs - library for MetaTrader 5

JSON Library for LLMs - library for MetaTrader 5

High performance JSON (v3.5.0)

JSON library designed for LLM, autonomous trading and ultra-low latency.

When integrating AI models (GPT-4o, Claude 3.5, DeepSeek) into MetaTrader 5, the community's standard library failed on two key points: memory allocation and serialization latency . Excessive use of recursion and temporary strings made the processing of AI responses (function calls) a bottleneck, causing the terminal to freeze. The "pain" of losing ticks when the garbage collector clears strings is the motivation for this architecture.

Rewritten from scratch with a focus on performance:

Tests on standard hardware (x64) with complex load of 50,000 nodes:

> The results can be verified via the TestJsonBenchmark.mq5 script included in the package.

JSON Library for LLMs - library for MetaTrader 5

JSON Library for LLMs - library for MetaTrader 5

 #include

voidOnStart() {
    String payload = GetOpenAIResponse(); // JSON quality CJson json;
    if(json.Parse(payload)) {
        // Access direct performance keys (zero copy)
        String content = json["selection"][0]["message"]["content"].ToString();

        // Example: Additional uses for tokens if(json.HasKey("usage")) {
            Long token = json["usage"]["total_tokens"].ToInt();
            Print("Consumption:", token);
        }
    } else {
        //Debug precision integer l, c;
        json.GetErrorPos(l, c);
        PrintFormat("Erro JSON na Linha %d, Coluna %d", l, c);
    }
}

Example: Build Request (Optimizing Builder)

 CJsonBuilder b;
b.Obj()
    .Key("model").Val("gpt-4-turbo")
    .Key("Message").Arr()
        .Obj()
            .Key("role").Val("user")
            .Key("content").Val("Analysis of the H1 trend of EURUSD")
        .EndObj()
    .EndArr()
    .Key("Temperature").Val(0.7)
.EndObj();

String body = b.Serialization(); // Super fast serialization

Developed by Jonathan Pereira as a core infrastructure artificial intelligence toolkit framework.

Only two time frames (H1 and D1) work in sync to filter out noise and capture only strong RSI reversals in overbought and oversold areas. No random entries, only a clear confirmation of the direction from the "big brother."

ExMachina Supply and Demand Areas is a professional indicator that automatically detects supply and demand areas on any chart using pulse-based detection and ATR filtering. Version 2.0 introduces multi-candle pulse detection, omni-directional measurement, zone merging, touch tracking, proximity alerts, and ExMachina dark theme to transform your charts into a professional trading workspace.

The acceleration/deceleration indicator (AC) measures acceleration and deceleration of the current drive force.

Indicator edition for new platform.


Attachment download

📎 TestJsonBenchmark.mq5 (9.35 KB)

📎 TestBinanceBenchmark.mq5 (6.98 KB)

📎 JAson.mqh (30.59 KB)

📎 fast_json.mqh (39.86 KB)

Source: MQL5 #68596

Verification code Refresh