NormalizeDouble

 

Dear MQL5 Developers,

in MQL4 there is an annoying thing: every time I work with doubles, I have to use NormalizeDouble function to compare them, and before I set as parameter of a trading function.

Is it possible to use double variables without every time normalizing (for example compare them)?
And could you automte that in trading fuctions?

Indicator and EA developer's work could be easier. 

Thanks,
Peter 

Documentation on MQL5: Conversion Functions / NormalizeDouble
  • www.mql5.com
Conversion Functions / NormalizeDouble - Documentation on MQL5
 
apspot:

Dear MQL5 Developers,

in MQL4 there is an annoying thing: every time I work with doubles, I have to use NormalizeDouble function to compare them, and before I set as parameter of a trading function.

Is it possible to use double variables without every time normalizing (for example compare them)?
And could you automte that in trading fuctions?

Indicator and EA developer's work could be easier. 

Thanks,
Peter 

Hi apspot,

you will find this issue in every single programming language. 

When I compare two prices, I always convert to points:

//not
if (price1==price2)
{
// ...
}

// much better
if(MathRound((price1-price2)/_Point)==0)
{
// ...
}

Paul

 

 

Reason: