Download MetaTrader 5
To add comments, please log in or register
Publish programs in Code Base. Improve your rating!
Nathan
111
Nathan 2014.07.12 04:29 

Just that question.  Am adding 4/5 digit broker detection to an ea I wrote on a 5 digit broker.  On the 5 digit broker I might send an order with a take profit or a stop loss of say 125 points which would be translated to 12.5 points for the 4 digit broker.  So adding that to the four digit price would give five digits and might cause an error.   Is it typical to just limit the tp or sl on a five digit broker to a multiple of 10 and truncate or round that extra digit off?

Thanks,

Alain Verleyen
Moderator
28651
Alain Verleyen 2014.07.12 07:41  

You have to normalize your price. See documentation of OrderSend.

Calculated or unnormalized price cannot be applied. If there has not been the requested open price in the price thread or it has not been normalized according to the amount of digits after decimal point, the error 129 (ERR_INVALID_PRICE) will be generated.

whroeder1
13641
whroeder1 2014.07.12 13:22  
niqmadu: I might send an order with a take profit or a stop loss of say 125 points which would be translated to 12.5 points for the 4 digit broker.  So adding that to the four digit price would give five digits and might cause an error.   Is it typical to just limit the tp or sl on a five digit broker to a multiple of 10 and truncate or round that extra digit off?
  1. You have to adjust for 4/5 digit brokers Pips to points so your original SL of 12.5 Pips becomes 125 points on a 5 and 12.5 points on a four. 
  2. You don't need to normalize price, except for pending order open price.
/
To add comments, please log in or register