How to get number with decimal place [need help]

 

i am creating an one click trading

the question is .... how to get number with decimal place  ?

for point, no decimal place => okay

   TakeProfitPoint = (int)StringToInteger(ObjectGetString(0,"ButtonEditTpPoint",OBJPROP_TEXT));
   ChartRedraw();
   Print("ButtonEditTpPoint : ", DoubleToString(TakeProfitPoint,0));

 for sl / tp target, 

the result come out with decimal place, but can't get those decimal place for result.

let say i keyin 1.12345, result out with 1.00000

   TakeProfitDecimal = (int)StringToInteger(ObjectGetString(0,"ButtonEditTpDecimal",OBJPROP_TEXT));
   ChartRedraw();
   Print("ButtonEditTpDecimal : ", DoubleToString(TakeProfitDecimal,5));

 

so, what should i add or i miss something there ? 

 

I don't understand what you want!

In case you have e.g. 1.23456 do you want 1, or 1.23456 or 23456?

Your code converts the double 1.23456 to an integer so you get 1.

 
gooly:

I don't understand what you want!

In case you have e.g. 1.23456 do you want 1, or 1.23456 or 23456?

Your code converts the double 1.23456 to an integer so you get 1.

the whole number which i keyin, 

[ 1.12345 ] is what i want.

 
gooly:

I don't understand what you want!

In case you have e.g. 1.23456 do you want 1, or 1.23456 or 23456?

Your code converts the double 1.23456 to an integer so you get 1.

StringToDouble

is what i need ? 

 

If I understand your request: you have an edit box where you manually enter a price. You then want to use this price as an order TP?

If so, this should do what you ask:

// TakeProfitPoint = (int)StringToInteger(ObjectGetString(0,"ButtonEditTpPoint",OBJPROP_TEXT));
TakeProfitPoint = NormalizeDouble((double)ObjectGetString(0,"ButtonEditTpPoint",OBJPROP_TEXT),Digits));

Note: make sure that TakeProfitPoint is declared as a double.

 
honest_knave:

If I understand your request: you have an edit box where you manually enter a price. You then want to use this price as an order TP?

If so, this should do what you ask:

Note: make sure that TakeProfitPoint is declared as a double.

thanks, done for this part.

 i created edit box tp / sl for pips and for decimal price.

Reason: