In our guide on how to import high quality tick data into MT5 you learned how to ensure that the execution of your EA in backtesting matches your broker's live conditions. To achieve trustworthy data, it is equally important to add trading commissions to your backtest.
In this guide we will teach you how to configure fees for your custom symbols so that the results of your backtests will match those of your live results.
1: Open the strategy tester
2: Click on the icon left of where it says "emulate slippage and requotes during trade execution" to open the trade settings window.
3: In the trade settings window, stay on the Commissions tab and click "Use custom settings"
4: Click on the "+ click to add commission" field.
5: Insert the path of your custom symbols folder as shown below. For a custom forex symbol you need to insert the path Custom \Forex \*
Note that a backslash (\) is used here and NOT a normal forward slash (/).
The asterisk ( *) at the end of the path name, indicates that any symbol within that folder will follow the charging model that we are about to set up.
You need to create different charging models for forex, stocks, indices, commodities, crypto etc.
In the following demonstration we will create a charging model for custom forex pairs
This path might be different on your Mt5 Terminal than on mine. Make sure you write the path exactly as it is listed in your MT5 directory. You can check this simply by looking at the symbols directory in the strategy tester as shown in the image below.
6: Now it is time to insert your trading fees into the columns. Note that your trading fees might be different than mine, so check with your broker to get the exact numbers.
My broker charges 6 USD per round lot.
So I need to set "charge" to instant as the fee is directly paid to my broker.
I set "entry" to in/out as my broker charges half the commission when I enter a position and the second half of the commission when I exit a position.
The "from" and "to" tabs are for brokers that uses a tiered commission model. Most brokers, as well as mine uses a single tiered model, so i set a volume from 0 to 1000000. That means that position volumes from 1 to 1000000 have the same commission fee applied to them.
I set the "commission" to 3 as my broker charges me 3 USD for every in -deal and 3 USD for every out-deal (6 USD per round lot)
The "minimum" and "maximum" inputs allow you to set a minimum commission value and a maximum commission value.
The "mode" I set to "deposit ccy", as my deposit currency is USD. Make sure to set this input to what is applicable in your case.
Lastly, the "type" input I need to set to "per volume" as the commissions on my broker (for Forex) is calculated per volume/lot.
To enable the trading costs to your backtest;
1: Choose a delay (I always use random delay as this will mimic live trading the most)
2: Cake sure the checkbox "Profit in pips for faster calculations" is un-checked.
To make sure you have configured everything correctly, run a backtest in visual mode with a symbol, within that folder that we have just created a charging model for.
1: Click on the "History" tab in the bottom left corner
2: Right click anywhere on the history data and select "columns" and then hit "commission".
Now you can see if the fees are being calculated correctly, as they would in live trading.
We hope you found value in this post. If you did, give it a like and share it on social media using the links below.