Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Facebook !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Bibliothèque

JSON - bibliothèque pour MetaTrader 5

Vues:
1404
Note:
(5)
Publié:
2025.03.11 14:59
index.mq5 (2.16 KB) afficher
index.mqh (19.47 KB) afficher
MQL5 Freelance Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance
This is my implementation of the possibility of serialization and deserialization of json in the mql5 language
You can also use the npm package manager to download
npm i mql5-json
example:
#include "node_modules/mql5-json/index.mqh"

void OnStart() {
    JSON::Object* json1 = new JSON::Object()
        .setProperty("number", 123456)
        .setProperty("string", "text")
        .setProperty("boolean", true)
        .setProperty("object", new JSON::Object()
            .setProperty("number", 123456)
            .setProperty("string", "text")
            .setProperty("boolean", true)
            .setProperty("array", new JSON::Array())
        )
        .setProperty("array", new JSON::Array()
            .add(true) // boolean
            .add(123456) // number
            .add("string") // string
            .add(new JSON::Object()
                .setProperty("number", 123456)
                .setProperty("string", "text")
            )
            .add(new JSON::Array()
                .add(true)
                .add(123456)
                .add("string")
            )
        );

    string exampleText = json1.toString();
    Print(exampleText);

    JSON::Object* json2 = new JSON::Object(exampleText);
    string objectKeys[];
    json2.getKeysToArray(objectKeys);

    if (
        json2.hasValue("array")
        && json2.isArray("array")
        && json2.getArray("array").getLength() > 4
        && json2.getArray("array").isBoolean(0)
        && json2.getArray("array").getBoolean(0) == true
        && json2.getArray("array").isObject(3)
        && json2.getArray("array").getObject(3).isString("string")
        && json2.getArray("array").getObject(3).getString("string") == "text"
        && json2.getArray("array").getObject(3).isNumber("number")
        && json2.getArray("array").getObject(3).getNumber("number") == double(123456)
    ) {
        Print(json2.toString());
        Print(json2.toString() == json1.toString());
    }

    delete json1;
    delete json2;
}

authtor: Kuzme Shevelev (seffele@gmail.com)
github:  https://github.com/Senails/mql5-json

Traduit du russe par MetaQuotes Ltd.
Code original : https://www.mql5.com/ru/code/53107

Timer Timer

Callback interface for timer

T3 Moving Average T3 Moving Average

The T3 Indicator is an advanced moving average that combines six exponential moving averages to provide smoother price action with reduced lag compared to traditional moving averages.

MeanReversionTrendEA MeanReversionTrendEA

The EA automatically trades based on trend and mean reversion signals with validated parameters.

BarDuration BarDuration

This is a simple indicator to display histogram of custom bars' durations in minutes. Applicable for renko boxes, PnF, equivolume bars, etc.