No Error message with GetLastError()

 

Hello

I am building simple EA for showing Error messages ans numbers as test. The following codes open 2 orders buy and sell, the buy has a big lot 150 and that is so big and when i do it manually it gives me error not enough money, but when i do it as script the error gives 0 and that means there is no error. But i am surprising why error no = 0 and not one of the number in error list and changed the lot with 1 lot and the open price with something different to see different error code but the error shows 0. I dont know the problem why it shows me 0 not any one of the error list.

static int Flag;
   
   if(Flag==0)
    {
    
    int tic=OrderSend(Symbol(),OP_BUY,150,Ask,4,0,0,"My EA",152,0,Green);
    int tic1=OrderSend(Symbol(),OP_SELL,1,Bid,4,0,0,"My EA",152,0,Red);
   
    if(tic>0)
    {
    MessageBox("Buy order opened");
    }
    else{Alert("Error opening Buy order :",GetLastError());}
    
     if(tic1>0)
    {
    MessageBox("Sell order opened");
    }
    else{Print("Error opening Sell order :",GetLastError());}
    
    Flag=1;
     }
   

   
 
static bool isOpenOrders;
   
   if(!isOpenOrders){
    int tic=OrderSend(Symbol(),OP_BUY,150,Ask,4,0,0,"My EA",152,0,Green);
    // Capture GLE before it's clobbered by the sell
    if(tic < 0) Alert("Error opening Buy order :",GetLastError());

    int tic1=OrderSend(Symbol(),OP_SELL,1,Bid,4,0,0,"My EA",152,0,Red);
    // Capture gLE before it's clobbered by messagebox
    if(tic1 < 0) Alert("Error opening Buy order :",GetLastError());
   
    if(tic>0)  MessageBox("Buy order opened");
    if(tic1>0) MessageBox("Sell order opened");

    isOpenOrders = tic > 0 || tic1 > 0;
  }
 
Thank you WHRoeder for helping, really that what i want.