MetaTrader 5 Python User Group - как использовать Python в Метатрейдере - страница 59

 
Дмитрий Прокопьев:

А зачем вам VS? Python не требует наличия VS.

Гуглите что-то типа window python,  и будет вам щастье.

Python требует наличие на компе каких-то библиотек из VS.

 
Alexey Kozitsyn:

Python требует наличие на компе каких-то библиотек из VS.

https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.2_standalone:_Build_Tools_for_Visual_Studio_2019_.28x86.2C_x64.2C_ARM.2C_ARM64.29

WindowsCompilers - Python Wiki
  • wiki.python.org
Even though Python is an interpreted language, you may need to install Windows C++ compilers in some cases. Unlike Linux, compilers for Windows are not included by default in the OS. For example, you will need to use them if you wish to: Microsoft provides official C++ compilers called Visual C++, you can find them bundled with Visual Studio...
 

I tried using the new symbols_get() & symbols_total() methods defined in the new update, but I am unable to get it working for me.

I tried multiple times with different 'group' parameter in symbols_get () method but it always returns None I also tried adding all symbols in the market watch of the terminal; didn't work.

Snapshot of error

Here's a screenshot of the code, please tell me if I've done any mistakes.

 
Kiran Sawant:

I tried using the new symbols_get() & symbols_total() methods defined in the new update, but I am unable to get it working for me.

I tried multiple times with different 'group' parameter in symbols_get () method but it always returns None I also tried adding all symbols in the market watch of the terminal; didn't work.

Here's a screenshot of the code, please tell me if I've done any mistakes.

Please always add such info

# 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()
 
# display data on MetaTrader 5 version
print(mt5.version())

Also check last_error() if you get None

 
Rashid Umarov:

Кроме того, были внесены изменения в описания многих функций, так как они были доработаны. Практически все примеры были переписаны с учетом нового функционала. Правда, примеры для следующих функций на сайте пока не обновились, будут немного позже:

На сайте обновились

 
Rashid Umarov:

Please always add such info

Also check last_error() if you get None

Terminal version: [500, 2361, '08 Mar 2020']

Author:  MetaQuotes Software Corp.

MT5 Python module version:  5.0.29

last_error: [-5, 'Terminal: Incompatible versions, please install the latest version of Terminal and Python module']


I think I need to wait for the new MetaTrader5 update.

 
Kiran Sawant:

Terminal version: [500, 2361, '08 Mar 2020']

Author:  MetaQuotes Software Corp.

MT5 Python module version:  5.0.29

last_error: [-5, 'Terminal: Incompatible versions, please install the latest version of Terminal and Python module']


I think I need to wait for the new MetaTrader5 update.

import MetaTrader5 as mt5


def main():
    package_version = tuple(map(int, mt5.__version__.split('.')))
    terminal_build = mt5.version()[1]
    assert package_version >= (5, 0, 29)
    assert terminal_build >= 2372


if __name__ == "__main__":
    try:
        if mt5.initialize():
            main()
    finally:
        mt5.shutdown()
 
Kiran Sawant:

Terminal version: [500, 2361, '08 Mar 2020']

Author:  MetaQuotes Software Corp.

MT5 Python module version:  5.0.29

last_error: [-5, 'Terminal: Incompatible versions, please install the latest version of Terminal and Python module']


I think I need to wait for the new MetaTrader5 update.

Upgrade to the latest beta version 2374 by Help -> Check Desktop Updates, please.
 
MetaQuotes:
Upgrade to the latest beta version 2374 by Help -> Check Desktop Updates, please.
MetaTrader5 received latest updates, and the new functions are working fine now, thank you very much