OrderSend() error

 

Hi experts,

my EA places in function start a simply Buy order


Price = Ask - 200 * Point;
targetlevel = Ask + 200 * Point;
Print("Ask=",DoubleToStr(Ask,5)," price=",DoubleToStr(Price,5)," target=",DoubleToStr(targetlevel,5));


orderidBuyLmt=OrderSend(Symbol(),OP_BUY,1,Price,20,0,targetlevel,"",0,0,Blue);


if(orderidBuyLmt <= 0)
PrintLastError();


// this is what the log tells

21:41:08 test_ea4 EURUSD,M1: Ask=1.30332 price=1.30132 target=1.30832
21:41:08 test_ea4 EURUSD,M1: error=129


// 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.


so, i don't understand this. what's wrong with my order ? all prices are ok and Ask obviously not "invalid".

any help welcome.

thank you

 

Such a good guy. I want to buy EURUSD by 1.0000 as well.:-)

Seriously, you have to use Ask and Bid for BUY and SELL orders.

 
Roger:

Such a good guy. I want to buy EURUSD by 1.0000 as well.:-)

Seriously, you have to use Ask and Bid for BUY and SELL orders.

Thank you Sir,

i am blond, you know...

ok,this works

orderidBuyLmt=OrderSend(Symbol(),OP_BUY,1,Ask,20,0,targetlevel,"",0,0,Blue);