Hello, I would like to know how to create vectors, matrices, arrays in memory and would also like to know how to make a custom block, for example, to create a detailed log file.
Thanks!
Vectors, matrices, arrays in memory
-
Hello, I would like to know how to create vectors, matrices, arrays in memory and would also like to know how to make a custom block, for example, to create a detailed log file.
Thanks! -
I don't even know what are vectors and matrices in MQL4/MQL5. Arrays are very limited in my opinion, I always have problems with them.
Custom blocks are made from here: https://fxdreema.com/studio/
It's enough to write some code and it will work. To be able to connect with other blocks there is one keywort ~next~, put this where the next block must be run. All blocks are normal functions in MQL, so ~next~ will simply be replaced with function calls while building the project. ~inext~ is similar, but for the second yellow output.Here is some screenshot: http://prntscr.com/9fhqoo This is the code for the "Draw Button" block.
At the bottom you can see ~next~. Use this block in a project, connect some other block after it, generate the code and you will see with what ~next~ will be replaced.As I mentioned, each block has it's own function in the code. The parameters of the block are local variables in the function and they are automatically generated and put at the top of the code. So in the code you only use their names directly, as you can see in the screenshot.
But there is one specific parameter ObjText that is not used as a variable name. Instead, ~ObjText~ is used and this puts it's value directly at that place. I do this for parameters defined as "Custom", because this parameter is actually a function and it can be anything (custom indicator and so on... ) and I don't want to run this code at the top, because in most cases it will not be used. It will appear in the final code, but there is a chance that it will never be used.Here is another screenshot: http://prntscr.com/9fhtss
As you can see, it depends on StopLossMode whether ~dpStopLoss~ will be used or not, the same for ~ddStopLoss~ and ~dlStopLoss~.At some point I will make the generator to remove those parts of the block that are not used, but for the moment this is the situation, most code from the generated EA is never used.
You can also define functions and there is no need for explanation here - just hit New, write some function and save it. Then use it where you want - in the custom block's code or even in the blocks. The generator will find that function and embed it into the final code when it's detected.
How to define input parameters... well, I think you can learn it when you try it. This "--" button creates separators - those things that are used to group parameters. If the parameter is a drop-down (as in the second screenshot), then for each of it's value you can select few other parameters to be shown.