Error 130

 

Hi

I am a newbie and testing my EA, but if I want to set up the takeprofit level to Ask+50*point I get always error code 130. I wrote an ordersend script to test what the problem is:

int start()

{

RefreshRates();
int Ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,2,0,Ask+50*Point);
if (Ticket<0)
Alert("hibakód:",GetLastError());
return;

}

It works if I change Ask+50*Point to 0, otherwise error 130. I really dont understand why :( If you have any idea please write me. Thank you!

 

Is your Broker an ECN type Broker ? You probably have to set SL and TP to 0 when you open the order then do an OrderModify to set your TP and SL . . .

Have a read here: http://crum.be/ecn

 

Thank You RaptorUK! I am pretty sure that is the problem. I have tried to change my ordersend script first, but I got this error: - wrong parameters count (20,53). But what is the problem with OrderOpenPrice() I pasted it from your link?!

int start()
{
//----
RefreshRates();
int Ticket=OrderSend(Symbol(),OP_BUY,0.1,Ask,2,0,0);
if (Ticket>-1)
{
OrderSelect(Ticket,SELECT_BY_TICKET,MODE_TRADES);
OrderModify(Ticket,OrderOpenPrice(),0,Ask+50*Point);
}
return;
}

 

I think your OrderModify is where the problem lies, you need to add expiration - Pending order expiration time.

https://docs.mql4.com/trading/OrderModify

 
Yes, you are absolutely right. I am very grateful, thanks a lot :)
 
Reason: