because of this I could not test and answer the question - does it work on the account with netting (FORTS, Otkritie) and with many different Expert Advisors on it?
I keep accounting by Expert Advisors while calculating the volume of the position on the magik, I encountered that DEAL_ENTRY_OUT DEAL_ENTRY_IN does not appear exactly as expected when hedging.
because of this I could not test and answer the question - does it work on the account with netting (FORTS, Otkritie) and with many different Expert Advisors on it?
I keep accounting by Expert Advisors while calculating the volume of the position on the magik, I have encountered that DEAL_ENTRY_OUT DEAL_ENTRY_IN does not appear exactly as expected when hedging.
Do you have a question about the article or just in general? If "so, in general", then immediately state ALL the underlying data in a separately created thread in theGeneral Discussion section:
- operating system (be sure to specify whether it is real Windows or wine), bitness, build, servicepack
- terminal build
- plus the first three lines from the "Log" folder of the terminal after rebooting the terminal.
I am surprised how such articles are missed at all.
1. Комиссия. Своп. Прибыль
The final financial result of a deal is formed by summing up three parameters:
Result=Dealcommission +Cumulative swap on close+ Deal profit
Commission is always indicated in the terminal with "+" sign, so it is subtracted in the formula of the final financial result.
These properties of deals are obtained using HistoryDealGetDouble() with the following identifiers:
I have no decent words. Such ignorance is unacceptable when writing articles. To prove it, see the screenshot.
It is simply unpleasant to read further.
It amazes me how articles like this get through.
I have no decent words. Such ignorance is unacceptable when writing articles. For proof, see the screenshot.
Further reading is simply unpleasant.
Thank you for your consideration. The thing is that I have not encountered the commission before and used ServiceDesk's hint. At the same time I did not check the real account, where the commission can be charged.
The code and text will be corrected.
Thank you for your attentiveness. The thing is that I have not encountered the commission before and used ServiceDesk's hint. At the same time I did not check the real account, where the commission can be charged.
The code and text will be corrected.
I don't understand only why calculations are so slow? At first I thought that special slowdown is used, but I didn't find "Sleep" and "OnTimer" in the sources.
computational resources. That's why you should always try to minimise their number. Especially HistorySelectByPosition.
"With the introduction of hedging in MetaTrader 5, there is a great opportunity to simultaneously trade several Expert Advisors on one trading account. In this case, it is possible that one strategy is profitable, the second is unprofitable, and in the end, the profit graph hangs around zero. In this case, it is useful to build Balance and Funds charts for each trading strategy separately."
The topic is really very important, the problem raised is serious - MT5 does not have functions of PnL calculation in the context of trading strategies working on the same account and symbol (differentiated by MAGICs), BUT ... the author is just telling a lot of rubbish! Apparently, Vladimir is just a programmer, not a trader, and therefore does not understand the topic at all.
Incorrect commission sign in the primary article is a trifle. The issue here is that the article does not solve the stated problem with the lack of PnL calculationin terms of trading strategies at all,and instead of solving the problem, it demonstrates the author's skills in selecting trades via OOP and programming panels.
The real problem is that MT5 does not take MAGIC into account when calculating PnL values anywhere, and accordingly DEAL_PROFIT on trades is calculated incorrectly in general. I.e. if I have three Expert Advisors trading on a symbol: one trend catcher opens positions in the long term, and two oscillators catch overbought/oversold periods on H1/H4, and trade to return to the average, then PnL calculated on trades without taking into account MAGICs is just "the temperature of the hospital". And when there are three EAs on 20 different symbols?
Accordingly, for all deals on closing positions , thesummation (_balance=m_balance+deal_commission+deal_swap+deal_profit;)in the GetHistory function is NOT CORRECT. DEAL_PROFIT must be recalculated before summation.And recalculate taking into account the exchange rates on the date of closing positions, e.g. in the situation when trading in MOEX futures from a trading account with the base currency in usd.
- www.metatrader5.com
Very useful thing. Vladimir, I noticed this bug -
The account was opened 4 days ago. We select the default start date in the Expert Advisor, i.e. 2017.
The end date we choose today 02.10.2018.
The Expert Advisor hangs, does not respond to closures with a cross. At the same time the terminal consumes 2gb of RAM.
I think it would be more correct to compare the date of account opening with the search start date specified by the user before the search
Very useful thing. Vladimir, I've noticed this bug -
The account was opened 4 days ago. We select the default start date in the Expert Advisor, i.e. 2017.
The end date is today 02.10.2018.
The Expert Advisor hangs, does not respond to closures with a cross. The terminal is eating up 2gb of RAM.
I think it would be more correct to compare the date of account opening with the search start date specified by the user before the search
Please specify the name of the file you are running. Type of trading account. On which symbol.
- 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 Analyzing Balance/Equity graphs by symbols and EAs' ORDER_MAGIC has been published:
With the introduction of hedging, MetaTrader 5 provides an excellent opportunity to trade several Expert Advisors on a single trading account simultaneously. When one strategy is profitable, while the second one is loss-making, the profit graph may hang around zero. In this case, it is useful to build the Balance and Equity graphs for each trading strategy separately.
Now, you can see the balance and equity statistics per each symbol and magic number on hedge accounts when applying several EAs simultaneously. In other words, you are able to visually define the contribution of each EA (ORDER_MAGIC) to the overall balance, as well as each EA's drawdown.
Plotting the balance and floating profit based on the trading history (first, for all symbols, then — only for one):
Author: Vladimir Karputov