Forum

Why won't `trade.PositionClose(PositionGetSymbol(0)` close positions?

I have tried multiple approaches to this, based on the documentation and on information I've found in this forum, and I can't get anything to work. Simple version: void CloseAllPositions() { CTrade trade; while ( PositionsTotal () > 0 ) { trade.PositionClose( PositionGetSymbol ( 0

Trade, and Trade Transactions, with python integration

First some context: As best I can tell, MQL5 can make use of events handled by the Terminal, but they python integration doesn't get or see those events. Mostly that's ok. I don't particularly care about the events themselves (because I can program in python to listen for anything that changes and

python mt5.initialize() -> error -10005 'IPC timeout'. What does this mean? How to resolve?

Hi all. Trying to do mt5.initialize() (in python). Works about half the time. The other half of the time it times out, and then continues doing so on subsequent tries, for extended periods (sometimes hours) before it works again. When it times out, then I check why with mt5.lasterror(), and the

MT5 Python integration on Mac M1 (ARM)

Does anyone know if there's any way to get the MT5 python integration to work on Mac M1 (arm). Python installs and runs fine on a Mac, but unsurprisingly, when I try: pip install MetaTrader5 I get: ERROR: Could not find a version that satisfies the requirement MetaTrader5 (from versions: none)

Another question about MT5's python integration with two computers.

I posted another similar question but maybe it's too complicated. Trying here for a related, but different/simpler question... The MQL5 documentation on this page gives an example of a python script that can communicate with a broker, get some ticks and other data, and then operate on it -- all in

MQL5, Python, Javascript integration. Two computers.

Hi all. It is my understanding (please correct me if I'm wrong) that I can follow the instructions here to build the equivalent of an EA in python instead of MQL5, calling the python functions on that documentation page to handle all the broker interaction, and all the other logic and calculations

From in EA, get time, or GMT offset, in any timezone, independent of server location or running EA location

Details a bit vague here, to try to keep it brief. Happy to elaborate if needed. The MQL5 date and time functions include functions for getting time information in the time zone the EA is running in, or the broker's server's time zone , or the GMT time zone . The functions either factor in daylight

Difference between Trade and Position.

Hello all: I've always understood a position to be an aggregate of all open trades for a given symbol, but from what I can tell , I think: MT5/MQL5 considers a position and a trade to be the same thing. eg. I send two distinct market buy orders, they get fulfilled into two deals. I thought that was

Why no HistoryPosition functions?

Hello all. Short version: I've read everything I can find on this. Particularly the MQL5 Reference > Trade Functions , and this awesome article (ORDERS, POSITIONS AND DEALS IN METATRADER 5) . We have Functions for active orders, active positions, history orders, and history deals. Why don't we have

Order vs Deal vs Position vs TRADE (yes, again -- but more than past answers).

Hi all. Thanks for all the help so far with a few questions I've posted recently. Here's another. Well, a bunch of related ones... I've read a number of posts and the doc'n about Order vs Deal vs Position, including this documentation , and this , and others . A few things I'm unclear on, and