![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
In short, every time you change a user parameter value, this value should be converted to a variable value from the union and immediately saved to a shared byte array, which you can then convert to uint and write to the resource.
You must have a user parameter inside the union structure. When you change the parameter, the structure will change with a simultaneous change of the int array
i[2] is a user resource that is read by another program.
With one line cc.width = 200 you will change:
- The parameter responsible for the width,
- The structure containing this parameter,
- The array of the resource being read by the other program.
And there is no conversion and copying here, just mapping.I can change the wrapper functions in the Connection Properties file and convert each usable value to the corresponding variable from the union, and make a byte array on the fly. But, text values which also need to be passed, converted to byte array usingStringToChar().
However, this removes the point of using a union. After all, if I have to useStringToChar() anyway, why not assemble everything into a string and then translate the whole string into bytes usingStringToChar()?
You must have a user parameter inside the union structure. When you change the parameter, the structure will change with a simultaneous change of the int array
i[2] is a user resource that is read by another program.
With one line cc.width = 200 you will change:
- The parameter responsible for the width,
- The structure containing this parameter,
- The array of the resource which is read by a third-party program.
And there's no conversion or copying here, just mapping.Vasily, you're forgetting that we're talking about two-way communication. In my engine, I can tie everything to unions, but I can't be responsible for the user code. I can only come up with wrappers and put them in the plugins.
Where's the guarantee that the user will also use unions? So when he calls my wrapper functions, I have to take his value myself and cast to one of my variables from my unions inside his plugin file.
I can change the wrapper functions in the Connection Properties file and convert each usable value to the corresponding variable from the union, and make a byte array on the fly. However, text values, which must also be passed, must be converted to a byte array usingStringToChar().
However, this removes the point of using a union. After all, if I have to useStringToChar() anyway, why not assemble everything into a string and then translate the whole string into bytes usingStringToChar()?
Because you'll have double parsing. You'll convert everything to a string, which is very slow. Then you parse the string into an array, which is very fast. Then you assemble it back to a string - that's very fast. Then you parse the string into the right types - that's very slow.
OK, but what about texts?
They have to be converted into bytes viaStringToChar(). You can't use union, right?
Yes, you have to translate them, but it's fast, unlike parsing.
For example:
Here is the wrapper function in theConnection Properties plug-in file:
This function is called like this:
That is, the user sets the value ofClose[2] in a table cell.
Hence, inside his wrapper function in his program, I can represent the value(Close[2]) as a char array.
But, in the same cell, the user can send the value "Hello! :)", and then what to do?
Oh, Peter, you started with the wrong programming language. You should have learned something not strictly typed.
In general, I understood you, you invented your own untyped language based on MQL. You got around its strict typing by using strings. This is a maneuver!
Oh, Peter, you started with the wrong programming language. You should have learned something not strictly typed.
In general, I understood you, you invented your own untyped language based on MQL. You got around its strict typing by using strings. This is a maneuver!
Yeah,)) A move with a knight!
If you are using a table, you must decide whether you want the data in the table to be strictly numeric or textual. If text, you pass in strings. If it is real, your function must look like this: