NormalizeDouble paradox - page 10

 
barabashkakvn:
Everything comes gradually. First you have to remember that sentences are written in capital letters and that the chopped verse style is in no way suitable for a forum. Then it will work itself out with normalisation and indexing from scratch.

I've been waiting for this comment )))))

 

there's nothing more natural than typing fast in a chat room style - one line

it's as natural as counting from 1.

and rounding a number to get it rounded the same way.

come on, where's your stream of sarcastic comments filled with formalism?

Life is more than properly spaced dots and commas and binary formats.

it's the flow of feeling and it's supposed to be beautiful.

it's freedom and creativity.

what is your answer to this?

 
transcendreamer:

You're all making fun of me, aren't you?

I just needed to type a fractional number without rubbish

and you're proving me wrong.

mql isn't an end in itself, it's a tool.

I think there are some obvious things, like - if you put a number into a variable, you print it out as you put it in...

it doesn't matter how it's arranged internally or how the number is stored, it's system level

and it's obvious that these tails are nonsense and an application level flaw - non-friendly

But here again we get some programmer joke: "this is not a bug, this is a feature".

these jokes did not appear for nothing, not for nothing ))))))))

NormalizeDouble() is needed when sending calculated parameters as prices in trade orders. You can send Ask and Bid prices without normalization, because they are already normalized to the necessary digit capacity. If you calculate prices, for example for a Bid-stopLoss*Point, then this expression requires normalization. Prices for pending orders are the same as well: you calculate them beforehand, so they must be normalized.

When you compare two real numbers, you need to compare their normalized difference to zero or to the minimum value.

When you want to see what you have calculated, use DoubleToString() with the accuracy you want. IntegerToString() with the parameters you want.

This is something you should understand and learn.

 
transcendreamer:

there's nothing more natural than typing fast in a chat room style - one line

it's as natural as counting from 1.

and rounding a number to get it rounded the same way.

come on, where's your stream of sarcastic comments filled with formalism?

Life is more than properly spaced dots and commas and binary formats.

it's the flow of feeling and it's supposed to be beautiful.

it's freedom and creativity.

what do you say to that?

Freedom... and someone is forcibly holding you back?

Creativity ... create, write your own wrappers for yourself for all the MK functions and enjoy the beauty.

 
artmedia70:

NormalizeDouble() is needed when sending calculated parameters as prices in trade orders. You can send Ask and Bid prices without normalization, as they are already normalized to the required digit capacity. If you calculate prices, for example for a Bid-stopLoss*Point, then this expression requires normalization. Prices for pending orders are the same as well: you calculate them beforehand, so they must be normalized.

When you compare two real numbers, you need to compare their normalized difference to zero or to the minimum value.

When you want to see what you have calculated, use DoubleToString() with the accuracy you want. IntegerToString() with parameters you need.

This is something you'd better understand and assimilate.

Yes, I understand it very well, you can't send an order 1.234567 if the quote is a 5-digit number.

about comparing double numbers i've seen references to..... and it's terrible

but as far as I understand it is safe to compare A>B as long as A and B are noticeably different

only if it turns out that if, for example, I explicitly set A=1.23456 and B=1.23456 and if(A==B) gives false, then this is already a crime

 
artmedia70:

NormalizeDouble() is needed when sending calculated parameters as prices in trade orders. You can send Ask and Bid prices without normalization, because they are already normalized to the required digit capacity. If you calculate prices, for example for a Bid-stopLoss*Point, then this expression requires normalization. Prices for pending orders are the same as well: you calculate them beforehand, so they must be normalized.

When you compare two real numbers, you need to compare their normalized difference to zero or to the minimum value.

When you want to see what you have calculated, use DoubleToString() with the accuracy you want. IntegerToString() with parameters you need.

This is something you should understand and learn.

print and alert are crooked - I've already understood it
 

What bothers me is that when I calculate a fractional number, normalise it, write it into a variable, then read and normalise it again, I get tails

e.g.

basis[0]=NormalizeDouble(sum_A,2);

GlobalVariableSet("Equity-"+portfolio_id,basis[0]); 

...

current=NormalizeDouble(GlobalVariableGet("Equity-"+portfolio_id),2);

text = "Positions synchronized at " + current + " for portfolio: " + portfolio_name;

if(!automatic) MessageBox(text,""); else Print(text);

Now I've changed it to

text = "Positions synchronized at " + DoubleToStr(current,2) + " for portfolio: " + portfolio_name;

if(!automatic) MessageBox(text,""); else Print(text);

and there do not seem to be any tails, whew, whew, whew...

 

more precisely - in the original version it was (string)current

i.e. conversion of a normalized number left tails

sometimes (not always)

 

the problem of comparing two doubles arises if, for example, one number is a constant and the other is calculated by dividing/multiplying

 

Anyway thanks again for wasting your time on a hopeless humanitarian, if I'm annoying anyone, sorry again, I'm just saying what I think without malice.

Good news in the meantime.