title: Trying to get historical data from MT5 of several assets
body: <p>I´m learning python. I tried to get historical data of multiple stocks from MT5 however the stocks ' arrays have diferent lengths and I do not know how to solve it.</p>
  <p>error: ValueError: Length of values (71) does not match length of index (100)</p>
  <pre><code>from selenium.webdriver.chrome.service import Service
  from webdriver_manager.chrome import ChromeDriverManager
  from selenium.webdriver.common.by import By
  import pandas as pd
  from time import sleep
  from pathlib import Path
  import os
  import glob
  import numpy as np
  import matplotlib.pyplot as plt
  import MetaTrader5 as mt5
  from datetime import datetime
  
  
  if not mt5.initialize():
      print(&quot;initialize() failed, error code =&quot;, mt5.last_error())
      quit()
  
  
  s = Service(ChromeDriverManager().install())
  wd = webdriver.Chrome(service=s)
  
  wd.get(&quot;https://sistemaswebb3-listados.b3.com.br/indexPage/day/IBRA?language=pt-br&quot;)
  sleep(3)
  wd.find_element(By.ID,&quot;segment&quot;).send_keys(&quot;Setor de Atuação&quot;)
  sleep(3)
  wd.find_element(By.PARTIAL_LINK_TEXT,&quot;Download&quot;).click()
  sleep(3)
  
  
  list_of_files = glob.glob(&quot;C:/Users/xxxxx/Downloads/*&quot;) # * means all if need specific format then *.csv
  latest_file = max(list_of_files, key=os.path.getctime)
  
  
  lista= pd.read_csv(latest_file, sep=';', encoding='ISO-8859-1',skiprows = 0, skipfooter=2, engine='python', thousands='.',decimal=',', header=1, index_col=False)
  ativos = pd.DataFrame(lista)
  
  lista = ativos['Código']
  df = pd.DataFrame()
  for i in lista:
      barras = mt5.copy_rates_from(i, mt5.TIMEFRAME_D1, datetime.today(), 100)
      df[i] = barras['close']
  
  print(df)
  </code></pre>