edit the following EA to and add an input to specify how many trades it take at the same time



//+------------------------------------------------------------------+
//|                                               BreakoutScalper.mq5 |
//|                        Scalper EA - trades quick price breakouts |
//+------------------------------------------------------------------+
#property copyright "ChatGPT"
#property link      ""
#property version   "1.00"
#property strict

input double  Lots               = 0.1;                 // Lot size
input int     PointsThreshold    = 100;                 // Move in points to trigger trade
input int     CheckInterval      = 5;                   // Seconds to check price movement
input int     TrailingStopPoints = 50;                  // Trailing stop in points
input int     EAStartHour        = 7;                   // EA start hour (server time)
input int     EAStopHour         = 23;                  // EA stop hour (server time)
input ENUM_TIMEFRAMES PriceTF    = PERIOD_M1;           // Timeframe for reference (for convenience)

//--- Global variables
datetime lastCheckTime = 0;
double   priceAtLastCheck = 0.0;

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   lastCheckTime = TimeCurrent();
   priceAtLastCheck = SymbolInfoDouble(_Symbol,SYMBOL_BID);
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }

//+------------------------------------------------------------------+
//| Check if current time is inside operation window                 |
//+------------------------------------------------------------------+
bool IsWithinTradingTime()
  {
   datetime now = TimeCurrent();
   MqlDateTime tm;
   TimeToStruct(now,tm);

   // Simple check: hour >= EAStartHour and hour < EAStopHour
   if(tm.hour >= EAStartHour && tm.hour < EAStopHour)
     return true;
   else
     return false;
  }

//+------------------------------------------------------------------+
//| Place buy order                                                  |
//+------------------------------------------------------------------+
bool PlaceBuy()
  {
   // Check if position already exists buy side
   if(PositionSelect(_Symbol))
     {
      // Position exists, check type
      if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_BUY)
        return false; // already have buy position
     }

   MqlTradeRequest request;
   MqlTradeResult  result;
   ZeroMemory(request);
   ZeroMemory(result);

   request.action = TRADE_ACTION_DEAL;
   request.symbol = _Symbol;
   request.volume = Lots;
   request.type   = ORDER_TYPE_BUY;
   request.price  = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
   request.deviation = 10;
   request.magic = ExpertHandle();

   if(!OrderSend(request,result))
     {
      PrintFormat("Buy order failed: %s", result.comment);
      return false;
     }
   else
     {
      PrintFormat("Buy order placed at price %.5f", request.price);
      return true;
     }
  }

//+------------------------------------------------------------------+
//| Place sell order                                                 |
//+------------------------------------------------------------------+
bool PlaceSell()
  {
   // Check if position already exists sell side
   if(PositionSelect(_Symbol))
     {
      // Position exists, check type
      if(PositionGetInteger(POSITION_TYPE) == POSITION_TYPE_SELL)
        return false; // already have sell position
     }

   MqlTradeRequest request;
   MqlTradeResult  result;
   ZeroMemory(request);
   ZeroMemory(result);

   request.action = TRADE_ACTION_DEAL;
   request.symbol = _Symbol;
   request.volume = Lots;
   request.type   = ORDER_TYPE_SELL;
   request.price  = SymbolInfoDouble(_Symbol,SYMBOL_BID);
   request.deviation = 10;
   request.magic = ExpertHandle();

   if(!OrderSend(request,result))
     {
      PrintFormat("Sell order failed: %s", result.comment);
      return false;
     }
   else
     {
      PrintFormat("Sell order placed at price %.5f", request.price);
      return true;
     }
  }

//+------------------------------------------------------------------+
//| Implement trailing stop for each position                        |
//+------------------------------------------------------------------+
void ManageTrailingStop()
  {
   for(int i=PositionsTotal()-1; i>=0; i--)
     {
      ulong ticket=PositionGetTicket(i);
      if(PositionGetInteger(POSITION_MAGIC) != ExpertHandle())
         continue; // Only handle EA's own trades

      if(!PositionSelectByTicket(ticket))
         continue;

      ENUM_POSITION_TYPE type = (ENUM_POSITION_TYPE)PositionGetInteger(POSITION_TYPE);
      double position_price_open = PositionGetDouble(POSITION_PRICE_OPEN);
      double position_sl = PositionGetDouble(POSITION_SL);
      double position_volume = PositionGetDouble(POSITION_VOLUME);
      double current_price = 0.0;
      double new_sl = 0.0;

      if(type == POSITION_TYPE_BUY)
        current_price = SymbolInfoDouble(_Symbol,SYMBOL_BID);
      else if(type == POSITION_TYPE_SELL)
        current_price = SymbolInfoDouble(_Symbol,SYMBOL_ASK);
      else
        continue;

      MqlTradeRequest request;
      MqlTradeResult result;
      ZeroMemory(request);
      ZeroMemory(result);

      // Calculate new SL level
      if(type == POSITION_TYPE_BUY)
        {
         // Trailing stop = current price - trailing distance
         new_sl = current_price - TrailingStopPoints * _Point;
         // Only move SL forward upwards
         if(position_sl < new_sl)
           {
            request.action = TRADE_ACTION_SLTP;
            request.position = ticket;
            request.sl = NormalizeDouble(new_sl, _Digits);
            request.tp = PositionGetDouble(POSITION_TP); // keep TP same
            if(!OrderSend(request,result))
              {
               PrintFormat("Trailing stop modification failed (buy): %s",result.comment);
              }
            else
              {
               PrintFormat("Trailing Stop moved up for Buy to %.5f", request.sl);
              }
           }
        }
      else if(type == POSITION_TYPE_SELL)
        {
         // Trailing stop = current price + trailing distance
         new_sl = current_price + TrailingStopPoints * _Point;
         // Only move SL forward downwards
         if(position_sl > new_sl || position_sl == 0.0)
           {
            request.action = TRADE_ACTION_SLTP;
            request.position = ticket;
            request.sl = NormalizeDouble(new_sl, _Digits);
            request.tp = PositionGetDouble(POSITION_TP);
            if(!OrderSend(request,result))
              {
               PrintFormat("Trailing stop modification failed (sell): %s",result.comment);
              }
            else
              {
               PrintFormat("Trailing Stop moved down for Sell to %.5f", request.sl);
              }
           }
        }
     }
  }

//+------------------------------------------------------------------+
//| Check price speed and trade accordingly                          |
//+------------------------------------------------------------------+
void CheckAndTrade()
  {
   // Only trade in specified time window
   if(!IsWithinTradingTime())
      return;

   datetime now = TimeCurrent();
   double current_price = SymbolInfoDouble(_Symbol, SYMBOL_BID);

   double points_moved = (current_price - priceAtLastCheck)/_Point;

   int time_diff = (int)(now - lastCheckTime);

   if(time_diff < CheckInterval)
      return; // Wait till we have interval

   // We have enough time passed, check price movement and enter trades appropriately

   if(points_moved >= PointsThreshold)
     {
      PrintFormat("Bullish breakout detected: Moved up %.1f points in %d seconds", points_moved, time_diff);
      PlaceBuy();
     }
   else if(points_moved <= -PointsThreshold)
     {
      PrintFormat("Bearish breakout detected: Moved down %.1f points in %d seconds", points_moved, time_diff);
      PlaceSell();
     }

   // Update reference values
   lastCheckTime = now;
   priceAtLastCheck = current_price;
  }

//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   // Manage existing positions trailing stop
   ManageTrailingStop();

   // Check breakout conditions and enter trades
   CheckAndTrade();
  }


//+------------------------------------------------------------------+
//| Helper: return magic number                                      |
//+------------------------------------------------------------------+
uint ExpertHandle()
  {
   return(123456);  // fixed magic number for simplicity
  }