Ask and Bid values

 

I'm having a problem with error 4107 for an Ordersend function. I've printed the Ask and Bid values out immediately before the function and for some reason the values have 8 decimal places instead of 4. If I use Print (Ask," "+ Bid);, the Ask has the correct format, but the Bid doesn't. Any thoughts, thanks.

 
MetaTrada wrote >>

I'm having a problem with error 4107 for an Ordersend function. I've printed the Ask and Bid values out immediately before the function and for some reason the values have 8 decimal places instead of 4. If I use Print (Ask," "+ Bid);, the Ask has the correct format, but the Bid doesn't. Any thoughts, thanks.

It's quite common for values to be non-exact, particularly from historical data and enve more so for stoploss and takeprofit. For robust calling of OrderSend, the entry price, stoploss and takeprofit should all be pruned with something like this

doubleValue=NormalizeDouble(doubleValue,Digits);

Paul

http://paulsfxrandomwalk.blogspot.com/

 
Thanks, is there any reason why I wouldn't want to do this for Ordersend()?
 
MetaTrada:
Thanks, is there any reason why I wouldn't want to do this for Ordersend()?

Prices should be normalized before using with OrderSend() (unless u know they are already normalized).