Store OrderTakeProfit in an extern variable

 

Hello. Can someone help me out here. 

I'm trying to store the OrderTakeProfit() in an extern variable. Most of the time it work's fine. but sometime the value is something like 1.325329999999999999. How do i prevent the 9999999999 to get stored?

 

Floating-point has an infinite number of decimals, it's your not understanding floating-point and that some numbers can't be represented exactly. (like 1/10.)
          Double-precision floating-point format - Wikipedia, the free encyclopedia

See also The == operand. - MQL4 programming forum

If you want to see the correct number of digits, convert it to a string with the correct/wanted accuracy.
          question about decima of marketinfo() - MQL4 programming forum 2016.05.18

 
NormalizeDouble(#########,_Digits)
NormalizeDouble(#########,_Digits)
 
amando:
NormalizeDouble(#########,_Digits)

That won't necessarily store it with the same amount of _Digits.

See William's answer.

 
Thank you William