Yes, you have to install MetaTrader 5 and you have to work in the MetaTrader 5 terminal.
1. Please insert the code correctly: when editing a message, press the button and paste your code into the pop-up window. (The first time I corrected your message)
2. Check out the reference example: symbols_get
import MetaTrader5 as mt5 # display data on the MetaTrader 5 package print("MetaTrader5 package author: ",mt5.__author__) print("MetaTrader5 package version: ",mt5.__version__) # establish connection to the MetaTrader 5 terminal if not mt5.initialize(): print("initialize() failed, error code =",mt5.last_error()) quit() # get all symbols symbols=mt5.symbols_get() print('Symbols: ', len(symbols)) count=0 # display the first five ones for s in symbols: count+=1 print("{}. {}".format(count,s.name)) if count==5: break print() # get symbols containing RU in their names ru_symbols=mt5.symbols_get("*RU*") print('len(*RU*): ', len(ru_symbols)) for s in ru_symbols: print(s.name) print() # get symbols whose names do not contain USD, EUR, JPY and GBP group_symbols=mt5.symbols_get(group="*,!*USD*,!*EUR*,!*JPY*,!*GBP*") print('len(*,!*USD*,!*EUR*,!*JPY*,!*GBP*):', len(group_symbols)) for s in group_symbols: print(s.name,":",s) # shut down connection to the MetaTrader 5 terminal mt5.shutdown() Result: MetaTrader5 package author: MetaQuotes Software Corp. MetaTrader5 package version: 5.0.29 Symbols: 84 1. EURUSD 2. GBPUSD 3. USDCHF 4. USDJPY 5. USDCNH len(*RU*): 8 EURUSD USDRUB USDRUR EURRUR EURRUB FORTS.RUB.M5 EURUSD_T20 EURUSD4 len(*,!*USD*,!*EUR*,!*JPY*,!*GBP*): 13 AUDCAD : SymbolInfo(custom=False, chart_mode=0, select=True, visible=True, session_deals=0, session_buy_orders=0, session... AUDCHF : SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, sessi... AUDNZD : SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, sessi... CADCHF : SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, sessi... NZDCAD : SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, sessi... NZDCHF : SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, sessi... NZDSGD : SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, sessi... CADMXN : SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, sessi... CHFMXN : SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, sessi... NZDMXN : SymbolInfo(custom=False, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, sessi... FORTS.RTS.M5 : SymbolInfo(custom=True, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, ... FORTS.RUB.M5 : SymbolInfo(custom=True, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, ... FOREX.CHF.M5 : SymbolInfo(custom=True, chart_mode=0, select=False, visible=False, session_deals=0, session_buy_orders=0, ...
- www.mql5.com
Thanks Vladimr Karputov.
When you said: install MetaTrader 5 and you have to work in the MetaTrader 5 terminal.
1. do I just install MetaTrade 5 in python like pip insall MetraTrade5?
2. what is MetaTrader 5 terminal? where to install it? can i use with python? I have no idea. I am running my code in jupyter notebook.
sorry pls forgive me that I am totally lost. I came here because one of trading book use MetaTrader5. and I am struggling with running the jupyter notebook which contains MetaTrader5.
Thanks for your help.
Thanks Vladimr Karputov.
When you said: install MetaTrader 5 and you have to work in the MetaTrader 5 terminal.
1. do I just install MetaTrade 5 in python like pip insall MetraTrade5?
2. what is MetaTrader 5 terminal? where to install it? can i use with python? I have no idea. I am running my code in jupyter notebook.
sorry pls forgive me that I am totally lost. I came here because one of trading book use MetaTrader5. and I am struggling with running the jupyter notebook which contains MetaTrader5.
Thanks for your help.
You have to download
and install the MetaTrader 5 terminal.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I am doing below and I got an error below, it looks like I got an None. do I need to have a MetaTrader 5 account before I can call it? Thanks
TypeError Traceback (most recent call last) ~\AppData\Local\Temp/ipykernel_29820/2020388382.py in <module> 11 12 # Tuple to list ---> 13 symbols_information_list = list(symbols_information) 14 15 # Extract the name of the symbol TypeError: 'NoneType' object is not iterable