Errors, bugs, questions - page 97

 
EvgeTrofi:

If return has a lot of brackets - it starts getting confused!?

Here, for example, is a function that returns a number from a string like "klsfd Step 2:

How is it different from this one?

The second one will cause compile-time problems, while the first one won't.

Try this

int GetStep(string text){
   string Right;
   int U = StringFind(text, "Step ");
   int End;
   if(U>=0){
      U=U+5;
      Right = StringSubstr(text, U);
      End = StringFind(Right, ".");
      return((int)(MathRound(StringToDouble(StringSubstr(text, U, End-U)))));
   }
   return(0);
}
 
Interesting:

You need to explicitly convert the result to the int type.

PS

But as I understand this warning can be ignored in principle...

Well it is clear, but logically it is not correct! An expression to the right of the equality sign should return the int type!

 
EvgeTrofi:

Well it's understandable, but logically it's not right! The expression to the right of the equal sign should return int type ?!

It is int for SYMBOL_TRADE_STOPS_LEVEL but the function may return other types as well...

Identifier

Description

Property type

SYMBOL_SELECT

Indicates that the symbol is selected in the Market Watch

bool

SYMBOL_VOLUME

Volume - Volume of the last trade

long

SYMBOL_VOLUMEHIGH

Maximum Volume for the day

long

SYMBOL_VOLUMELOW

Lowest Volume for the day

long

SYMBOL_VOLUMEBID

Volume in current Bid

long

SYMBOL_VOLUMEASK

Volume in current Ask

long

SYMBOL_TIME

Last Quote Time

datetime

SYMBOL_DIGITS

Number of decimal places

int

SYMBOL_SPREAD

Spread size in pips

int

SYMBOL_SPREAD_FLOAT

Sign of a floating spread

bool


PS

Besides, as I've already written above, this warning can be "ignored" if you can be sure that the code is correct...

 
Can you please tell me how to turn off the automatic update? My workplace only gives me 200 MB for a month. One more update and the traffic goes down :(
 
EvgeTrofi:
Can you please tell me how to turn off the automatic update? My workplace only gives me 200 MB for a month. One more update and the traffic will be ruined :(
Standard ways are not possible, at least not yet...
 

"updated" to the latest build - as a result, each time you connect to the Internet, the client at first consumes 60 mb, then does not respond, forced to close the

client through the task manager, opened the program "defragmentation disk This section of the drive (where the client is installed) is very fragmented, defragmentation

still does not help, files in the directory (where the terminal MQL-5 is installed) are still fragmented.

 
I rewrote my EA from MQL4 to MQL5. When compiling - does not make a single error or comment. During testing - not a single trade. Where can I find the reason for this result? What should I look for first?
 
EvgeTrofi:
I rewrote my EA from MQL4 to MQL5. When compiling - does not make a single error or comment. During testing - not a single trade. Where can I find the reason for this result? What should be the first thing to look for?
Can I see the log of the Expert Advisor in the Strategy Tester (preferably as a file)?
 
The log is, you could say, blank. I'm used to MQL4 writing like wrong lot or wrong stops....
 
EvgeTrofi:
The log is, you could say, blank. I'm used to MQL4 writing like wrong lot or wrong stops....

This is the tester's log, with an indication of where to look at the agent's log

MN      0       Tester  13:42:54        log file "C:\Program Files\MetaTrader 5\Tester\Agent-127.0.0.1-3000\logs\20100817.log" written
Reason: