call GetPrices( symbol, lots, &bid, &ask );
if( openOrder is a buy )
price = bid;
price = ask;
call CloseOrder( orderId, price, lots );
The CloseOrder call always returns an error of 2 (RET_ERROR).
I have tried inserting a ::Sleep( 5000 ) between the GetPrices call and the CloseOrder call, but I get the same result.
If I set the close price manually, without calling GetPrices, the CloseOrder call works fine. Any suggestions?