Questions from Beginners MQL4 MT4 MetaTrader 4 - page 231

 
Konstantin Nikitin:

Well, to be more precise, it looks like you can't. And about SLEEP. Do you want to freeze the entire Expert Advisor for some time? Or just a certain function, after it has been worked out. In any case, even for interruption of Expert Advisor's work, it is better to use the flag for long delays, and when checking it, if there is no permission, just exit to OnTick/OnTimer. For short delays, yes, you can useSLEEP.
By the way,SLEEP does not work in indicators.

The Sleep() function cannot be called from custom indicators, because indicators are executed in the interface thread and must not slow it down.

So, understand the use of flags, you will need it in future.

No, I wanted the EA to be delayed for 10 seconds before it closes, but for some reason when the slip goes before the CloseAllOrder function, the function does not work at all, the slip does not work after it, etc. I am now thinking of adding this delay to the CloseAllOrder function itself. I've been studying MQL4 programming for only a month, plus I've never programmed before.
 
Nargiz Ravanova:
No, I wanted my EA to hold for 10 sec. before it closes, but when a slip goes before CloseAllOrder function, the function does not work at all, then it does not work after it, etc. I am now thinking of adding this delay to the CloseAllOrder function itself. I've been studying MQL4 programming for only a month, plus I've never programmed before.

Check Slip by printing milliseconds before and after Slip. If something is not working, are you using old data? Are you usingRefreshRates() or aren't you taking into account that the number of orders is decreasing?

 
Aleksei Stepanenko:

Accepting full responsibility for the fact that

ushort

The unsigned shorttype is the ushort type, which also has a size of 2 bytes. The minimum value is 0, the maximum value is 65,535.

int

The integer int type has a size of 4 bytes (32 bits). The minimum value is -2 147 483 648, the maximum value is 2 147 483 647.

Thanks Alexei, it all worked out to nil by compilation. I'm sure it wasn't difficult for you....
 
Hello, how do I get my metaquotes id in the mt4 mobile app if it says metaquotes id not registered and when I try to click on this tab a message appears: failed to register message receiving service. Check your internet connection and try again.
 
SGarnov:
Everything worked out zero by compilation

Glad it helped

 

*** is it ***? or quite real brokers who will help?

 
Владимир Герр:

*** is it ***? or quite real brokers who will help?

Discussion about brokers is forbidden.

 
Comrades, need your help on webrequest.
A rather large amount of data (30k+ characters) has to be sent to the server. The server finds that the data is interrupted in the middle of the next chunk of data. Are there any restrictions on webrequest? Or a workaround to solve this problem? I am making it specifically for mql4.
 
O-Yama:
Comrades, need your help on webrequest.
A rather large amount of data (30k+ characters) has to be sent to the server. The server finds that the data is interrupted in the middle of the next chunk of data. Are there any restrictions on webrequest? Or a workaround to solve this problem? I am making it specifically for mql4.

Is it a get or post method?

Do itby post-query, try to remove length limitation on server

php.ini
post_max_size=200 M
upload_max_filesize=200 M

или

.htaccess
php_value post_max_size 200 M
php_value upload_max_filesize 200 M
 
Vitaly Muzichenko:

Get or post method?

Do thepost-request, on the server try to remove the length restriction

Post, then let's see what's on the server.
I collect the array of query message with my function in small chunks, because StringToCharArray behaves strangely and constantly truncates the array. Maybe I messed up something there too...

void OneMoreString(string str)
{
char cashe[];
int sz=ArraySize(buf); //buf is located outside the function and is always used in webrequest
StringToCharArray(str,cashe,0,StringLen(str)); //convert the string at the function input into the char array cashe
ArrayResize(buf,sz+ArraySize(cashe));
ArrayCopy(buf,cashe,sz); //copy cashe into buf
}

P.s. : I don't know how to insert code snippets correctly here
Reason: