Download MetaTrader 5
To add comments, please log in or register
Sell your CPU capacity and earn money!
Rohit Ramachandaran
148
Rohit Ramachandaran 2014.08.14 07:37 

What is Error -1

When i try to send an order in gold sometimes i get -1 error and sometimes it is executed.

Any help?? 

 

This is the code i am using to send a buy

void OpenBY()
{
   int li_0;
   if(!IsTradeContextBusy())
   {
      li_0 = OrderSend(Symbol(), OP_BUY, Lots, Ask, Slipage, 0, Ask+TakeProfit*Point, Comments, Magic, 0, Red);
      if(GetLastError() != 0)
         {
            Alert("Last Error is ",li_0);
            Sleep(10000);
            OpenBY();
         }
   }
} 
Alain Verleyen
Moderator
28672
Alain Verleyen 2014.08.14 10:14  
scorpion007net:

What is Error -1

When i try to send an order in gold sometimes i get -1 error and sometimes it is executed.

Any help?? 

 

This is the code i am using to send a buy

Don't check for an error when there is not.

There is only an error when Ordersend returns -1 :

Returned value

Returns number of the ticket assigned to the order by the trade server or -1 if it fails.
whroeder1
13644
whroeder1 2014.08.14 12:30  
int li_0;
Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way we will not be an accomplice after the fact to theft. See also https://www.mql5.com/en/forum/134317
Rohit Ramachandaran
148
Rohit Ramachandaran 2014.08.14 16:22  
WHRoeder:
Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way we will not be an accomplice after the fact to theft. See also https://www.mql5.com/en/forum/134317

This is not a stolen code.

I am a mql4 coder for the last 4 years. 

I am coding this EA.. 

Alain Verleyen
Moderator
28672
Alain Verleyen 2014.08.14 18:18  
WHRoeder:
Decompiled code is stolen code. Either you are a thief, a fence, or the receiver of stolen (intellectual) property. Either way we will not be an accomplice after the fact to theft. See also https://www.mql5.com/en/forum/134317
It's a little light to say it's decompiled code.
/
To add comments, please log in or register