ea work fine for all pairs exept on YEN pairs - page 3

 
JC:

I agree with Fernando and whroeder1 that it's rarely "correct" to use NormalizeDouble(), because the vast majority of uses are in relation to prices and lot sizes where the use isn't fully safe. It's helpful at some point to make this clear to people. But, given the realities of what all brokers' statistics say that 99.999% of people trade through MT4, it's usually a lower priority than addressing other issues. Like you said above, the key problem the OP had was hard-coding the price increment, not how they were rounding the price increment.

Telling people not to use NormalizeDouble(), in isolation, is mixing up a technical issue with a market-understanding issue. To appropriate a phrase from, er, elsewhere, it's "mixing apples and oranges".

They don't say "it's rarely correct", they write, repeat, ad nauseum, "it's always wrong". It's what I call "binary thinking", binary thinking is "always wrong" :-D

 

It seems that most did not noticed that the OP was also incorrectly aligning "pip" to tick-size, instead of aligning it to "point", and then completely forgetting about tick-size when it came to the price.

This is what happens when most are not willing to "grab the bull by horns" and just say it plainly IT IS WRONG without needing some long winded defense and tip-toeing around so as not to wake up the "monster". If MetaQuotes had done the job correctly and emphasised the correct usage, there would not be need for this discussion, nor would there be need for me to be angry as hell right now, and users would be coding these things correctly.

How can we expect newbie coders to learn the proper usage, when the System does it incorrectly and the experienced coders have to argue about it, of which only TWO coders (that I know of) myself and @whroeder1 are the only ones that are willing to stand up and keep saying it out loud:

  • It is a kludge! It is useless! If you do things correctly, you don't need it!

And if you want to call it a slogan, then so be it. Its a slogan! Lets all say it out aloud until it sinks in and users start taking note of it and start using their heads and putting in some effort of their own, instead on being mindless drones.

 
Fernando Carreiro:

Why should it be expected of me or any other user, that states that using NormalizeDouble is incorrect or not appropriate, to have to give a long winded History Lesson and a long winded Coding Lesson and a long winded Trading Lesson, when MetaQuotes themselves are perpetuating the incorrect usage.

I learned the correct way by my own knowledge, by my own research. No one taught me! I read the documentation, I read books, I looked at example code and in all of this incorrect usages, I came to my own conclusion that it was wrong based on my previous coding knowledge and experience. That took time and money. My only responsibility is to call others to take note of this incorrect usage and even provided an example of the correct way.

If the user does not understand, then he has the option of either using it blindly (in the same way that he is using NormalizaDouble blindly without really understanding it either), or he can go dedicate some time and effort into researching the subject on his own and coming to his own conclusion as I did.

EDIT: This will be the last time I will tell anyone to use proper tick-size or lot-step alignment. I am fed-up with being constantly called upon this. If you wish to help MetaQuotes perpetuate this "Idiocracy", then please be my guest!

We all know (you, WHRoeder, JC and me) that NormalizeDouble() is not the appropriate way to normalize price or lots. That's not the discussion. 

The point is, if you are fed-up to explain it, posting slogan will not help. We are discussing here, not to attack or offend anyone but to improve the forum. So I would suggest you (or anyone, including me) to not post when are fed up or angry or anything like that. I would suggest you or anyone who want to do it to open a topic, or create a blog post or to publish an article to explain all about the point discussed, and to refer to this with 1 link when needed. 

Fernando Carreiro:

It seems that most did not noticed that the OP was also incorrectly aligning "pip" to tick-size, instead of aligning it to "point", and then completely forgetting about tick-size when it came to the price.

This is what happens when most are not willing the "grab the bull by horns" and just say it plainly IT IS WRONG without needing some long winded defense. If MetaQuotes had done the job correctly and emphasised the correct usage, there would not be need for this discussion, nor would there be need for me to be angry as hell right now, and users would be coding this things correctly.

How can we expect newbie coders to learn the proper usage, when the System does it incorrectly and the experienced coders have to argue about what is the correct usage, of which only TWO coders (that I know of) myself and @whroeder1 are the only ones that keep saying it out loud:

  • It is a kludge! It is useless! If you do things correctly, you don't need it!

And if you want to call it a slogan, then so be it. Its a slogan. Lets all say it out aloud until it sinks in and users start taking note of it and start using the heads and putting in some effort of their own, instead on being mindless drones.

I completely disagree with this way of thinking. I will stop arguing, as you obviously missed the point, the main discussion is not about NormalizeDouble() at all. I would suggest you to read this article about "binary thinking".

 
JC:

It is Print()ing the exact nature of the problem to the Experts log.

ChartXYToTimePrice() can give you fractional prices, at greater granularity than what can be traded. For example, on USDJPY, it can return a price value such as 123.456789. MT4 will reject this. You need to round the price to 123.457 before passing it to OrderSend().

You are doing the following:

You need to change the 5 to the number of digits for the instrument. For example:


you have reason that's the probleme NormaliseDouble !!
 
Alain Verleyen: They don't say "it's rarely correct", they write, repeat, ad nauseum, "it's always wrong". It's what I call "binary thinking", binary thinking is "always wrong" :-D

Using codes, that fail on some symbols, without notice, is wrong. Just as coding a pip as the constant 0.0001 is wrong, it fails on JPY pairs; coding it as 10*_Point is wrong, fails on 4 digit brokers. Using it to normalize by lot step fails if/when you encounter a lot step of say 0.0025 instead of 0.010.

It is binary thinking; code it so it works, correctly, always. Putting known bugs intentionally in your code is "always wrong." :-D

 
whroeder1:

Using codes, that fail on some symbols, without notice, is wrong. Just as coding a pip as the constant 0.0001 is wrong, it fails on JPY pairs; coding it as 10*_Point is wrong, fails on 4 digit brokers. Using it to normalize by lot step fails if/when you encounter a lot step of say 0.0025 instead of 0.010.

It is binary thinking; code it so it works, correctly, always. Putting known bugs intentionally in your code is "always wrong." :-D

The problem, and you know it perfectly (here you admitted there is no problem with NormalizeDouble but with wrong usage), is that your "slogan" doesn't explain anything. Explain things correctly to people, don't flood the forum with "slogan" (I know you always add links, but Fernando didn't do it here, and anyway links are always a kludge to slogan :D)

How hard is that difficult to understand ? What part is unclear ? :-D

 

The links provided are the explanation. What part of them is unclear?

 
whroeder1:

The links provided are the explanation. What part of them is unclear?

I was lost between the 8th and 9th link, after reading the 28th pages. Could you explain me what I have to understand ?

I fixed the code as JC proposed and use it on 28 forex charts (I trade only Forex) and it works well, but it's using NormalizeDouble() while you said to never use it...I am confused.

Thanks for your great contribution on this forum.

 
Alain Verleyen: it's using NormalizeDouble() while you said to never use it...I am confused.

Yes you are confused, because you refuse to think. What part of "Putting known bugs intentionally in your code is "always wrong," is unclear? I've provided many examples why it is wrong for every case traders will in counter.

All you've provided is "slogan" doesn't explain anything," which is nothing.

Define a specific case and I will state why it's use is wrong. It's use is always wrong.

 
whroeder1:

Yes you are confused, because you refuse to think. What part of "Putting known bugs intentionally in your code is "always wrong," is unclear? I've provided many examples why it is wrong for every case traders will in counter.

All you've provided is "slogan" doesn't explain anything," which is nothing.

That's not true, JC gives the answer, my code works fine now. How my code could work as I want and still have bug ?

Define a specific case and I will state why it's use is wrong. It's use is always wrong

I already defined a case. I have an EA, I will use it on Forex only, as I only know this for now. I know how to normalize lot size, so my question is only about price. I learnt from JC I have to use to symbol digits, so it works on Yen pairs or even on 4/5 digits broker. The day I will use it in other circumstances, I will check if it works but as I am only an amateur it's ok for now, I don't want to learn all mql and all markets, just what I need to know. I have no plan to become a professional coder or a professional forum member.

It seems there is no common language for us to communicate. It's a pity.