Very Helpful
Thank you
How to select history orders/ deals/ position by incremental indexing.
Such as:
for(uint i = uint(HistoryDealsTotal()-1); i >= 0; i--) { if(deal.SelectByIndex(i) == true) { //--my data } }
Is it possible?
Thanks for your interesting article
Forum on trading, automated trading systems and testing trading strategies
Discussion of article "Orders, Positions, and Deals in MetaTrader 5"
Tanvir Ahmed, 2017.10.21 16:52
for(uint i = uint(HistoryDealsTotal()-1); i >= 0; i--) { if(deal.SelectByIndex(i) == true) { //--my data } }
Infinite loop!
New article Orders, Positions, and Deals in MetaTrader 5 is published:
Author: MetaQuotes
very helpful!!!!!!!thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
Thanks for such an informative article. @MetaQuotes
Query: How can I collectively loop through both : open orders and open positions in a single for() loop (in a similar way how we loop all orders in MQL4 and then check if an order is already executed or a pending order) ?
Thanks for such an informative article. @MetaQuotes
Query: How can I collectively loop through both : open orders and open positions in a single for() loop (in a similar way how we loop all orders in MQL4 and then check if an order is already executed or a pending order) ?
To calculate POSITIONS and PENDING ORDERS you must use two independent cycles. One cycle enumerates POSITIONS, and the second cycle enumerates PENDED ORDERS. Example: Calculate Positions and Pendong Orders

- 2020.12.19
- www.mql5.com
Hi, folks!
It would be helpful that @MetaQuotes upgrade this article with Trade Classes (CAccountInfo, CSymbolInfo, COrderInfo, CHistoryOrderInfo, CPositionInfo, CDealInfo, CTrade, CTerminalInfo). Develop EA under Object-Oriented paradigm could modify (and simplify) this operations of synchronize cache and to get data over symbols, orders, positions, deals, trades, etc.
Am I right?

- www.mql5.com
if you please how to calculate order commision with profit to be like this
" Profit += profit + swap + commision "

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
New article Orders, Positions, and Deals in MetaTrader 5 is published:
Creating a robust trading robot cannot be done without an understanding of the mechanisms of the MetaTrader 5 trading system. The client terminal receives the information about the positions, orders, and deals from the trading server. To handle this data properly using the MQL5, it's necessary to have a good understanding of the interaction between the MQL5-program and the client terminal.
Author: MetaQuotes