Hi. All
I spent nearly 8 hours to find out how to change spread during backtesting and optimization.
I googled everywhere even thinking of using paid software on the net. Please don't do that.
MT4 has a built in feature so you can change spread during backtesting or optimization.
Just sharing this just in case someone want to do the same things.
Kind regards.
What I would really like to know is:
- Does changing the spread significantly affect optimisation / backtest results?
- If so, how does it do this?
- How much is the affect?
- Do results vary depending on the instrument being backtested / optimised?
- Some examples would greatly help to illustrate any answer to my questions!
Hi Mathew
It is little bit interesting why the system got more profit with spread = 50 than spread = 2. So this is not exactly the classic example of high spread = small profit scenario. One of the reason behind this is that I built this system in high spread environment like around 5 pips (50 points).
But even this system does not make much profit if spread = 100 points (10 pips). It will probably lose money if spread = 200 points (20 pips) I guess. No trick to bend this physical law (high spread = less profit for us). Teach me if you have one. :)
Regards.
then in strategy tester , it doesn't change
How do you change the spread within the Strategy Tester?
Working with build 2485
then in strategy tester , it doesn't change
How do you change the spread within the Strategy Tester?
Working with build 2485
is there a forum thread with ALL known bugs and issues with MT5 product?
I found a work-around solution for this using both methods TesterDeposit() and TesterWithdrawal().
Let's say the average spread on USDJPY is 0.006 (6 points) and as per the backtesting terminal it shows 0.01. Since the difference is 4 points, you can use TesterDeposit() to simulate a rebate for the account by that amount.
The other way around, if the backtesting terminal shows spread less than the real spread by your broker, you can simply deduct the difference using TesterWithdrawal().
The below code will demostrate further.
double Ask = NormalizeDouble(SymbolInfoDouble(Symbol(), SYMBOL_ASK), _Digits); double Bid = NormalizeDouble(SymbolInfoDouble(Symbol(), SYMBOL_BID), _Digits); double terminalSpread = ((Ask - Bid) * 100000) / Ask; //Get the current spread in USD form double rebate = terminalSpread - 6.85; // 6.85 is my broker total cost (spread + commission) in USD. if(rebate > 0){TesterDeposit(rebate); rebates += rebate;}else if(rebate < 0){TesterWithdrawal(MathAbs(rebate)); rebates -= rebate;} //If rebate > 0 then credit the difference, if rebate < 0 then deduct the difference.
Good luck!

- 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 spent nearly 8 hours to find out how to change spread during backtesting and optimization.
I googled everywhere even thinking of using paid software on the net. Please don't do that.
MT4 has a built in feature so you can change spread during backtesting or optimization.
Just sharing this just in case someone want to do the same things.
Kind regards.