Alertfunction rounded numbers

 

Hi guys,

i was wondering because in Alert functions all numbers are rounded to 4 digits even if the pair has 5 digits.

How can i receive the whole number unrounded?


Thx

 
FamWue:

Hi guys,

i was wondering because in Alert functions all numbers are rounded to 4 digits even if the pair has 5 digits.

How can i receive the whole number unrounded?

Read the documentation:  Alert() 
 
FamWue: How can i receive the whole number unrounded?
Use this and you would have found many entries answering your question.
Alert("Bid=",PriceToStr(Bid)," Spread=",DeltaToPips(Ask-Bid)," pips");
/////////////////////////////////////////////////////////////////////////////////
//++++ These are adjusted for 5 digit brokers.
int      pips2points;                  // slippage  3 pips  3=points 30=points
double   pips2dbl;                     // Stoploss 15 pips  0.0015   0.00150
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
//---- These are adjusted for 5 digit brokers.
   //{On ECN brokers you must open first and THEN set stops
   // int      ticket = OrderSend(..., 0,0,...)
   // if(ticket < 0)
   //    Alert("OrderSend failed: ", GetLastError());
   // else  if(!OrderSelect(ticket, SELECT_BY_TICKET))
   //    Alert("OrderSelect failed: ", GetLastError());
   // else  if(!OrderModify(OrderTicket(), OrderOpenPrice(), SL, TP, 0))
   //    Alert("OrderModify failed: ", GetLastError());
   //}
}
string   PriceToStr(double p){   return( DoubleToStr(p, Digits) );            }
string   DeltaToPips(double d, string sign="+"){
   if(d < 0)   sign = "";
   double   pips = d / pips2dbl;
   return( sign +DoubleToStr(pips, Digits.pips) );                            }
 
FamWue:

Hi guys,

i was wondering because in Alert functions all numbers are rounded to 4 digits even if the pair has 5 digits.

How can i receive the whole number unrounded?

Thx

This will return the 5 digits for the chart that it is attached to.

Try for eg: Alert ("Bid" , DoubletoStr(Bid,5); 

Reason: