Check OrderCommission and OrderSwap
But their is no option to check OrderCommission or OrderSwap in MQL$ Strategy Tester
Use MQL. You just need to find out why orders are more unprofitable than you expect.
For this, for example, you can simply display the commission and swap of each current order in Comment().
Once you are sure that the cause is OrderCommission/OrderSwap, remove the code that displays them on the chart.
Vladislav Boyko #:
for example
for example
void OnTick() { Comment(test()); // Add this to the beginning of your EA's OnTick() } string test() { string text = ""; for(int i = OrdersTotal() - 1; i >= 0; i--) { if(!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) return("Something went wrong"); // Since this code is intended only for the strategy tester, OrderSymbol() and OrderMagicNumber() can be left unchecked. text += StringFormat("#%i commission %.2f, swap %.2f\n", OrderTicket(), OrderCommission(), OrderSwap()); } return(text); }
It can be something related to the change of currencies.
Use XAUUSD and use account in USD. If you trade XAUUSD and your account tester is in EUR, it means that also pair EURUSD is needed to convert your profit from USD to EUR, and may not have its history resulting in bad calculations or EA crash.
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
Hello poeple, I am trying to develop an EA in MQL4, which when backtested shows all the trades in loss even the one that are booked in profit. Please chek the attached screenshot. I tried incresing the profit and even lot size but still am getting the same result. Is this because of strategy tester or my code? If needed I can post part of code here as well. Please help I am still new to MQL coding and not sure what to do here. Thanks