How Normalize() is calculated?

 

Hello,

Does anybody know how Normalize() or NormalizeDouble() is calculated? I want to know the internal calculation of this function.

If you have a spare time, could you forward this question to MetaQuotes forum? They banned me last time. If possible, ask them how to rewrite the Normalize() function in C

Thanks in advance,

 

I just posted it there in the english forum , thread : How Normalize() is calculated? Waiting for an answer, which I suppose can take up till monday, since it is weekend and tech support teams have a weekend.

 

Scorpion, if you are banned , it means that you can`t read the forum at all ? Or you can`t just post it ?

Here is the thread I started :

https://www.mql5.com/en/forum/44678

And here is the first reply :

Shimodax 10.09.05 12:55

Try something like:

// get a one with digit zeros behind/ 10, 100, 1000

double f= 1;

for (int i= 0; i<digits; i++) {

f*= 10;

}

// round it up

double result= (int)(roundwhat*p + 0.5);

result/= p;

Markus

----------------------------------------------------------------------------------

If u can read them, then read on, If not I ll be posting them, just tell me.

 

Hey,

Ravique, thanks! I can read posts at MQ forum though banned. Maybe they trace my ip or something that why they don't approve my new registrations.

Shimodax's calculation is incorrect. The result of his calculation and result of the original Normalize() is different.

It's so weird with the Normalize() implemented in MetaTrader. It's supposed to be banker's rounding, but it isn't.

 

Well Let`s just wait for the MT administrators to answer

 

Hey, borrowing hands is fun! I've just registered a new name; hope the fasis

Shimodax:
I just hacked it up here in the message window (just saw that "p" shoudl be "f"). But I think it will be something like that. However, I just tried this and it gave the same result as NormalizeDouble(d, 4); => Result 1.2346

I'd like to tell him that his algoritm always round up while NormalizeDouble() sometimes round down and up. I've compared a wide range of values and found that his and MetaTrader's vary about 70%.

 

Ravique, they just allowed to me to post now. Thanks for lending me a hand

 

..........

Reason: