POSITION_COMMISSION missing in Position properties documentation (MT5) - page 2

 
Laurent Soudron:

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/historyselectbyposition
Documentation on MQL5: Trade Functions / HistorySelectByPosition
Documentation on MQL5: Trade Functions / HistorySelectByPosition
  • www.mql5.com
Do not confuse orders of a trading history with current pending orders that appear on the "Trade" tab of the "Toolbox" bar. The list of orders that were canceled or have led to a transaction, can be viewed in the "History" tab of "Toolbox" of the client terminal. HistorySelectByPosition() creates in a mql5 program a list of orders and a list of...
 
Laurent Soudron:

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 ?

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 

Export trade history to CSV v2
Export trade history to CSV v2
  • www.mql5.com
This is the version 2 of my script to export the trade history from MT5 selected between two dates. The resulting file is CSV that can be opened/imported with any spreadsheet software. Following data columns are exported: Position IDTypeSymbolVolumeOpen Date/TimeOpen PriceClose Date/TimeClose PriceTakeProfit, data not available...
Reason: