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

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
Is the creation of an entity(connection) possible in principle? I don't think it's that necessary, but for future reference.
When installing another script (Py) on the chart, the first one is reset. Is this the way it should be?
I don't think it would be difficult to create another entity, it would just be another level of abstraction for the lib.
This is no longer considered using the lib from the terminal, but as a full-fledged gateway to terminals on the python side.
Better to put more utility into the lib itself :) now.
I don't think it would be difficult to create another entity, it would just be another level of abstraction for the lib.
This is no longer considered using the lib from the terminal, but as a full-fledged gateway to terminals on the python side.
Better to put more utility into the lib itself :) now.
My terminal startup fails regularly, haven't figured out the reason. I must have a bug somewhere with the python installation... I'll use lib as gateway to terminal (via services). I'll put it to the test on Monday.
mt5.initialize(blabla, portable=True)- didn't help much, it still asks for the last terminal started in the system.
Try without named parameter path, pass path as first unnamed parameter:
try without named parameter path, pass path as first unnamed parameter:
It worked correctly. Thank you.
Bug?
Everything worked correctly. Thank you. (chuckles)
A bug?
Not a bug.
The first parameter is not named and is fixed. But just in case it will be named in the next version.
Not a bug.
The first parameter is unnamed and fixed. But just in case it will be named in the next version.
Aha, so I didn't understand the documentation specifically.
Thank you.
Question. There is a positions_get function. The documentation describes three modes of its operation.
positions_get
Gets open positions with filtering by symbol or ticket. It can be called in 3 different ways.
Called without parameters. Returns the open positions for all symbols.
positions_get()
Call with specifying a symbol, for which it wants to get open positions.
positions_get(
symbol="SYMBOL" // symbol name
)
Call specifying the ticket of the position.
positions_get(
ticket=TICKET // ticket
)
Parameters
symbol="SYMBOL" [in] The name of the symbol. Optional named parameter. If a symbol is specified, the ticket parameter is ignored.
ticket=TICKET [in] The position ticket (POSITION_TICKET). Optional named parameter.
Variant positions_get() - no questions, works fine.
But the other two do not return anything.
The second callback variant:
last_error also returns a strange construct:
Where to look? What is wrong?
A call with a position ticket.
positions_get(
ticket=TICKET //ticket
)
Parameters
symbol="SYMBOL" [in] The name of the symbol. Optional named parameter. If a symbol is specified, the ticket parameter is ignored.
ticket=TICKET [in] The position ticket (POSITION_TICKET). Optional named parameter.
Variant positions_get() - no questions, works fine.
But the other two do not return anything.
The second calling variant:
last_error also returns a strange construct:
What to look for? What is wrong?
Check whether your account type is netting or hedging. For netting, the ticket of an already existing position will not change, and there is no point in looking for a position after the topping up using the order number.
last_error тоже возвращает странную конструкцию: