Error 129

 
Why would I get error code 129 invalid price when sending a market order ?

thanks in advance

david
 

What are you using for price?

 
Here is my code.... most of which was Cut and pasted...LOL

I have checked it and just don't see what is wrong....


open_cnt = ticket_count();
if(open_cnt == 0)
{
if(dir == "BUY" || dir == "buy" || dir == "Buy")
{
ticket=OrderSend(Symbol(), OP_BUY, Lots, Ask, 3, Ask-(StopLoss*Point), 0, "Open Buy "+MagicNumber, MagicNumber, 0, Green);
Print(" Buy Price ", Ask);
if(ticket>0)
{
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
Print("BUY order opened : ", OrderOpenPrice());
else
Print("Error opening BUY order : ", GetLastError());
}
}
if(dir == "SELL" || dir == "sell" || dir == "Sell")
{
ticket=OrderSend(Symbol(), OP_SELL, Lots,Bid, 3, Bid+(StopLoss*Point), 0, "Open Sell "+MagicNumber, MagicNumber, 0, Red);
Print(" Sell Price ", Bid);
if(ticket>0)
{
if(OrderSelect(ticket, SELECT_BY_TICKET, MODE_TRADES))
Print("SELL order opened : ", OrderOpenPrice());
}
else
Print("Error opening SELL order : ", GetLastError());
}
}
return(0);
}
 

Error 129:

Invalid bid or ask price, perhaps, unnormalized price. After 5-second (or more) delay, it is necessary to refresh data using the RefreshRates function and make a retry. If the error does not disappear, all attempts to trade must be stopped, the program logic must be changed.

Maybe you have stale prices...

if(open_cnt == 0)
{
RefreshRates(); // add this line

 
Ok.. I had that in my close order code but not in my open order, I'll give it a try...
thanks for you input..

david
Reason: