Hello MetaQuotes,
Any comment on this please? stringo, Rosh?
Unfortunately, there are no commissions in the strategy tester. And there is no decision on implementing this functionality at the moment
Unfortunately, there are no commissions in the strategy tester. And there is no decision on implementing this functionality at the moment
I know that custom spreads are not planned (read such info in other topic on the forum), but I am quite surprised to see that default commission is not shown in the results of the strategy testing. Commission can drive many strategies to bankruptcy, especially the short-term ones.
OK, so maybe the other way round - in such case, can I refer e.g. to SYMBOL_SPREAD or SYMBOL_ASK & SYMBOL_BID to calculate the spread in strategy tester, or will they also return 0 or improper data?
- www.mql5.com
In the The Fundamentals of Testing in MetaTrader 5 article, there is the 'Simulation of Spread' section:
Simulation of spread
The price difference between the Bid and the Ask prices is called the spread. During testing, the spread is not modeled but is taken from historical data. If the spread is less than or equal to zero in the historical data, then the spread for the time of the requested historical data is used by testing agent.
In the Strategy Tester, the spread is always considered floating. That is the SymbolInfoInteger(symbol, SYMBOL_SPREAD_FLOAT) always returns true.
In addition, the historical data contains
tick values and trading volumes. For the storage and retrieval of data
we use a special MqlRates structure:
struct MqlRates { datetime time; // opening bar time double open; // opening price Open double high; // the highest price High double low; // the lowest price Low double close; // the closing price Close long tick_volume; // the tick volume int spread; // spread long real_volume; // market volume };
In the The Fundamentals of Testing in MetaTrader 5 article, there is the 'Simulation of Spread' section:
Commission can be charged in different ways. Why should a spread be treated as a commission?
AFAIK usually the spread is calculated by the brokers by:
a) fixed spread
b) variable spread
c) percentage of spread
So for simulation results, having spread as a commission - that would decrease the balance with every deal - would make the results more realistic.
If (as you shown) there is access to historical spread or bid/ask prices, the developer can implement such calculation by himself and then generate a custom report of strategy testing. Obviously, it would be much easier to have it in the report "by default".
- www.mql5.com
Commission is charged separately, spread is another story.
Alexx: so what is a commission in the context of MQL5? Because in many sources that I have read so far, usually Forex commission is understood as spread. Obviously e.g. for stocks, commission is some % of transaction - do you mean such commission>
Nevertheless - even if you treat spread as another story, this is still a very important transaction cost (the more important, the higher the frequency of trades e.g. intraday strategies) and if it is not shown clearly in the testing report, the testing results may be misleading due to too high balance shown.
commission is some % of transaction - do you mean such commission>
Yes, that's right
Nevertheless - even if you treat spread as another story, this is still a
very important transaction cost (the more important, the higher the
frequency of trades e.g. intraday strategies) and if it is not shown
clearly in the testing report, the testing results may be misleading due
to too high balance shown.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello MetaQuotes,
I have executed two of your example EAs ("MACD Example" and "Moving average") in the strategy tester on GBPUSD just to find out that there is no commission charged on the deals:
I didn't find any info on the forum or in the MQL5 Reference regarding such behaviour. I expected to see spread for a particular deal here, please correct me if I'm wrong in understanding "commission" in this context, but even Uncle Google says:
There are three forms of commission used by brokers in forex. Some firms offer a fixed spread, others offer a variable spread and still others charge a commission based on a percentage of the spread.
So even if your implementation was the third one, I guess that still there should be some non-zero commission, right..?
I have also tested this on CFD symbol (#INTC) and still commission on all deals is 0.