can anyone fix the bug?

 
//+------------------------------------------------------------------+
//|                                                   ATR Auto SL/TP |
//|                             Copyright 2023, Your Name or Company |
//+------------------------------------------------------------------+
#property copyright "Copyright 2023, Your Name or Company"
#property link      "https://www.yourwebsite.com"
#property version   "1.0"
#property strict

#include <Trade\Trade.mqh>
CTrade trade;

input double ATRMultiplier = 1.5; // Multiplier for ATR
input int Slippage = 3;            // Slippage

//+------------------------------------------------------------------+
void OnTick()
{
   // Check for open positions
   for (int i = 0; i < PositionsTotal(); i++)
   {
      ulong ticket = PositionGetTicket(i);
      if (ticket != 0)
      {
         double atrValue = iATR(Symbol(), Period(), 14); // Calculate ATR
         double atrSL = atrValue * ATRMultiplier; // ATR-based SL
         double atrTP = atrValue * ATRMultiplier; // ATR-based TP

         // Update SL and TP only if they are not set
         double currentSL = PositionGetDouble(POSITION_SL);
         double currentTP = PositionGetDouble(POSITION_TP);

         if (currentSL == 0.0)
         {
            double stopLoss = PositionGetDouble(POSITION_PRICE_OPEN) - atrSL * Point;
            trade.PositionModify(ticket, stopLoss, currentTP);
         }

         if (currentTP == 0.0)
         {
            double takeProfit = PositionGetDouble(POSITION_PRICE_OPEN) + atrTP * Point;
            trade.PositionModify(ticket, currentSL, takeProfit, 1);
         }
      }
   }
}

//+------------------------------------------------------------------+
 
ChatGPT code. iATR is not working this way in MQL5, check the documentation and search on the forum.