- The price you passed to the function was not a current Bid price - 129
void CloseOrders(int index,double price,string fromwhere) { OrderClose(ticket_nos, Lots ,price,My_Slippage,Green); Sleep(My_Sleep); RefreshRates();
If the close fails, what good is the refreshRate. you are still using the original passed in price.{ OrderClose(ticket_nos, Lots ,price,My_Slippage,Green); int my_error = GetLastError();
On a error the internal error variable gets set. GetLastError retrieves the value and reset it. If the OrderClose succeeds, GetLastError could be anything, like an error from ObjectCreate. Test your return codes{ if(OrderClose(ticket_nos, Lots ,price,My_Slippage,Green)) return(0); int my_error = GetLastError();
- If you OrderSelect the ticket first, you need not pass anything OrderClose(OrderTicket(), OrderLots(), OrderClosePrice() ...
- PS used the SRC button - normally get the different colors in the code but not hereSometimes page gets messed up. Select all and copy, previous page and re-click, paste
WHRoeder:
- If you OrderSelect the ticket first, you need not pass anything OrderClose(OrderTicket(), OrderLots(), OrderClosePrice() ...
this seems a lot better. Got the message on the refreshrates (so obvious now)
thanks
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I have been trying to close 2 similar orders one after the the other - one seems to succeed and the other (2nd) fail on more than one occasion.
Both orders would be either Buy or Sell (ie both the same and the price set the same - both ask or bid).
My log looks like the following
88880 2011.09.29 16:15:43 Buy CloseOrders temp_integer = 25 ticket_nos = 235466286 Lots = 0.03 Price (temp1) = 1.36572 from ~ Hedge_Close_Out
Close Orders ~ Unanticipated error: 129 no error
<<<<<<<<<<<<25 times>>>>>
Close Orders ~ Unanticipated error: 129 no error88881 2011.09.29 16:15:45 Buy CloseOrders - Unable to Close ticket_nos = 235466286 Lots = 0.03
Tried to put close orders in this routine to try and make sure proceedure completed correctly.
Anyone any idea why I get this error and one order fails to complete (i.e. close) ?
PS used the SRC button - normally get the different colors in the code but not here