MetaTrader 5 Python User Group - how to use Python in Metatrader - page 59

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

Why do you need VS? Python doesn't require VS.

Google something like window python and you're good to go.

Python does require you to have some VS libraries on your computer.

 
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 returnsNone 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:

In addition, the descriptions of many of the functions have been changed as they have been refined. Almost all examples have been rewritten to reflect the new functionality. However, the examples for the following functions have not been updated on the website yet, they will be a bit later:

The website has been updated

 
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