AttributeError: 'NoneType' object has no attribute 'ask'

 

Hi guys, i keep getting an AttributeError with my code, does anyone know how to fix it, it has got be stumped.

Get the last tick for the Crypto is Error but Currency cross is Ok!

My code in attachment file. Any support would be great.

 
Thao Pham :

Hi guys, i keep getting an AttributeError with my code, does anyone know how to fix it, it has got be stumped.

Get the last tick for the Crypto is Error but Currency cross is Ok!

My code in attachment file. Any support would be great.

Read and study the help documentation: symbol_info_tick

Documentation on MQL5: Integration / MetaTrader for Python / symbol_info_tick
Documentation on MQL5: Integration / MetaTrader for Python / symbol_info_tick
  • www.mql5.com
symbol_info_tick - MetaTrader for Python - Integration - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Vladimir Karputov #:

Read and study the help documentation: symbol_info_tick

This documentation doesn't say anything about crypto, currency cross only :)

For example:  Get the last tick for the BTCUSD is error but GBPUSD is Ok.

 
Thao Pham # :
This documentation doesn't say anything about crypto, currency cross only :)

Read and study the documentation. If you do not understand - just copy one to one.

Your writing style is broken. Learn to read documentation and CORRECTLY write code.

 
Vladimir Karputov #:

Read and study the documentation. If you do not understand - just copy one to one.

Your writing style is broken. Learn to read documentation and CORRECTLY write code.

Nice! It's working.

x = mt5.symbol_info_tick('BTCUSD')._asdict()
print(x['ask'])
print(x['bid'])

Thank you very much!!!

Reason: