Errors, bugs, questions - page 3040

 
Andrei Trukhanovich:

This has been the case for a long time. mql strings really don't like null characters inside a string and in literals, in functions too.

The only normal way is to translate three strings with a terminating null into an array.

I.e. this behaviour as it is now was done intentionally some years ago. I don't know the reasons.

And what function besides StringToCharArray does not work correctly with internal nulls?

For example StringToShortArray - works without errors.

StringCompare used to work incorrectly but this was fixed long ago.

As for StringLen, it does not work correctly.

Forum on trading, automated trading systems and strategy testing

Bugs, bugs, questions

A100, 2019.05.15 13:45

Just partially corrected errors .... why not!? In my memory StringLen always worked correctly (at least in x32)

 
A100:

I don't remember exactly, at one point a string with a null inside was truncated to zero, maybe stringconcatenate, maybe with simple string operations.

 

Great forum, got on sending a reply this afternoon. The reply itself got lost.

Monday, middle of the afternoon...


 

Several terminals are minimised. However, each terminal gives alerts to its own alert window - not collapsed.

How do I know which alert window corresponds to which terminal?

 
fxsaber:

Several terminals are minimised. However, each terminal gives alerts to its own alert window - not collapsed.

How can I understand which alert window corresponds to which terminal?

I don't know anything about unique terminal ID, but you can add to alertAccountInfoString(ACCOUNT_COMPANY). I don't think anyone will have several MT5 instances logged simultaneously to one and the same brokerage company, although hypothetically it could still be reasonable if one needs to sit on different accounts of the same broker. In this case (at the very least)AccountInfoInteger(ACCOUNT_LOGIN) orAccountInfoString(ACCOUNT_SERVER) might work.

 
x572intraday:

I don't know anything about unique terminal ID, but you can addAccountInfoString(ACCOUNT_COMPANY) to the alert. I don't think anyone will have multiple MT5 instances logged into the same brokerage company at the same time, although hypothetically it might still be worthwhile if you need to sit on different accounts of the same broker. In this case (at the worst)AccountInfoInteger(ACCOUNT_LOGIN) orAccountInfoString(ACCOUNT_SERVER) will do.

Yes, you can put any identification data into your Alerts. But the question is about the general case.

 
A100:

Which function besides StringToCharArray does not work correctly with internal zeros?

For example, StringToShortArray works without errors.

StringCompare used to work incorrectly, but this was fixed long ago.

As for StringLen


You're right, changed StringToCharArray's behaviour, now it's the whole length of the string, not up to the first '\0' character

 
Ilyas:

You're right, changed the behaviour of StringToCharArray, now to the full length of the string, not up to the first '\0' character

Thenthere is only one differencebetween StringToCharArray andStringToShortArray:

Forum on Trading, Automated Trading Systems and Strategy Testing

Errors, Bugs, Issues

A100

, 2021.05.25 00:16
void OnStart()
{
    string text = "ABC";
    const int start = 0, count = 0;
    uchar array1[]; int n1 = StringToCharArray(  text, array1, start, count );
    short array2[]; int n2 = StringToShortArray( text, array2, start, count );
    Print( n1, ":", n2 );
}

Result: 4:0

Expected: 0:

0
 
A100:
Then only one difference betweenStringToCharArray andStringToShortArray remains:

Made the behaviour the same.


Additionally: in the near future, arrays and strings will be supplemented with methods, e.g:

str.ToCharArray(char_arr, from_position, symbol_count);
str.Length();

arr.Size();
string str = char_arr.ToString( code_page );

if(!obj_arr.Push( constructor_parameters ))
   CriticalError("failed to add element");

obj_arr.Sort( compare_func_ptr, context );

obj_arr.Select( uint_result_index_array, filter_func_ptr, context );
 
Ilyas:

in the near future, arrays and strings will be complemented by methods

Less and less in common with MQL4...

Reason: