Issues with Running MT5 Strategy Tester via Python

 
I would like to run the MT5 strategy tester with the following Python code, but it seems I am unable to log in to MT5 properly. Could you please advise if there are any issues with the code?
import MetaTrader5 as mt5
import pandas as pd
import os
import time
from datetime import datetime

# Connect to MetaTrader 5
login = 12345678 
password = "your_password"
server = "broker_server"

if not mt5.initialize(login=login, password=password, server=server):
    print("MetaTrader 5 initialization failed, error code =", mt5.last_error())
    mt5.shutdown()
    exit()

# Set the currency pair and parameters to be tested
symbol = "EURUSD"
short_window = 10
long_window = 100

# Set the data retrieval period
utc_from = datetime(2023, 1, 1)
utc_to = datetime(2023, 12, 31)

# Generate the strategy tester configuration file
def create_test_config(symbol, short_window, long_window):
    config_content = f"""
[Test]
Expert=SMA_Cross
Symbol={symbol}
Period=H1
FromDate=2023.01.01
ToDate=2023.12.31
Optimization=0
Inputs=FastSMA={short_window};SlowSMA={long_window};
Deposit=10000
"""
    with open("tester.ini", "w") as file:
        file.write(config_content)

# Run the strategy tester
def run_strategy_tester():
    command = r'"C:\\Program Files\\Titan FX MetaTrader 5\\terminal64.exe" /portable /config:tester.ini'
    os.system(command)

# Set the data folder path
data_folder = 'data'
if not os.path.exists(data_folder):
    os.makedirs(data_folder)

print(f"Running test for {symbol} with FastSMA={short_window} and SlowSMA={long_window}")
create_test_config(symbol, short_window, long_window)
run_strategy_tester()

# Wait for the results file to be generated
results_file = f"C:\\Program Files\\Titan FX MetaTrader 5\\tester\\{symbol}_{short_window}_{long_window}.csv"
while not os.path.exists(results_file):
    print(f"Waiting for {results_file} to be generated...")
    time.sleep(300)  # Check every 300 seconds

# Retrieve and save the results (for example, reading the exported results)
if os.path.exists(results_file):
    results = pd.read_csv(results_file)
    output_file = os.path.join(data_folder, f'{symbol}_SMA_{short_window}_{long_window}.csv')
    results.to_csv(output_file, index=False)
    print(f"Results saved to {output_file}")
else:
    print(f"Results file not found for {symbol} with FastSMA={short_window} and SlowSMA={long_window}")

# Disconnect from MetaTrader 5
mt5.shutdown()