Doubt with 5 digit broker

 

Hi everybody, I'm using a 5 digit broker. When I use the function

Print(Low[0])

I see 4 digit, for instance 1.3147.

If I write

string value=DoubleToStr(Low[0],5);

Print(value) ;

Low[0] is 1.31467.

My doubt is: when I write Low[0] in an expert, the returned value is 1.3147 or 1.31467?

Thank you!

 

of course 1.31467

try something like this & u will have the answer

double PriceTest = 1.31467;

if (Low[0] > PriceTest)
   {
   Alert ("X");
   }
else
   {
   Alert ("Y");
   }
 

Thank you!

Yes Low[0] is 5 digit :-)

 
Alberto_jazz:

Hi everybody, I'm using a 5 digit broker. When I use the function

I see 4 digit, for instance 1.3147.


From the manual ... (the last line shown is what you need)

void Print( ...)
Prints a message to the experts log. Parameters can be of any type. Amount of passed parameters cannot exceed 64.

Arrays cannot be passed to the Print() function. Arrays should be printed elementwise.

Data of double type are printed with 4 decimal digits after point. To output more precisely, use the DoubleToStr() function.
 
//++++ These are adjusted for 5 digit brokers.
int     pips2points;    // slippage  3 pips    3=points    30=points
double  pips2dbl;       // Stoploss 15 pips    0.015      0.0150
int     Digits.pips;    // DoubleToStr(dbl/pips2dbl, Digits.pips)
int     init(){
     if (Digits % 2 == 1){      // DE30=1/JPY=3/EURUSD=5 forum.mql4.com/43064#515262
                pips2dbl    = Point*10; pips2points = 10;   Digits.pips = 1;
    } else {    pips2dbl    = Point;    pips2points =  1;   Digits.pips = 0; }
    // OrderSend(... Slippage.Pips * pips2points, Bid - StopLossPips * pips2dbl
:
string  PriceToStr(double p){
    string pFrc = DoubleToStr(p, Digits);       if(Digits.pips==0) return(pFrc);
    string pPip = DoubleToStr(p, Digits-1);
    if (pPip+"0" == pFrc)       return(pPip);           return(pFrc);          }
Reason: