puncher:
It always have 8 places after decimal point [...]
Does anybody know how to check the real decimal places for the current Symbol() instead of Digits function ?
MarketInfo(symbol, MODE_DIGITS)
What are differences between Digits and MarketInfo(symbol, MODE_DIGITS) functions ?
Are not the same functions ?
It always have 8 places after decimal point but you will see only 1,3 or 5 decimal places. [...] What is going on?
You are mixing up things which are unrelated - and the problem with your EA is almost certainly different to what you think it is.
NormalizeDouble() changes the value of a number to a given level of precision. It is not a display-formatting function. The simplest way of expressing it might be to say that it takes a number such as 1.23449999999999 and rounds it to 1.2345000000000.
When you do something like Alert("Bid price: " + Bid) that is equivalent to Alert("Bid price: " + DoubleToStr(Bid, 8)). The output is unrelated to, and unaffected by, the number of digits used for quotes on the symbol. DoubleToStr() changes how a number is displayed, without altering its value. NormalizeDouble() changes the actual value of a number.
In your example code above, NormalizeDouble(Bid, Digits) makes no sense because the price is already guaranteed to be rounded to that number of digits. What you are trying to do is to change how the number is displayed. You should be using DoubleToStr(Bid, Digits).
Why Broker has 1, 3 or 5 Digits
JPY has 2 or 3 All the other currency pairs have 4 or 5. But when you just Print a double you get the minimum number of digits necessary up to four.
So Print(1.200000) prints as 1.2 and Print(1.234567) prints 1.2346 (rounded. )
But Print(DoubleToString(1.20,5)) prints 1.20000 and Print(DoubleToString(1.234567,5)) prints 1.23456 (1.234567 truncated to 1.23456
Print(NormalizedDouble(1.234567,5) prints 1.2346 (1.234567 normalized is 1.23457 and that displays as 1.2346)
Print, Alert, or Comment all work the same.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have made simple script which give me the information about the decimal places after decimal point and Digits function.
I have strange result for http://www.fxcm.co.uk/ BROKER.
It always have 8 places after decimal point but you will see only 1,3 or 5 decimal places.
In result my EA does not work with this broker. I have the following error:
Does anybody know how to check the real decimal places for the current Symbol() instead of Digits function ?
This is my script:
//| AktualnaCena.mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| script program start function |
//+------------------------------------------------------------------+
int start()
{
//----
Alert(Symbol()+" Ask: "+NormalizeDouble(Ask,Digits)+" /Bid: "+NormalizeDouble(Bid,Digits)+" Digits: "+Digits);
//----
return(0);
}
//+------------------------------------------------------------------+
What is going on?