Download MetaTrader 5

question about decima of marketinfo()

To add comments, please log in or register
Join MQL5 Cloud Network. Improve your rating!
faustf 2016.05.18 17:34 

hi guy  i  notice  , my  broker  have 5  digit  before  dot  (example  bid or Ask  price 1.25636) ,  but  when i use marketinfo()  MarketInfo(OrderSymbol(),MODE_ASK)   return me only  4  digit ,  why ????

is possible required 5  digit  at  function ???  , exist some option or  trick  for have ???

thankz at all

whroeder1 2016.05.18 18:02  
faustf: is possible required 5  digit  at  function ???
  1. If you do not use #property strict, Print output's 4 digits. With #property strict:
    Data of float type are output with 5 digits after a decimal point. To output real numbers with another accuracy or in a predefined format, use the PrintFormat() function
    Print - Common Functions - MQL4 Reference
  2. You don't want to output 5, you want to output what the pair uses. (USDJPY is 2 or 3) Don't assume:
    string price_as_string(double p){return DoubleToStr(p, Digits);  }

faustf 2016.05.18 19:05  

hi @WHRoeder thanks  so much for reaply

i use  #property strict at top of  EA ,  but now i have  a little  bug    , sometime   print  4  digit  some time  5 digit  and  some time  17  digit

you have some idea??  thankz so mcuh

faustf 2016.05.18 20:18  
i  answer me  is normal because  take  a  realtime  price  thankz  and  when  the  price  is  a  0  like  1.5240  the  0  not  consider 
To add comments, please log in or register