Guarda come scaricare robot di trading gratuitamente
Ci trovi su Facebook!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Librerie

JsonParserByLeo - libreria per MetaTrader 5

Niquel Mendoza
Niquel Mendoza
Creator of the TSN ecosystem (Trade Systems Nique) for MQL5.
Visualizzazioni:
130
Pubblicato:
\MQL5\Include\ \MQL5\Scripts\
Freelance MQL5 Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

JsonParserByLeo is a JSON library for MQL5 built around a flat "tape" architecture. The whole document is parsed in a single iterative pass (strictly O(n), no recursion, no helper calls in the hot path) into one contiguous ulong[] array. Keys and strings are stored lazily as offset + length and are unescaped only when you read them.


Main features

  • Tape-based zero-allocation parsing, with strict validation of numbers, literals, strings and grammar order.
  • Safe number handling: full 64-bit unsigned support, and values that cannot be represented exactly are kept as strings, so no digits are lost.
  • Just-in-time perfect-hash key lookup: objects that are accessed often are promoted from linear scan to O(1) lookup automatically.
  • CJsonNode: lightweight handle (copying is free) with typed readers (ToString, ToInt, ToDouble, ToBool), iterators for objects and arrays, and access by key, index or pointer.
  • Mutable DOM (CDomNodeBase): add or remove keys, change a value type in place, Python-style array slicing, and serialize back to JSON.
  • Typed struct mapping: GetAs<T>() fills your own struct from a node or DOM node, and Load<T>() dumps a struct into the DOM.
  • SAX streaming parser: feeds the parser in fixed-size chunks and fires callbacks, so the whole document never has to be in memory.
  • JSON Builder, JSON minify, and JSON Pointer (RFC 6901) lookups.
  • JSONPath-like query VM: a small register-based virtual machine that filters and traverses a DOM tree.
  • Compiled tape cache (.jsontc): saves the tape and the built hash tables, so a later reload skips parsing.

Test

test



Basic usage

  1. Include the library header.
  2. Create a CJsonParser and call Assing() with your JSON text.
  3. Call CorrectPadding() and Parse().
  4. Get the root with GetRoot() and read values, for example root["price"].ToDouble(0.0).

The attached example script shows parsing, iteration, the DOM API, struct mapping and JSON Pointer in action.


Notes

  • The library is a single header file generated from the full modular project.
  • No DLL is required: this version is pure MQL5.
  • The full modular source, documentation, unit tests and benchmarks are available in the author's repository on MQL5 Algo Forge: https://forge.mql5.io/nique_372/JsonParserByLeo

License

Niquel & Leo NL-NC (bundled component TsnTables: MIT). Full notices and the list of bundled components are in the header of the source file.

Asia Session Range and Liquidity Sweep Zones (BSL/SSL) with Live HUD Asia Session Range and Liquidity Sweep Zones (BSL/SSL) with Live HUD

Plots daily Asia Session High/Low range boxes, extends session liquidity levels through London and New York sessions, and marks non-repainting closed-bar liquidity sweeps (BSL/SSL) with a live HUD.

Prop Firm Risk Headroom Monitor Prop Firm Risk Headroom Monitor

Account-wide MT5 prop firm risk monitor that tracks daily and maximum loss headroom, current stop-loss exposure, projected equity and remaining risk capacity.

Smart Money Concepts MT5 Smart Money Concepts MT5

Smart Money Concepts MT5 — BOS / CHoCH structure, Order Blocks, Equal Highs/Lows, Fair Value Gaps and Premium/Discount zones. MT5 adaptation of the MAJID Smart Money Concepts indicator, free for non-commercial use under CC BY-NC-SA 4.0.

OnTester Robustness Score with Simulated Commission and Trade CSV Export OnTester Robustness Score with Simulated Commission and Trade CSV Export

A custom OnTester() criterion that ranks optimisation passes by net profit factor, number of trades, drawdown and equity-curve linearity. Includes simulated commission, trade export to CSV and a readable HTML report.