Something weird about variable spread
Something weird about variable spread
In mt4 strategy tester in journal tab, I see that variable spread is enabled. But as you can see in the picture when I change the spread value in strategy tester the results are changing drastically. As much as I know changing spread in strategy tester shouldnt effect anything because variable spread is already enabled. Am I wrong?
Found a bug, most probably
I just realized when I start backtesting applying the steps described in this link: http://tickstory.com/forum/viewtopic.ph ... caaaff8b75 , even though in the journal it says variable spread enabled, its not. For comparison I did a backtest with Advanced Tester and then Tickstory and I got the same results. Also when variable spread is applied, changing the spread value in strategy tester shouldnt have any effect, but in this situation it does. Lowering this spread value gave better results.
So I downloaded tick data without applying steps 2-a and 2-c. And I filled in the necessary details in Advanced Tester and loaded MT4 this way. Variable spread is working now. Changing spread value in strategy tester doesnt change results anymore.
So I downloaded tick data without applying steps 2-a and 2-c. And I filled in the necessary details in Advanced Tester and loaded MT4 this way. Variable spread is working now. Changing spread value in strategy tester doesnt change results anymore.
Re: Something weird about variable spread
Hi Gu00hero,
Thanks for your report. Could you please confirm what formula you are using to calculate spread? There are several ways to get spread in MQL, one is:
SymbolInfoInteger(Symbol(),SYMBOL_SPREAD) or Ask-Bid
and the other is:
MarketInfo(Symbol(),MODE_SPREAD)
The latter formula will always give you the value that is set in the MT4 Strategy Tester 'Spread' field. The first will give you the difference between Ask and Bid price (i.e. spread=Ask-Bid).
If your EA is relying on the MODE_SPREAD method for any of its calculations then you will see differences as you change the MT4 'Spread' field.
Take a look at the section on 'Spread' in the manual for more information.
If you are continuing to have issues, could you please try the attached EA and see if you have the same problem? The EA simply prints two lines in the Strategy Tester journal:
1) The actual difference between Ask and Bid Price using both "Ask-Bid" and "SYMBOL_SPREAD" methods.
2) The value of MODE_SPREAD.
For 1), you should see this match the value of 2) when Variable Spread is not enabled. When Variable Spread is enabled, you will expect to see the embedded variable spread while the MODE_SPREAD will continue to show whatever is specified in the MT4 Spread field.
Please let us know if you don't see the same.
Thanks.
Thanks for your report. Could you please confirm what formula you are using to calculate spread? There are several ways to get spread in MQL, one is:
SymbolInfoInteger(Symbol(),SYMBOL_SPREAD) or Ask-Bid
and the other is:
MarketInfo(Symbol(),MODE_SPREAD)
The latter formula will always give you the value that is set in the MT4 Strategy Tester 'Spread' field. The first will give you the difference between Ask and Bid price (i.e. spread=Ask-Bid).
If your EA is relying on the MODE_SPREAD method for any of its calculations then you will see differences as you change the MT4 'Spread' field.
Take a look at the section on 'Spread' in the manual for more information.
If you are continuing to have issues, could you please try the attached EA and see if you have the same problem? The EA simply prints two lines in the Strategy Tester journal:
1) The actual difference between Ask and Bid Price using both "Ask-Bid" and "SYMBOL_SPREAD" methods.
2) The value of MODE_SPREAD.
For 1), you should see this match the value of 2) when Variable Spread is not enabled. When Variable Spread is enabled, you will expect to see the embedded variable spread while the MODE_SPREAD will continue to show whatever is specified in the MT4 Spread field.
Please let us know if you don't see the same.
Thanks.
- Attachments
-
- Variable Spread Test.mq4
- (2.64 KiB) Downloaded 449 times