Download MetaTrader 5
To add comments, please log in or register
Your conversation partner speaks foreign language? Automatic translation will help you!
forextime8
194
forextime8 2015.02.11 09:04 

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 ? 

Carl Schreiber
5934
Carl Schreiber 2015.02.11 09:08  

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.

forextime8
194
forextime8 2015.02.11 09:12  
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.

forextime8
194
forextime8 2015.02.11 09:14  
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 ? 

honest_knave
951
honest_knave 2015.02.11 09:49  

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.

forextime8
194
forextime8 2015.02.11 16:37  
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.

/
To add comments, please log in or register