How to include library?
-
Actually https://stackoverflow.com/questions/41360826/managing-json-array-format-in-mql4-script
Here is a working example, the question is how to include an external library? -
Any real programmer here?

-
I know how to do it with native MQL and it works. WIth FxDremma it's not working.
-
@gsmtricks I think the only way (so far I realized) is that you can incide external libraries when building a custom block. But I've never done this by myself and there are not so many examples here.
-
Hey @fxdreema, could you please shed some light on the library compability? Being able to use the statistical library would be equivalent to anabolic steroids for my projects

-
it is simple ...
copy your include files into your fxdreema local folder (folder named MQL4\Include)
you can recompile the inserted mqh file in metaeditor
the json file needed to be modified because (all the variables/objects named as "v" or "c" must be renamed to something else)
https://gofile.io/?c=3ysLTado your job in fxdreema and generate only mql code

open the EA in metaeditor and insert desirable statement in the top of EA code and click compile button:

hope for no errors
-
@miro1360 But you have to do it each time you save your mq4 file. That's a bit anoying, isn't it? Would be easy to have a block for includes maybe on init tab?!?
-
this is how to create a custom code block in the studio, only for the MQL4 (mql5 probably the same)

then insert the include block in the project ... only the mq4 code can be generated from fxdreema, then it has to be compiled with the metaeditor:

...Would be easy to have a block for includes maybe on init tab?!?
Well, it is not that simple because you have to compile with your local Metaeditor even with a block for includes (the include files can be seen only from local, they are needed for the compilation process ..... custom indicators may not be present, that is the difference). Therefore the web based ex4 compilation throws an error, because the compiler looks for these "missing" libraries on the compilation machine (webserver).
Just use the first method, it will take a few seconds.
Test your code prototypes in the Metaeditor, and after that put a functional prototype into a complicated EA in fxdreema.That is all I can do to help you

-
note this:

... for an include file with such issue, it will only be done only once, but it must be correctly done
-
@miro1360 Okay, that's worth a try. Thanks for the information! I always compile in local Metaeditor. So that would be fine for me.
-
It's not working. Good idea but not works.
How to test?- Create new MT5 expert - just empty
- Export mq5 code
- Open exported code in MetaEditor
- Compile it - works
- Add line #include <JAson.mqh>;
- Compile - can't compile it. 100 errors.
-
@miro1360
With your file JAson.mqh I can do include now.
Now still to understand how to adopt custom qml code.
I have a code:
// Object
CJAVal json;// Load in and deserialize the data
json.Deserialize(data);// Try to access the data elements
Alert(json["orderid"].ToInt());
Alert(json["ordercurrency"].ToStr());But with this code can't compile.
Please advice.I just need to read JSON string from variable: data
-
@gsmtricks said in How to include library?:
data
Did you apply your test json to the data variable for testing?
-
So let me provide full information.
- I have variable created and named: test_json ( for example )
- In some time I write there JSON data: {"api":"online","appid":"11111"}
What do I need:
- Read JSON string from a variable test_json ( here is data: {"api":"online","appid":"11111"} )
- Save to variable test_status: online
- Save to variable test_appid: 11111
That all.
If someone can provide me working custom mql code for FxDremma I will be able to use it as an example for my strategy, -

-
@gsmtricks said in How to include library?:
{"api":"online","appid":"11111"}
Thank you for help.
Feel stupid:

-

-
@gsmtricks @miro1360 said that you have to compile in meta editor not in fxdreema.
So save your mq5 file to experts folder of your terminal and open it with metaedior (eg. refresh experts list and right click on your ea name and choose modify).
In Metaeditor press compule button and watch for errors on the bottom. -
I am done. Compelled.
Now will try to get the data from the variable.
string dataDoes it mean that i will read a string from variable named data?
-
@gsmtricks I think so.