You are trying to OP_BUYLIMIT above current price.
Try with OP_BUYSTOP.
Also, you might need to normalize your prices since they are calculated.
You are trying to OP_BUY above current price.
Try with OP_BUYSTOP.
Also, you might need to normalize your prices since they are calculated.
What do you mean "to normalize"?
A buy_limit operation is used to set a price below current price and buy if it goes down there. I think you are misoperating the command.
See NormalizeDouble().
why?
read https://docs.mql4.com/trading/OrderSend carefully...
A buy_limit operation is to set a price below current price and buy if it goes down there. I think you are misoperating the command.
Hi!
I've got some similar problem with an order of type Instant Market Sell .
I wrote a sample expert adviser and the problem is this part :
double p = Bid; int tN = OrderSend(Symbol(),OP_SELL,0.1,p,50,NormalizeDouble(p+1000*Point,Digits),0); if(tN > 0){ Alert("Done"); }else{ Alert(ErrorDescription(GetLastError())); }
This alerts "invalid stops".
But an order of type OP_SELLLIMIT with exactly same parameters executes with no problem.
I tried different values for stop loss, ranging from 0-Points to 1000-Points and different slippages.
I'm using a demo account with spread 0 and MarketInfo(Symbol(),MODE_STOPLEVEL) returns 0
Help me please!
Thanks a lot
Hello,
I am getting Error:
EURUSD,H4: OrderSend failed with error #130
void OnTick() { H1EMAprev = NormalizeDouble(iMA(NULL,PERIOD_H1,14,0,MODE_EMA,PRICE_CLOSE,1), 5); H4EMAprev = NormalizeDouble(iMA(NULL,PERIOD_H4,14,0,MODE_EMA,PRICE_CLOSE,1), 5); StopLossBuy = High[2] + ((3 * 10) * Point); StopLossSell = Low[2] - ((3 * 10) * Point); if( Close[1]>H4EMAprev && Close[1]>H1EMAprev ) { Price = High[1] + ((3 * 10) * Point); TpOrderOne = Price + ((10 * 10) * Point); //Pending order BUY Ticket1 = OrderSend(Symbol(),OP_BUYSTOP,1,Price,3,StopLossBuy,TpFirstOrder,"Pending Buy Order 1",16384,0,clrGreen); if(Ticket1<0) { Print("OrderSend failed with error #",GetLastError()); } else { Print("OrderSend placed successfully"); } } if( Close[1]<H4EMAprev && Close[1]<H1EMAprev ) { Price = Low[1] - ((3 * 10) * Point); TpOrderOne = Price - ((10 * 10) * Point); //Pending order BUY Ticket1 = OrderSend(Symbol(),OP_SELLSTOP,1,Price,3,StopLossSell,TpFirstOrder,"Pending Buy Order 1",16384,0,clrGreen); if(Ticket1<0) { Print("OrderSend failed with error #",GetLastError()); } else { Print("OrderSend placed successfully"); } }
Experts Please guide where I am doing mistake?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have code like this: It's part of EA. Whan I run this EA I receive:
2008.03.25 20:59:39 My_EA EURUSD,M1: No buy ticket # :( Error=130 Type=OP_BUYLIMIT
It is even when SL is 50 pips.
Help, please...