Receiving error messages for non-existent errors.

 
Afternoon all

Bit of a silly one here, but I have an EA which works fine, however I'm receiving error messages for errors which are non-existent. 

My EA closes half of my position when I reach 200 pips in the money whilst simultaneously moving the s/l to breakeven. 

The system does this flawlessly, but I'm getting the Error message #5020 (through the MessageBox() function) which is a ERR_FILE_NOT_EXIST runtime error. I suspect this is due to some files being .MQH files, but even those files are executing flawlessly too, plus I'm getting duplicate logs on actions which were not carried out more than once on the terminal. 

Below is the condensed version of the code and the MQH files, all fully compiled, deployable and replicable if you choose.

If you do want to replicate this, move this to a 1m chart and an order will open on the next bar opening. 
//+------------------------------------------------------------------+
//|                                                       common.mq4 |
//|                        Copyright 2022, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#include <global_declarations_sample.mqh>
#include <orderModifyFailure.mqh>
#include <orderPartialCloseFailure.mqh>
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---

BarTime                 =  Time[0];
   
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---

BuyMod                        =  true;
breakeven                     =  200;
LotSize                       =  6;
numberLotsToClose             =  MathFloor(LotSize * partialCloseLotsNum / partialCloseLotsDen);

if(BarTime != Time[0]){

   bool OpenShort = OrderSend(Symbol(),OP_SELL,LotSize,MarketInfo(Symbol(),MODE_BID),100,shortStopLoss,shortTakeProfit,
"Comment" ,Period(),0,sellcolor);

}

   ordersTotal = OrdersTotal();
      
      for(int b=ordersTotal-1; b>=0; b--){
      
         if(OrderSelect(b,SELECT_BY_POS,MODE_TRADES)==true){
         
            RefreshRates();
            
               if(OrderTicket() > 0)
               
                  if(OrderSymbol() == Symbol()){
         
                     double   bid         = Bid;
                     double   targetBid   = 0;
                     double   aNewSLPrice =  NormalizeDouble(OrderOpenPrice(),Digits);
               
                        if(broker_stop_level > breakeven)
               
                           targetBid = OrderOpenPrice() + ((broker_stop_level+1) * Point);
         
                           else
         
                           targetBid = OrderOpenPrice() + ((breakeven+broker_stop_level+1) * Point);
         
                           double   aCurrentSL  =  NormalizeDouble(OrderStopLoss(),Digits);
                           int      aTicket     =  OrderTicket();
               
                              if(OrderType() == OP_BUY)
                              
                                 if(bid > targetBid)
                              
                                    if(Symbol()==OrderSymbol())
                              
                                       if(DoubleToStr(aNewSLPrice,Digits) != DoubleToStr(aCurrentSL,Digits)){
            
                                          PrintFormat("BuyMod OrderOpenPrice %7.5f Bid %7.5f aNewSLPrice %7.5f",OrderOpenPrice(),bid,aNewSLPrice);
                     
                                             BuyMod = OrderModify(aTicket,OrderOpenPrice(),aNewSLPrice,OrderTakeProfit(),0,buycolor);
                                       
                                                if(!BuyMod){
                                                
                                                   orderModifyFailure();
                                                
                                                }
                           
                                                partialOrderClose = OrderClose(aTicket, numberLotsToClose, Bid, 300, clrNONE);
                                                
                                                   if(!partialOrderClose){
                                                   
                                                      orderPartialCloseFailure();
                                                   
                                                   }
                     
   
                                       }
               
                  }
         
         }
      
      }
   
  }

This was the last log I received today, as you can see, there are a few duplicate actions when each action was carried out once, i.e;

0       14:33:03.419    '6846142': modify order #106684376 sell 6.00 GBPCAD at 1.61349 sl: 1.61445 tp: 1.60966 -> sl: 1.61349 tp: 1.60966
0       14:33:03.419    '6846142': modify order #106684376 sell 6.00 GBPCAD at 1.61349 sl: 1.61445 tp: 1.60966 -> sl: 1.61349 tp: 1.60966
0       14:33:03.591    '6846142': order #106684376 sell 6.00 GBPCAD at 1.61349 was modified -> sl: 1.61349 tp: 1.60966
0       14:33:03.591    '6846142': order #106684376 sell 6.00 GBPCAD at 1.61349 was modified -> sl: 1.61349 tp: 1.60966
0       14:33:03.591    '6846142': close order #106684376 sell 3.00 GBPCAD at 1.61349 sl: 1.61349 tp: 1.60966 at price 0.00000
0       14:33:03.591    '6846142': close order #106684376 sell 3.00 GBPCAD at 1.61349 sl: 1.61349 tp: 1.60966 at price 0.00000

As standard practice, I'm printing errors when bool functions return false (or return thing thing you don't want it to return) with the GetLastError() function (although it's returning the Runtime Error #0 in the log).

(Note: "Trade Notification Message (TNM) feature's not included in this example)

The full log is as follows; 
0       14:00:00.074    '6846142': order sell market 6.00 GBPCAD sl: 1.61445 tp: 1.60966
0       14:00:00.183    '6846142': order was opened : #106684376 sell 6.00 GBPCAD at 1.61349 sl: 1.61445 tp: 1.60966
0       14:00:00.339    Notifications: 'order opened #106684376 sell 6.00 GBPCAD at 1.61349 sl: 1.61445 tp: 1.60966, <Account Name>' sent to '<MT4 App Identifier>'
0       14:00:01.840    Mail: 'Trade Notification Message (TNM) for #106684376' has been sent
0       14:33:03.419    '6846142': modify order #106684376 sell 6.00 GBPCAD at 1.61349 sl: 1.61445 tp: 1.60966 -> sl: 1.61349 tp: 1.60966
0       14:33:03.419    '6846142': modify order #106684376 sell 6.00 GBPCAD at 1.61349 sl: 1.61445 tp: 1.60966 -> sl: 1.61349 tp: 1.60966
0       14:33:03.591    '6846142': order #106684376 sell 6.00 GBPCAD at 1.61349 was modified -> sl: 1.61349 tp: 1.60966
0       14:33:03.591    '6846142': order #106684376 sell 6.00 GBPCAD at 1.61349 was modified -> sl: 1.61349 tp: 1.60966
0       14:33:03.591    '6846142': close order #106684376 sell 3.00 GBPCAD at 1.61349 sl: 1.61349 tp: 1.60966 at price 0.00000
0       14:33:03.591    '6846142': close order #106684376 sell 3.00 GBPCAD at 1.61349 sl: 1.61349 tp: 1.60966 at price 0.00000
0       14:33:03.716    Notifications: 'order #106684376 sell 6.00 GBPCAD at 1.61349 modified: sl: 1.61445 tp: 1.60966 -> sl: 1.61349 tp: 1.60966' sent to '<MT4 App Identifier>'
0       14:33:03.763    '6846142': order #106684376 sell 3.00 GBPCAD at 1.61349 sl: 1.61349 tp: 1.60966 closed at price 1.61145
0       14:33:03.763    '6846142': remainder of order #106684376 was opened : #106685771 sell 3.00 GBPCAD at 1.61349 sl: 1.61349 tp: 1.60966
1       14:33:03.763    '6846142': order #106684376 sell 3.00 GBPCAD closing at 0.00000 failed [Common error]
0       14:33:03.872    Notifications: 'order #106684376 sell 3.00 GBPCAD at 1.61349 closed at price 1.61145, to #106685771, profit: 379.78 GBP' sent to '<MT4 App Identifier>'
0       14:33:03.919    Notifications: 'order opened #106685771 sell 3.00 GBPCAD at 1.61349 sl: 1.61349 tp: 1.60966, from #106684376' sent to '<MT4 App Identifier>'
0       14:35:50.179    Notifications: 'Your position has failed to partially close. Please report Error Code #0' sent to '<MT4 App Identifier>'
0       14:35:50.226    Notifications: 'Ticket #106684376 has closed with a profit of 379.78' sent to '<MT4 App Identifier>'
0       14:35:51.539    Mail: 'Trade Notification Email for #106684376' has been sent

Has anyone else come across this issue or am I missing something obvious? 

Many thanks,