ENUM_TRADE_RETURN_CODES Code ID Description 10004 TRADE_RETCODE_REQUOTE Request rejected 10006 TRADE_RETCODE_REJECT Request rejected ... no code 10005. Is this not an error? Respectfully ...
Question. There is a function called GetTickCount () - itreturns the number of milliseconds elapsed since the system started. The note says that "the count is limited by the resolution of the system timer. Since the time is stored as an unsigned integer, it overflows every 49.7 days when the computer is running continuously".
And what happens after the counter overflows? Does it reset and start a new countdown, or does the system freeze?
Question. The description of switch(expression){...} says that "the switch operator's expression must be of integer type". I've seen the description of this operator with expressions of other types on the Internet. Will the use of switch operator be extended by adding expressions of string type?
Question. The description of switch(expression){...} says that "the switch operator's expression must be of integer type". I've seen the description of this operator with expressions of other types on the Internet. Will we extend use of the switch operator by adding expressions of the string type?
No, unfortunately, it won't. For string types only if ... else if ... else .
Using integer types in switch will speed up the switch operator several times as much as if
Question. The StringConcatenate() function description says that "StringConcatenate() works faster and more economical in memory than string linking by means of addition operations due to the fact that temporary variables of string type are not used". I used the examples from the Reference Manual, changing them slightly:
string a="a",b="b",c;
uint start,stop;
long i,length=10000000;
//--- первый способ
start=GetTickCount();
for(i=0;i<length;i++)
{
c=a+b;
}
stop=GetTickCount();
Print("time for 'c = a + b' = ",(stop-start)," milliseconds, i = ",i);
//--- второй способ
a="a"; // заново инициализируем переменную a
start=GetTickCount();
for(i=0;i<length;i++)
{
StringAdd(a,b);
}
stop=GetTickCount();
Print("time for 'StringAdd(a,b)' = ",(stop-start)," milliseconds, i = ",i);
//--- третий способ
a="a";c="";
start=GetTickCount();
for(i=0;i<length;i++)
{
int k=StringConcatenate(c,a,b);
//c=""; //с такой строчкой работает ещё дольше.
}
stop=GetTickCount();
Print("time for 'StringConcatenate(c,a,b)' = ",(stop-start)," milliseconds, i = ",i);
The output is:
DR 0 DoubleToString (EURGBP,M1) 22:15:55 time for'c = a + b' = 2359 milliseconds, i = 10000000
QE 0 DoubleToString (EURGBP,M1) 22:15:56 time for'StringAdd(a,b)' = 1031 milliseconds, i = 10000000
FE 0 DoubleToString (EURGBP,M1) 22:16:00 time for'StringConcatenate(c,a,b)' = 3891 milliseconds, i = 10000000
It turns out that StringConcatenate works slower than string binding using addition operations. What is the problem?
Question. The StringConcatenate() function description says that "StringConcatenate() works faster and more economical in memory than string linking by means of addition operations due to the fact that temporary variables of string type are not used". I used examples from the Reference, changing them a bit:
I got the output:
It turns out that StringConcatenate works slower than string binding using addition operations. What's the snag?
It's a bit of a misnomer to check (if I understand it correctly). The trick of the function is something else...
Approximately this code
////////////////////////////////////////////////////////////////////////////////// Global variables, used in working the trade system //////////////////////////////////////////////////////////////////////////////////string a="Пример";
double b=1.26,c = 1.27;
string d;
uint start,stop;
long i,length=10000000;
////////////////////////////////////////////////////////////////////////////////voidOnStart()
{
//----------------------------------------------------------------------------////Work variables//----------------------------------------------------------------------------//
start=GetTickCount();
for(i=0;i<length;i++)
{
d=a+(string)b+(string)c;
}
stop=GetTickCount();
Print("time for 'd = a + b + c' = ",(stop-start)," milliseconds, i = ",i);
//Второй способ
d= "";
start=GetTickCount();
for(i=0;i<length;i++)
{
StringAdd(d,a);
StringAdd(d,(string)b);
StringAdd(d,(string)c);
}
stop=GetTickCount();
Print("time for 'StringAdd()' = ",(stop-start)," milliseconds, i = ",i);
//Третий способ
d= "";
start=GetTickCount();
for(i=0;i<length;i++)
{
int k=StringConcatenate(d,a,b,c);
}
stop=GetTickCount();
Print("time for 'StringConcatenate(d,a,b,c)' = ",(stop-start)," milliseconds, i = ",i);
//----------------------------------------------------------------------------//
}
////////////////////////////////////////////////////////////////////////////////
And this result
2011.04.1515:28:58123 (EURUSD,D1) time for'd = a + b + c' = 81094 milliseconds, i = 100000002011.04.1515:30:24123 (EURUSD,D1) time for'StringAdd()' = 85828 milliseconds, i = 100000002011.04.1515:31:46123 (EURUSD,D1) time for'StringConcatenate(d,a,b,c)' = 81812 milliseconds, i = 100000002011.04.1515:33:36123 (EURUSD,D1) time for'd = a + b + c' = 82938 milliseconds, i = 100000002011.04.1515:35:00123 (EURUSD,D1) time for'StringAdd()' = 83859 milliseconds, i = 100000002011.04.1515:36:21123 (EURUSD,D1) time for'StringConcatenate(d,a,b,c)' = 80719 milliseconds, i = 10000000
PS
Most likely, the line d= "" should have been placed in the for loop, but I don't think this bug has much effect on the result.
Strange. You need code for MQL5, which should already be on the website. All you have to do is look it up. That's exactly what I'm talking about.
But that's up to you.
It's a very tedious search, maybe someone will just tell you.
By the way, I have remade this code for mql5. Maybe someone could use it.
please comment:
ENUM_TRADE_RETURN_CODES
Code ID Description
10004 TRADE_RETCODE_REQUOTE Request rejected
10006 TRADE_RETCODE_REJECT Request rejected
...
no code 10005. Is this not an error?
Respectfully ...
Question. There is a function called GetTickCount () - itreturns the number of milliseconds elapsed since the system started. The note says that "the count is limited by the resolution of the system timer. Since the time is stored as an unsigned integer, it overflows every 49.7 days when the computer is running continuously".
And what happens after the counter overflows? Does it reset and start a new countdown, or does the system freeze?
Yedelkin:
What happens when the counter overflows? Does it reset and start a new count, or does the system freeze?
It overflows and starts from scratch.
Question. The description of switch(expression){...} says that "the switch operator's expression must be of integer type". I've seen the description of this operator with expressions of other types on the Internet. Will the use of switch operator be extended by adding expressions of string type?
Question. The description of switch(expression){...} says that "the switch operator's expression must be of integer type". I've seen the description of this operator with expressions of other types on the Internet. Will we extend use of the switch operator by adding expressions of the string type?
No, unfortunately, it won't. For string types only if ... else if ... else .
Using integer types in switch will speed up the switch operator several times as much as if
No, unfortunately it won't. For string types only if ... else if ... else
Using integer types in switch will speed up the code several times as much as if
Question. The StringConcatenate() function description says that "StringConcatenate() works faster and more economical in memory than string linking by means of addition operations due to the fact that temporary variables of string type are not used". I used the examples from the Reference Manual, changing them slightly:
The output is:It turns out that StringConcatenate works slower than string binding using addition operations. What is the problem?
Question. The StringConcatenate() function description says that "StringConcatenate() works faster and more economical in memory than string linking by means of addition operations due to the fact that temporary variables of string type are not used". I used examples from the Reference, changing them a bit:
I got the output:It turns out that StringConcatenate works slower than string binding using addition operations. What's the snag?
It's a bit of a misnomer to check (if I understand it correctly). The trick of the function is something else...
Approximately this code
And this result
PS
Most likely, the line d= "" should have been placed in the for loop, but I don't think this bug has much effect on the result.