Swap, yes, but are not historic.
Commission, generally yes, but not on custom symbols, and can vary from broker to broker.
Swap, yes, but are not historic.
Commission, generally yes, but not on custom symbols, and can vary from broker to broker.
Thanks for the response! If everything is included, I wonder why they don't show up as actual columns in the tester reports? Seems strange not to be included there.
Even more strange to have a commissions column that's left blank.
Like i wrote, it can depend on broker. The broker is (with MT5 anyway) the supplier of the data and trading conditions. Some brokers have commission free accounts, hence there should be zero in commission.
Like i wrote, it can depend on broker. The broker is (with MT5 anyway) the supplier of the data and trading conditions. Some brokers have commission free accounts, hence there should be zero in commission.
Understood! But my worry is that I'm trading on a broker that DOES have commissions, yet the commissions are still excluded. Also on the live server so shouldn't be an issue there...
Understood! But my worry is that I'm trading on a broker that DOES have commissions, yet the commissions are still excluded. Also on the live server so shouldn't be an issue there...
There are brokers who's demo account have different trading conditions then live. For example STOPLEVEL 0 on demo, STOPLEVEL X life, zero commission on demo, commission live.
Avoid these.
Hi all,
Are commissions and swaps taken into account during the MT5 strategy tester and optimization process?
This is indeed confusing. The fact that the overall cumulative commissions don't necessarily show up in the test report sadly doesn't imply that they're not accounted for uppon each individually transaction (and therefore show up in balance and equity). It also took me quite a while to realize this (and got it wrong for quite some time ;-) ), so I very well understand the question.
What you can do as a workaround: regularly scan the Deal history for new deals (you're gonna need HistorySelect() and HistoryDealsTotal() for that), select the ticket (HistoryDealGetTicket()) and then check HistoryDealGetDouble(ticket,DEAL_COMMISSION) and sum it up with your previous total commissions that you paid up to this point. For deal types (DEAL_TYPE_BUY, DEAL_TYPE_SELL, DEAL_TYPE_COMMISSION...) that don't come with a value (DEAL_COMMISSION zero) it just can be ignored.
You can do the same for the cumulative swap, using HistoryDealGetDouble(ticket,DEAL_SWAP) accordingly (=continuously sum up this value for all deal types that have a DEAL_SWAP value other than zero
[btw.: I wouldn't use PositionGetDouble(POSITION_SWAP) instead; HistoryDealGetDouble(ticket,DEAL_SWAP) is better for this purpose because otherwise you might account for fractions of the same swap multiple times if deal with closing partial positions)]
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
I've read lots of conflicting information about this question so i'd like a clear and simple answer if possible.
Are commissions and swaps taken into account during the MT5 strategy tester and optimization process?
I see a column for commissions in my final backtest report, however it is left totally blank.
If the answer to my question is no, I will have to code something into my EA to account for these, so I want to be sure before I go ahead with this.
Thanks a lot.