Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 335

 
kirill1405:

Before inserting the code, it's a good idea to go through it with a styliser (ctrl+, in the meta-editor) to make it easy to read.

But I won't bother you anymore. We need return-types to return integer values/variables, because all code is written inint start() function

 
Alexey Kozitsyn:

Before inserting the code, it's a good idea to go through it with a styliser (ctrl+, in the meta-editor) to make it easy to read.

But I won't bother you anymore. You need return-types to return integer values/variables, because all code is written inint start() function


It's just not clear what exactly to write there in many points.

Could you specify return values in the code?

the code seems to be quite simple

it would be much clearer

or tell me how to avoid return function, if it's possible of course

 
kirill1405:

It's just that at many points it's not at all clear what exactly to write there

Could you please write values for return in the code?

the code seems to be quite simple

it would be much clearer

or tell me how to do without return function, if it is possible.

int start()

void OnTick()

 
Vitaly Muzichenko:

int start()

void OnTick()


and when to leave the rest unchanged?

 
kirill1405:

It's just that at many points it's not at all clear what exactly to write there

Could you please write values for return in the code?

the code seems to be quite simple

it would be much clearer

or tell me how to avoid return function, if it's possible.

There is only one function in the code - Start(). You do not really care what to return. Write return(0); everywhere and everything will be ok.

This code (similar to code from Kovalev's tutorial) was written when it was not necessary to return a value from a function with a type other than void.

 
kirill1405:

and when to leave the rest unchanged?

By the way, it's even better that way. Vitaly advised correctly. It will comply with the new style and will eliminate the need to return values. However, there may be warnings where values do return. Then remove the returned values.
 
Alexey Kozitsyn:
By the way, it's even better that way. Vitaly advised correctly. It will comply with the new style and save us from the necessity of returning values. However, there might be warnings where values are returned. Then remove the returned values.

Normally, you have to delete all the code and rewrite it

Doesn't that scare you?

for (int i=1;i<=OrdersTotal();i++)
{
if (OrderSelect(i-1,SELECT_BY_POS)==true)
{
if (OrderSymbol()!= Symb) continue;
 
Vitaly Muzichenko:

Normally, you have to delete all the code and rewrite it

Doesn't that scare you?

Still haven't fixed it properly)).

I didn't look there so it doesn't scare me... The code without the stylizer already scares me, so I just found the name of the function and calmed down.

 
Alexey Kozitsyn:
By the way, it will be even better. Vitaly gave us the right advice. It will comply with the new style and will eliminate the need to return values. However, there can be warnings where values are returned. Then remove the returned values.

changed to void OnTick() and no more warnings

I have two more questions, if I may

1)I stuck this expert in the tester

and it generates a warning

Can you tell me what it means (on the picture)?

2) What literature should I read to get a better understanding of mql4 programming?

 
kirill1405:

changed to void OnTick() and no more warnings

I have two more questions, if I may

1)I stuck this expert in the tester

and it generates a warning

Can you tell me what it means (on the picture)?

2) What literature should I read to get a better understanding of mql4 programming?

It's ok, no warnings. Use it as it is.