Forum on trading, automated trading systems and testing trading strategies
Features of the mql5 language, subtleties and tricks
fxsaber, 2025.11.19 17:57
Who knows JSON, please share a ready solution with the functionality of these two buttons.

bool SymbolExport( const string Symb, const string FileName ); // Export symbol's json-data. bool SymbolImport( const string Symb, const string FileName ); // Import symbol's json-data.
Should create and read exactly the same json as MT5 does through the labelled buttons on the screenshot.
Need for a public torrent with backtest data. Thanks.
case JSON_STRING: current_node.m_str = GetStringFromSlice(current_token.start, current_token.length); break; case JSON_DOUBLE: { string num_str = StringSubstr(m_text, current_token.start, current_token.length); if(StringFind(num_str, ".") < 0 && StringFind(num_str, "e") < 0 && StringFind(num_str, "E") < 0) { current_node.m_type = JSON_INT; current_node.m_int = StringToInteger(num_str); } else { current_node.m_double = StringToDouble(num_str); } current_node.m_num_str = m_doc.m_arena_ptr.AllocateString(num_str); } break;
MT5 exports JSON in UTF16 format, while this library exports files in UTF8 format. The order may differ, but the content is the same.
if(SymbolImport("XAUUSDm", "XAUUSDm_config.json"))
The JSON file path should be placed in `MQL5/Files/`.
the main reason I use this library is that it supports more JSON standards and offers more features.
bool JsonStreamParser::ParseValue(JsonError &e) { if(m_depth>=m_options.max_depth) return SetError(e,"Max depth exceeded"); SkipWhitespaceAndComments(); if(m_reader.IsEOF()) return SetError(e,"Unexpected end of input, expected a value"); ushort c=m_reader.Peek(); switch(c) { case '{': m_depth++; return ParseObject(e); case '[': m_depth++; return ParseArray(e); case '"': { string s; if(!ParseString(s, e)) return false; return m_handler.OnString(s); } case 't': case 'f': case 'n': return ParseKeyword(e); default: if(c=='-' || (c>='0' && c<='9')) return ParseNumber(e); } string error_msg = "Invalid character '" + ShortToString(c) + "' starting a value"; return SetError(e, error_msg); }
These valid entries do not fall under this condition.
.123 +123
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
MQL4/5-JsonLib:
A JSON library that supports MQL4/MQL5
Author: hini