Every month we send a complete and free functional mt4/5 module via email, which can be used as an idea or directly by our customers in their trading system.
The integration should not be a problem for beginners in the MQL programming language.
As always, make a backup first of the original files! Or even use a separate test installation. No warranty, no support!

Example:

//+-----------------------------------------------------------------------------------------------------------------------+
//| CloseAllOrders from symbol, repeat as long as orders are open                             |
//+-----------------------------------------------------------------------------------------------------------------------+

#property copyright "Copyright © 2004- IXBONE/Michael Orth"
#property link "https://ixbone.com"
#property strict

    void CloseAllOrders() {
       bool res, result;
       bool repeat = true;
       while ( repeat )  {
          result = true;
          for ( int i = OrdersTotal()-1; i >= 0; i-- ) {
             if ( OrderSelect ( i, SELECT_BY_POS, MODE_TRADES ) )  {
                if ( OrderSymbol() == Symbol()  )  {
                   while ( IsTradeContextBusy() ) Sleep ( 100 );
                   RefreshRates();
                   if ( OrderType() == OP_BUY )  {
                      res = OrderClose ( OrderTicket(), OrderLots(), Bid, 0, Red );
                      if ( !res ) result = false;
                   }         
                   if ( OrderType() == OP_SELL )  {
                      res = OrderClose ( OrderTicket(), OrderLots(), Ask, 0, Red );
                      if ( !res ) result = false;
                   }
                }       
             }
          }
          if ( result ) repeat = false;
       }
    }