can not run python code

 

When I execute the code in Meta Trader 5,

it does not execute all the scripts,

but only prints the message. (((Hello))). Does anyone know the solution, please?



# Copyright 2022, MetaQuotes Ltd.

# https://www.mql5.com

import MetaTrader5 as mt5

mt5.initialize()

                                 print("hello")

if not mt5.initialize():

 print("initialize() failed")

   # Define the symbol for which you want to check bid and ask prices

 symbol = "EURUSD" 

    # Get bid and ask prices 

 ticks = mt5.copy_ticks_from(symbol, mt5.TIMEFRAME_TICK, 0, 1) 

 if ticks is not None and len(ticks) > 0:

  bid = ticks[0].bid

  ask = ticks[0].ask 

  print(f"Bid Price for {symbol}: {bid}")

  print(f"Ask Price for {symbol}: {ask}")

 else: 

  print(f"No tick data available for {symbol}")

Discover new MetaTrader 5 opportunities with MQL5 community and services
Discover new MetaTrader 5 opportunities with MQL5 community and services
  • 2023.08.08
  • www.mql5.com
MQL5: language of trade strategies built-in the MetaTrader 5 Trading Platform, allows writing your own trading robots, technical indicators, scripts and libraries of functions
 
  1. Here you find dozens of articles about python and how to use it: https://www.mql5.com/en/search#!keyword=Python&module=mql5_module_articles
  2. For the future: Please use the code botton (or Alt+S) for your code.