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
I tried with this code but the commission is still 0 in either case (with DEAL_COMMISSION and POSITION_COMMISSION)
Can you help me please ?
Let read about HistorySelectByPosition
HistorySelectByPosition() creates in a mql5 program a list of orders and a list of deals with a specified position identifier for further reference to the elements of the list using the appropriate functions. To know the size of the list of deals, use function HistoryDealsTotal(), the size of the list of orders in the history can be obtained using HistoryOrdersTotal(). To run through elements of the orders list, use HistoryOrderGetTicket(), for elements of the deals list - HistoryDealGetTicket().
After using HistoryOrderSelect(), list of history orders available to the mql5 program is reset and filled again with the found order, if search of an order by its ticket was successful. The same refers to the list of deals available to the mql5 program - it is reset by function HistoryDealSelect() and is filled out again if a deal was found successfully by the ticket number.
https://www.mql5.com/en/docs/trading/historyselectbypositionI tried with this code but the commission is still 0 in either case (with DEAL_COMMISSION and POSITION_COMMISSION)
Can you help me please ?
That script is for open trades. The commission data is stored in trade history.
Try this script instead: https://www.mql5.com/en/code/24686