Function to run through the process of starting up MT5 and initializing symbols :param project_settings: json object of project settings :return: Boolean. True. Startup successful. False. Error in starting up.
def startup(project_settings): """ Function to run through the process of starting up MT5 and initializing symbols :param project_settings: json object of project settings :return: Boolean. True. Startup successful. False. Error in starting up. """ try: # Create client object client = Client() # Connect to MetaTrader 5 client.connect() # Get server time server_time = client.server_time() print(server_time) # Disconnect from MetaTrader 5 # client.disconnect() # print("Disconnected") # Assign environment variables project_settings.mt5_server_time = server_time project_settings.mt5_client = client # Initialize symbols initialize_symbols(project_settings) # Check if all symbols have initialized successfully if project_settings.symbols_initialized: return True else: return False except Exception as e: print(e) return