[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 303

 
One more question. xrust indicator (https://www.mql5.com/ru/code/8318) now I need to send the price of maximum and minimum to the Expert Advisor (with output to the chart). i have tried to change it but i can not get the values i need((: one is sent, the second equals 0. How to display the real values?
 
hoz:

I'm learning to work with libraries. I'm writing an Expert Advisor, there's a function like this:

I put it in the inclusion, everything works as it should. But if you connect it to the library, there is an error when compiling the Expert Advisor:

Why is this function not visible in the library?

The library has this content and compiles perfectly:

A lot of errors. Can we look at an example and do it by analogy?
 

There is a quote, suppose Ask = 1.20667

From this quote you need to take out the 3rd digit after the decimal point. I.e. take the value 1.206, the rest should be discarded.

Please, tell me how to do it correctly, because"Normalize" rounds up and the result is 1.20700.

I tried a workaround:

DoubleToStr(Ask,3)

Yes, it gives out everything correctly -> 1.206 . But when going back to Double it rounds again, but to 2 decimal places.

StrToDouble(DoubleToStr(Ask,3)) = 1,2100    // 1,2100 - это получившийся результат (т.е. округляет)

I don't need rounding. I just need to take 2nd, 3rd or 4th digit (my choice) after the decimal point and discard the rest.

How do I do it correctly?

 
Chiripaha:

There is a quote, suppose Ask = 1.20667

From this quote you need to take out the 3rd digit after the decimal point. I.e. take the value 1.206, the rest should be discarded.

Please, tell me how to do it correctly, because"Normalize" rounds up and the result is 1.20700.

I tried a workaround:

Yes, it gives out everything correctly -> 1.206 . But when going back to Double it rounds again, but to 2 decimal places.

I don't need rounding. I just need to take 2nd, 3rd or 4th digit (my choice) after the decimal point and discard the rest.

How do I do it correctly?

You are on the right track: convert double to string by Digits, and then cut off from the result(StringSubstr()) the required number of digits.
 
Chiripaha:

There is a quote, suppose Ask = 1.20667

From this quote you need to take out the 3rd digit after the decimal point. I.e. take the value 1.206, the rest should be discarded.

Please, tell me how to do it correctly, because"Normalize" rounds up and the result is 1.20700.

I tried a workaround:

Yes, it gives out everything correctly -> 1.206 . But when going back to Double it rounds again, but to 2 decimal places.

I don't need rounding. I just need to take 2nd, 3rd or 4th digit (my choice) after the decimal point and discard the rest.

How do I do it correctly?

https://docs.mql4.com/ru/strings/StringSubstr
 

I apologise - I assumed I might be misunderstanding. Tried to clarify, but the effect is still there. - It's my fault, sorry.

I need not just a digit (3rd, 4th, etc. after the decimal point), but the entire digit up to and including the 2nd, 3rd or 4th decimal point. BUT! without rounding.

And the problem is that when I put the digit back into Double type, it rounds up again.

And the whole thing is, that even if that digit in a stupid big way translates one letter at a time first in String type, and then translates it to Double,

it'll round up again. - This is the irony of the situation. Why does StrToDouble() round a number? - This is what I don't understand. The task of the function is to convert it from

from one format to another and do not "mold" or add anything from yourself there. But it also "improves" something.

 
Chiripaha:

I apologise - I assumed I might be misunderstanding. Tried to clarify, but the effect is still there. - It's my fault, sorry.

I need not just a digit (3rd, 4th, etc. after the decimal point), but the entire digit up to and including the 2nd, 3rd or 4th decimal point. BUT! without rounding.

And the problem is that when I put the digit back into Double type, it rounds up again.

And the whole thing is, that even if that digit in a stupid big way translates one letter at a time first in String type, and then translates it to Double,

it'll round up again. - This is the irony of the situation. Why does StrToDouble() round a number? - This is what I don't understand. The task of the function is to convert it from

from one format to another and do not "mold" or add anything from yourself there. But it also "improves" something.

Do you know the difference between a number and a number?
 
Chiripaha:

I apologise - I assumed I might be misunderstanding. Tried to clarify, but the effect is still there. - It's my fault, sorry.

I need not just a digit (3rd, 4th, etc. after the decimal point), but the entire digit up to and including the 2nd, 3rd or 4th decimal point. BUT! without rounding.

And the problem is that when I put the digit back into Double type, it rounds up again.

And the whole thing is, that even if that digit in a stupid big way translates one letter at a time first in String type, and then translates it to Double,

it'll round up again. - This is the irony of the situation. Why does StrToDouble() round a number? - This is what I don't understand. The task of the function is to convert it from

from one format to another and do not "mold" or add anything from yourself there. But it also "improves" something.

One has to develop the ability to "hear"! :))
 

: )))))))) Yes - that's right. All reproaches accepted! - For that I apologise again. - It's all the consequences of a strongly developed (by special exercises)

creative, imaginative, poetic etc. side - all the same, there are two hemispheres in a human being: creative and rational. My fault is that I saw it and did not correct it.

So all your claims are to the point and I am guilty.

But only the question remains unresolved...

How to resolve it in the end?

If you think I haven't heard something, please clarify. I understand the feedback technique (for being able to "hear"), but I haven't seen a solution yet.

How to get the right number without rounding in Double, up to 3rd decimal place, for example in the value of Ask = 1,20667 ?- A solution like "StrToDouble(DoubleToStr(Ask,3)) = 1,2100 // 1,2100 is the result (i.e. rounding)" didn't work.

Thank you in advance for your tolerance and understanding.

 
Zhunko:
Do you know the difference between a number and a number?


: )) Yes, of course I understand the difference. But in an apologetic and clarifying post I made that blunder anyway (How to get the right number without rounding...), had to correct (and didn't immediately notice). It's not a misunderstanding, it's the other side of developing imagery. Alas - this is its cost. When they say "living dead" or something similar, it also makes no sense. But without it, it is impossible to perceive the essence of things figuratively. I mean that it is normal. Don't judge. : ) It's not good to take things literally either. - I will try, including with your help, to correct my communication. Together we will make life better and more perfect. Thank you for your comments!
Reason: