10. MQL5: Added native support for .NET libraries with "smart" function import. Now you can use .NET libraries without writing special wrappers - MetaEditor takes care of that.
Not calling to write in C#. Just that the benefits of implicit conversion are questionable (imho, sugar, no more), it does not increase profitability of strategies. If anyone can explain why it helps so much when coding strategies, I would be happy to learn something new.
Vasiliy Sokolov: It doesn't increase the profitability of strategies.
Referring to the profitability of strategies when discussing programming techniques is rather depressing.
Vasiliy Sokolov: If someone can explain why it helps so much in coding - I'll be glad to learn something new.
You can't even make your own multidimensional array properly. Let alone an array with different types of values. You can't even do it with just one, because such code would not fit into mql:
Of course, you can write d=array[5].to_double(), pretend it should be so and be happy about your ugly code. But if overloading of type conversion operations were allowed, hardly anyone would prefer this way of writing d=array[5].
of course you can write d=array[5].to_double(), pretend that this is how it should be and be happy about your buggy code. But if overloading of type conversion operations were allowed, hardly anyone would prefer this way of writing d=array[5].
Straightforward. d=array[5] could:
template <typename T>
class MainArray
{
private:
T m_items[];
int m_curr;
public:
MainArray()
{
ArrayResize(m_items, 16);
m_curr = 0;
}
void Add(T item)
{
m_items[m_curr++] = item;
}
T operator[](int index)
{
return m_items[index];
}
};
//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
MainArray<double> array;
array.Add(123.456);
double v = array[0];printf((string)v);
}
If we get nerdy, there are still difficulties with array[3] = 4.00123; But it's readable and fine as it is.
If you get boring, then there are difficulties with array[3] = 4.00123; But it's readable and good enough as it is.
Yep, d=array[5] is ok. but then you can't make array[5]=d. But you can make %= instead of =. no problem, at the same time the icon will remind us what place everything is done through))
Yeah, d=array[5] can. but then you can't make array[5]=d. But you can make %= instead of =. No problem, and the icon will remind you which place to use))
If you really want to do it, you can do it like this
#property strict#include <TypeToBytes.mqh> // https://www.mql5.com/ru/code/16280#define PRINT(A) ::Print(#A + " = " + (string)(A));
voidOnStart( void )
{
// Работа со стандартными типамиcolor Color = C'241,248,255';
PRINT(_R(Color)[(uchar)1]) // Green-составляющая цвета - 248_W(Color)[2] = (uchar)230; // Записали по смещению 2 значение (uchar)230.
PRINT(Color) // Убедились, что Color теперь C'241,248,230'// Работа со строкамиstring Str = "abcd";
_W(Str)[2] = "98765"; // Побайтовая запись строки в строку со смещением 2
PRINT(Str)
string StrArray[] = {"123", "45", "6789"};
_W(Str) = StrArray; // Записали в строку строковый массив
PRINT(Str)
_W(Str)[3] = (uchar)0; // В байт со смещением 3 записали ноль, тем самым отбрезав строку (длина - 3 ANSI-символа (4 байта))
PRINT(Str);
}
of course you can write d=array[5].to_double(), pretend that this is how it should be and be happy about your buggy code. But if overloading of type conversion operations were allowed, hardly anyone would prefer this way of writing d=array[5].
What problems people have))) Oh, bless my life!
By the way, writingd=array[5].to_double() is much easier thand=(double)array[5] Just press a point. But we're not looking for easy ways...
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
As far as I remember, C# is not good friends with mql
https://www.mql5.com/ru/forum/285631
10. MQL5: Added native support for .NET libraries with "smart" function import. Now you can use .NET libraries without writing special wrappers - MetaEditor takes care of that.
It doesn't increase the profitability of strategies.
Referring to the profitability of strategies when discussing programming techniques is rather depressing.
If someone can explain why it helps so much in coding - I'll be glad to learn something new.
You can't even make your own multidimensional array properly. Let alone an array with different types of values. You can't even do it with just one, because such code would not fit into mql:
Of course, you can write d=array[5].to_double(), pretend it should be so and be happy about your ugly code. But if overloading of type conversion operations were allowed, hardly anyone would prefer this way of writing d=array[5].
...
of course you can write d=array[5].to_double(), pretend that this is how it should be and be happy about your buggy code. But if overloading of type conversion operations were allowed, hardly anyone would prefer this way of writing d=array[5].
Straightforward. d=array[5] could:
If we get nerdy, there are still difficulties with array[3] = 4.00123; But it's readable and fine as it is.
Right. d=array[5] is fine:
If you get boring, then there are difficulties with array[3] = 4.00123; But it's readable and good enough as it is.
Yep, d=array[5] is ok. but then you can't make array[5]=d. But you can make %= instead of =. no problem, at the same time the icon will remind us what place everything is done through))
Yeah, d=array[5] can. but then you can't make array[5]=d. But you can make %= instead of =. No problem, and the icon will remind you which place to use))
If you really want to do it, you can do it like this
etc.
I was critical at first too, but then I thought I could use it myself:
I asked for a parenthesis operator and a grapeshot operator about three or four years ago.
you ask, maybe you can do better.
...
of course you can write d=array[5].to_double(), pretend that this is how it should be and be happy about your buggy code. But if overloading of type conversion operations were allowed, hardly anyone would prefer this way of writing d=array[5].
What problems people have))) Oh, bless my life!
By the way, writingd=array[5].to_double() is much easier thand=(double)array[5] Just press a point. But we're not looking for easy ways...