MetaTrader 5 Python User Group - the summary - page 26

 

DirectX Tutorial (Part I): Drawing the first triangle - the article

Without understanding what is there under the hood, DirectX is perplexing: "Why is it so difficult and confusing, can't it be made simpler?" And this is only the first stage. Further, you come to study the HLSL shader language and the peculiarities of video card programming. In order to avoid all these confusions, I suggest considering the internal structure of DirectX, though not going too deep into detail. Then we will write a small script in MQL that displays a triangle on the screen.
DirectX Tutorial (Part I): Drawing the first triangle
DirectX Tutorial (Part I): Drawing the first triangle
  • www.mql5.com
It is an introductory article on DirectX, which describes specifics of operation with the API. It should help to understand the order in which its components are initialized. The article contains an example of how to write an MQL5 script which renders a triangle using DirectX.
 

hi

in MetaEditor create python script, choose import metatrader5. in a window with text "import MetaTrader5 as mt5" i press "compilation" and get an error: "ModuleNotFoundError: No module named 'MetaTrader5'". so without writing a line of code i get an error
 
Alex Vitkovski #: hiin MetaEditor create python script, choose import metatrader5. in a window with text "import MetaTrader5 as mt5" i press "compilation" and get an error: "ModuleNotFoundError: No module named 'MetaTrader5'". so without writing a line of code i get an error

You should first install the package before you can use it in your code — Documentation on MQL5: Integration / MetaTrader for Python

Installing the package from the command line:

pip install MetaTrader5

 

I'm trying to install the package on a Mac and tried the commands

pip install MetaTrader5  

python3 -m pip install "MetaTrader5"

and I get the errors 

ERROR: Could not find a version that satisfies the requirement MetaTrader5 (from versions: none)

ERROR: No matching distribution found for MetaTrader5

Is it because it's a Mac?

 

Hi, I'm trying to change the stop loss value and I'm receiving the following result:

OrderSendResult(retcode=10013, deal=0, order=0, volume=0.0, price=0.0, bid=0.0, ask=0.0, comment='Invalid request', request_id=0, retcode_external=0, request=TradeRequest(action=6, magic=0, order=0, symbol='', volume=0.0, price=0.0, stoplimit=0.0, sl=5461.5, tp=0.0, deviation=0, type=0, type_filling=0, type_time=0, expiration=0, comment='', position=214787925, position_by=0))

My request is shown above: 

request = {
   
'action': mt5.TRADE_ACTION_SLTP,
    'position': ticket_operacao_compra_longa,
    'sl': novo_stop_compra,
}
result = mt5.order_send(request)

Can anyone help me?
 
Rafael Laurenti #:

I'm trying to install the package on a Mac and tried the commands

pip install MetaTrader5  

python3 -m pip install "MetaTrader5"

and I get the errors 

ERROR: Could not find a version that satisfies the requirement MetaTrader5 (from versions: none)

ERROR: No matching distribution found for MetaTrader5

Is it because it's a Mac?

Yes. It only works properly on Windows. You can run Windows on your Mac using Parallels. If your Mac uses M1 chip it will work fine.
 

Download python version 3.10.0 then try installing metatrader5.

here the link: https://www.python.org/downloads/release/python-3100/

Python Release Python 3.10.0
Python Release Python 3.10.0
  • www.python.org
Release Date: Oct. 4, 2021 This is the stable release of Python 3.10.0 Python 3.10.0 is the newest major release of the Python programming language, and it contains many new features and optimizations. Major new features of the 3.10 series, compared to 3.9 Among the new major new features and changes so far: PEP 623 -- Deprecate and prepare for...
 

after a longer pause i am trying to use MetaTrader5 in python:

i got the following error message:

i am using anaconda and updated my anaconda version

i also tried already pip install -U numpy 

did not work

does anyone have an idea how to fix the problem?

thank you

 
The site  linked from https://pypi.org/project/MetaTrader5/ is https://www.mql5.com/en/docs/integration/python_metatrader5 and that is giving a 404 error
MetaTrader5
  • 2023.02.15
  • pypi.org
API Connector to MetaTrader 5 Terminal