Need help working with decimals

Hi,
I am working with decimal numbers and want my indicator to read just the first 3 decimal places of the Bid quote.

Example: GBPUSD Bid is 1.61266 - I want to have a=1.612
I tried NormalizeDouble(Bid,3) and DoubleToStr(Bid,3), i am always getting the result rounded up to 1.613.

Is there a function so i get just 3 decimal digits without rounding up or down?

MQL4 can be frustrating when trying to do what should be a simple thing like truncation. Try to do it by converting to a string then truncate the string to 3 decimals then convert back to double. Something like StringSubstr( DoubleToStr (Bid, 5), 0, 5);

y=MathFloor(x*1000)/1000;

Worked!
Thanks a lot CodeMeister

Hi again,

Here is the code that i was working on. It might be of interest to you maybe. it increases the size of the pips in the quotes and reduces the size of the 5th digit. I personally prefer to see the bid/ask this way.
I am still trying to add a background that it changes color to Red if the current Bid is lower than the previous Bid and Blue vice versa but i am not able to figure out how to get the previous bid rate! any idea??

Cheers!

//-- Bid
string a= StringSubstr(DoubleToStr(Bid,5),0,4);
string b= StringSubstr(DoubleToStr(Bid,5),4,2);
string c= StringSubstr(DoubleToStr(Bid,5),6,1);

//-- Ask
string d= StringSubstr(DoubleToStr(Ask,5),0,4);
string e= StringSubstr(DoubleToStr(Ask,5),4,2);
string f= StringSubstr(DoubleToStr(Ask,5),6,1);

ObjectCreate(“Bid1”, OBJ_LABEL, 0, 0, 0);
ObjectSetText(“Bid1”,a, 14, “Arial Bold”, Black);
ObjectSet(“Bid1”, OBJPROP_CORNER, 1);
ObjectSet(“Bid1”, OBJPROP_XDISTANCE, 142);
ObjectSet(“Bid1”, OBJPROP_YDISTANCE, 38);

ObjectCreate(“Bid2”, OBJ_LABEL, 0, 0, 0);
ObjectSetText(“Bid2”,b, 20, “Arial Bold”, Black);
ObjectSet(“Bid2”, OBJPROP_CORNER, 1);
ObjectSet(“Bid2”, OBJPROP_XDISTANCE, 111);
ObjectSet(“Bid2”, OBJPROP_YDISTANCE, 30);

ObjectCreate(“Bid3”, OBJ_LABEL, 0, 0, 0);
ObjectSetText(“Bid3”,c, 8, “Arial Bold”, Black);
ObjectSet(“Bid3”, OBJPROP_CORNER, 1);
ObjectSet(“Bid3”, OBJPROP_XDISTANCE, 103);
ObjectSet(“Bid3”, OBJPROP_YDISTANCE, 30);

ObjectCreate(“Ask1”, OBJ_LABEL, 0, 0, 0);
ObjectSetText(“Ask1”,d, 14, “Arial Bold”, Black);
ObjectSet(“Ask1”, OBJPROP_CORNER, 1);
ObjectSet(“Ask1”, OBJPROP_XDISTANCE, 59);
ObjectSet(“Ask1”, OBJPROP_YDISTANCE, 38);

ObjectCreate(“Ask2”, OBJ_LABEL, 0, 0, 0);
ObjectSetText(“Ask2”,e, 20, “Arial Bold”, Black);
ObjectSet(“Ask2”, OBJPROP_CORNER, 1);
ObjectSet(“Ask2”, OBJPROP_XDISTANCE, 28);
ObjectSet(“Ask2”, OBJPROP_YDISTANCE, 30);

ObjectCreate(“Ask3”, OBJ_LABEL, 0, 0, 0);
ObjectSetText(“Ask3”,f, 8, “Arial Bold”, Black);
ObjectSet(“Ask3”, OBJPROP_CORNER, 1);
ObjectSet(“Ask3”, OBJPROP_XDISTANCE, 20);
ObjectSet(“Ask3”, OBJPROP_YDISTANCE, 30);