//@version=5
indicator("ATR-Levels", overlay=true)

// Input for ATR period
atrPeriod = input.int(10, title="ATR Period")

// Fetch monthly time frame high, low, and open
[monthlyHigh, monthlyLow, monthlyOpen, monthlyTime] = request.security(syminfo.tickerid, "M", [high, low, open, time])

// ATR Calculation
H_L = array.new_float()
openATR = array.new_float()

for i = 0 to atrPeriod - 1
    h = monthlyHigh[i]
    l = monthlyLow[i]
    o = monthlyOpen[i]
    array.push(H_L, h - l)
    array.push(openATR, o)

atrSum = 0.0

for i = 0 to array.size(H_L) - 2
    Sum = (array.get(H_L, i) + array.get(H_L, i+1))
    atrSum := atrSum + Sum / 2 / array.get(openATR, i+1) * 100

ATRavg = atrSum / (array.size(H_L) - 1)
ATRavg := na(ATRavg) ? 0 : ATRavg   // Handle potential NA values

priceHigh = array.get(openATR, 0) * (1 + ATRavg / 100)
priceLow = array.get(openATR, 0) * (1 - ATRavg / 100)
priceHigh_5 = array.get(openATR, 0) * (1 + ATRavg / 200)
priceLow_5 = array.get(openATR, 0) * (1 - ATRavg / 200)

// Текущее время
currentTime = timenow
start_time = timestamp(year(currentTime), month(currentTime), 1)
end_time = timestamp(year(currentTime), month(currentTime) + 1, 1)

// Ensure to adjust the timeframe of lines rendering to a reasonable range of current time and future time for visibility in the script
var line priceHighLine = na
var line priceLowLine = na
var line priceHighHalfLine = na
var line priceLowHalfLine = na

if not na(priceHighLine)
    line.delete(priceHighLine)
if not na(priceLowLine)
    line.delete(priceLowLine)
if not na(priceHighHalfLine)
    line.delete(priceHighHalfLine)
if not na(priceLowHalfLine)
    line.delete(priceLowHalfLine)

// Plot lines using specific time positions with xloc.bar_time
priceHighLine := line.new(x1=start_time, y1=priceHigh, x2=end_time, y2=priceHigh, color=color.red, width=2, style=line.style_solid, xloc=xloc.bar_time)
priceLowLine := line.new(x1=start_time, y1=priceLow, x2=end_time, y2=priceLow, color=color.red, width=2, style=line.style_solid, xloc=xloc.bar_time)
priceHighHalfLine := line.new(x1=start_time, y1=priceHigh_5, x2=end_time, y2=priceHigh_5, color=color.blue, width=2, style=line.style_solid, xloc=xloc.bar_time)
priceLowHalfLine := line.new(x1=start_time, y1=priceLow_5, x2=end_time, y2=priceLow_5, color=color.blue, width=2, style=line.style_solid, xloc=xloc.bar_time) есть такая программа на pinescript как мне переделать её что бы значения были как у программы на mql5 //+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2020, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
#property indicator_chart_window
#property indicator_buffers 0
#property indicator_plots 0

//— входные параметры
input int InpAtrPeriod = 10; // Период ATR

//±-----------------------------------------------------------------+
//| Функция инициализации пользовательского индикатора              |
//±-----------------------------------------------------------------+
int OnInit()
  {
   return (INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   ObjectDelete(0,"priceHigh");
   ObjectDelete(0,"priceLow");
   ObjectDelete(0,"priceHigh_0.5");
   ObjectDelete(0,"priceLow_0.5");
  }

//±-----------------------------------------------------------------+
//| Функция итерации пользовательского индикатора                   |
//±-----------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   double H_L[10];
   double openATR[10];
   int m = 0;

// Расчет значений ATR с использованием данных месячного таймфрейма
   for(int i = 0; i < InpAtrPeriod && i < iBars(_Symbol, PERIOD_MN1); i++)
     {
      int shift = i;
      double maxHigh = iHigh(_Symbol, PERIOD_MN1, shift);
      double minLow = iLow(_Symbol, PERIOD_MN1, shift);
      openATR[m] = iOpen(_Symbol, PERIOD_MN1, shift);
      H_L[m] = NormalizeDouble(maxHigh - minLow, _Digits);
      m++;
     }

   double ATR = 0;
   for(int i = 0; i < m - 1; i++)
     {
      double sum = H_L[i] + H_L[i + 1];
      ATR += sum / 2 / openATR[i + 1] * 100;
     }

   double ATRavg = NormalizeDouble(ATR / (m - 1), 2);

   if(m > 0)
     {
      double priceHigh = openATR[0] + (openATR[0] * ATRavg / 100);
      double priceLow = openATR[0] - (openATR[0] * ATRavg / 100);
      double priceHigh_2 = openATR[0] + (openATR[0] * ATRavg / 200);
      double priceLow_2 = openATR[0] - (openATR[0] * ATRavg / 200);

      datetime time_start = iTime(_Symbol, PERIOD_MN1, 0);
      datetime time_end = time_start + 31 * 24 * 60 * 60;


      ObjectCreate(0, "priceHigh", OBJ_TREND, 0, time_start, priceHigh, time_end, priceHigh);
      ObjectCreate(0, "priceLow", OBJ_TREND, 0, time_start, priceLow, time_end, priceLow);
      ObjectCreate(0, "priceHigh_0.5", OBJ_TREND, 0, time_start, priceHigh_2, time_end, priceHigh_2);
      ObjectCreate(0, "priceLow_0.5", OBJ_TREND, 0, time_start, priceLow_2, time_end, priceLow_2);

      ObjectSetInteger(0, "priceHigh", OBJPROP_COLOR, clrCrimson);
      ObjectSetInteger(0, "priceLow", OBJPROP_COLOR, clrCrimson);
      ObjectSetInteger(0, "priceHigh_0.5", OBJPROP_COLOR, clrBlue);
      ObjectSetInteger(0, "priceLow_0.5", OBJPROP_COLOR, clrBlue);

      ObjectSetInteger(0, "priceHigh", OBJPROP_WIDTH, 2);
      ObjectSetInteger(0, "priceLow", OBJPROP_WIDTH, 2);
      ObjectSetInteger(0, "priceHigh_0.5", OBJPROP_WIDTH, 2);
      ObjectSetInteger(0, "priceLow_0.5", OBJPROP_WIDTH, 2);
     }


   return (rates_total);
  }

//+------------------------------------------------------------------+