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

 
Kot:


Thank you! Got the idea.

What if the situation is different. There are horizontal lines with different names on the chart. The script should calculate which line corresponds to which price.

What does it mean?

- If we want to know the levels of all horizontal lines, search through the graphical window objects and take ObjectGetDouble(.., OBJPROP_PRICE) for the uplines.

PS. a correctly posed question is half the answer - learn how to formulate your questions

 
Maxim Kuznetsov:

What does it mean ?

- If you want to know the levels of all horizontal lines, then go through the window graph objects and take ObjectGetDouble(.., OBJPROP_PRICE) for the mountain lines.

PS. the right question is half the answer - learn how to formulate your questions


Just what you need. THANK YOU!
 

I've already lost my logic - please help!

I took the script, made a function from it and inserted it as a function in the indicator, and then I got errors

   for(int i=0;i<SizeMass;i++)
     {
      summDelta[i]=(Digit[i+1]-Digit[i]);
     }
'i' - variable already defined FindOblast'_1_1.mq4 308 12

I have not got such errors in the script, moreover, loops with similar variables are in the output, but not all of them are violated - what's wrong?

 
-Aleks-:

I've already lost my logic - please help!

I took the script, made a function from it and inserted it as a function in the indicator, and then I got errors

'i' - variable already defined FindOblast'_1_1.mq4 308 12

I did not see such errors in the script, moreover, the loops with the same variables are in the output, but it does not generate errors in all of them - what's wrong?

The problem is in the scope of the variables.

Add (if you haven't already) #property strict directive to the very beginning of your code and fix all specified errors and compile-time warnings.

 
Artyom Trishkin:

The issue is the scope of the variables.

Add (if you haven't already) the #property strict directive to the very beginning of your code and fix any errors and compile-time warnings that are pointed out.

Thanks for the reply.

It's so clear that the scope is local - except that "i" is not declared separately anywhere - in a function or globally!

Added #property strict and all those "i" errors are gone - how so, if it's a more thorough check?

 
-Aleks-:

Thanks for the reply.

So it's clear that the scope is local - except that "i" is not declared separately anywhere - in a function or globally!

I added #property strict and all those errors with "i" disappeared - how is that possible if it's a more thorough check?

It's precisely the more thorough checking that takes into account all areas of variable visibility.
 
Artyom Trishkin:
It's precisely the more thorough checking that takes into account all areas of variable visibility.

I see, but it's not clear why it's even possible to work without these checks...
 
-Aleks-:

I see, but I don't know why there is no possibility to work without these checks...

For compatibility with older codes.

Now whenever you write code, don't forget to add this directive for mql4. For mql5 strict checks are initially enabled and the compiler does not know this directive.

 
Artyom Trishkin:

For compatibility with older codes.

Now whenever you write code, don't forget to add this directive for mql4. For mql5 strict checks are initially enabled and the compiler does not know this directive.

It's good, thank you. I have built a new indicator without old one.

 

Help with reading from a .crv file

file has this entry :

2010.03.18 01:35:00;1.37409;1.37119

how to write code to get each value separately in a variable

Reason: