OnTester Commission Calculator - MetaTrader 5 Expert | MT5 EA Download - MetaTrader 5 Resources











Update: Now it also calculates commission for "End of Test" results on the tester
I am testing my Expert Advisor and at the same time I found that I also have to calculate the commission charged by the broker, otherwise the profits shown by the strategy may not be real, so I tried to use the built-in commission function on Metatrader5, but this does not work!
https://www.mql5.com/en/forum/372056
So I decided to code this functionality externally.
This code can be used in your own Expert Advisor to calculate commissions (you may need to know programming)
The EA is suitable for testing Market, Limit, Stop Limit and Stop Market orders and can be selected from the SelectMode input
A percentage fee can be added. Like my broker charges 0.04% commission so I added there
After adding entry, stop loss and take profit you can run this EA on the strategy tester
In the test you can see that I executed a total of 4 trades
For each transaction, the commission should be calculated based on the input: 0.04%
Let's test it on excel

As you can see, for a quantity of 0.1, the buy limit order is 1.2546 and the take profit order is 1.284
So summing up 1.2546 + 1.284 = 2.5386
The total number of transactions is 2
So 2.5386 *2 = 5.0772
Therefore, at the end of the "Strategy Test Report" in the "Log" tab, the total commission will be printed
I hope this calculation method will help you test your EA and get more accurate profits when excluding commissions charged by the broker
Attachment download
📎 commission_calculator.mq5 (14.28 KB)
Source: MQL5 #35461
💡 Featured Recommendations
✍️ Latest by the author
- •
- •
- •
- •
- •
- •
📌 Popular topics
- •
- •
- •
- •
- •
- •
- •
- •
🔗 You May Be Interested In
- •
- •
- •
- •
- •
- •