Shorten # of digits in a variable.

 

I'm getting ordersend errors because of an invalid price - probably too many digits.

So, how do I shorten 1.68873542432 to 1.6887?

 
Calpurnia:

I'm getting ordersend errors because of an invalid price - probably too many digits.

So, how do I shorten 1.68873542432 to 1.6887?

See NormalizeDouble().

 
What does Point do?
 
Calpurnia:
What does Point do?

Point is a pip expressed as a decimal price (eg. 0.0001). Use it for example as a multiplier to turn a stop from a relative number of pips into a relative price which becomes an absolute stop value when added to, or subtracted from an absolute price.

Digits is the number of decimal places used in the prices for the current symbol. (eg. 4). Use it when normalizing double precision integers in order to avoid the problems you have just experienced.


CB

 

I've tried using normalizedouble and it does round to the decimal point that I set. However, i am still getting invalid price when it tries to do an order. Basically, now instead of 1.68423324242, it says 1.6420000000. I'm getting error 130 and error 4107. How can i fix that?

 
Calpurnia:

instead of 1.68423324242, it says 1.6420000000

You see, now I'm going to back off, as your accuracy is suspect. Based upon your first figure, I'm thinking you mean 1.6842 as opposed to 1.642.

130 is invalid stops as opposed to invalid price.


CB

Reason: