Use symbol_info_tick.
https://www.mql5.com/en/docs/python_metatrader5/mt5symbolinfotick_py
Documentation on MQL5: Python Integration / symbol_info_tick
- www.mql5.com
symbol_info_tick - Python Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
same results with symbol_info_tick also
symbol = "CAG"
symbol_info = mt5. symbol_info_tick (symbol)
print(symbol_info.bid)
print(symbol_info.ask)
thanks
Documentation on MQL5: Python Integration / symbol_info
- www.mql5.com
symbol_info - Python Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Please post the full code to be able to reproduce it.
import MetaTrader5 as mt5 if not mt5.initialize(): print("Failed to initialize MetaTrader 5") exit(1) login = 123456 password = "xxxxxxxx" server = "000.00.000.000:443" if not mt5.login(login, password, server): print("Failed to connect to the MT5 server") mt5.shutdown() exit(1) my_array =['AAPL','CIG','KO','LEN','LLY','LUV','LVS','LYV','CAG','MA','MCD','MDT','META','MGM','MSFT','GM','GOOG','GOOGL','GS','HAL','HBAN','ES','HON','HPE','HPQ','HWM','IBM','ICE','INTC','IPG','IR','JNJ','JNPR','JPM','KMI','KO','LEN','LLY','LUV','LVS','LYV','MA','MCD','MDT','META','MGM','MMM','MNST','MO','MOS','MPC','MRK','MRO','MS','NDAQ','NEE','NFLX','NI','NXPI','OKE','OMC','ON','ORCL','OXY','PARA','PCAR','PEG','PEP','PFE','PM','PNC','PPL','PSX','PXD','PYPL','QCOM'] for element in my_array: try: price = mt5.symbol_info_tick(element).ask price2 = mt5.symbol_info_tick(element).bid print( element + "__" + str(price) + "__" + str(price2)) except Exception as e: print(element + "_____") I am able to get ask/bid prices if i run the below code selected=mt5.symbol_select("GOOGL",True) if not selected: print("Failed to select. error code =",mt5.last_error()) else: print("Selected")Should i select the symbol before sending the order or is there any thing to do
thanks
any help
thanks
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi,
Bid & Ask price always zero for most of the symbols using python
symbol = "CAG" symbol_info = mt5.symbol_info(symbol) print(symbol_info.bid) print(symbol_info.ask)
for below symbols price are available
any suggestions
thanks