SYMBOL_SPREAD different between MT4 and MT5 ?

 

Hi,


Does anyone know the logic behind the SYMBOL_SPREAD in MT4 and MT5? When checking its return value in MT4 and MT5 its different results on exact same symbol in the same period. In MT4 it seems like its a fixed value but in MT5 it seems to be the the "real" spread which is changing accordingly through the day. I ran it through the strategy tester in both MT4 and MT5 and the results is of course totally different when the spread differs this much. 


Is there a logic explanation to this?


long spread = SymbolInfoInteger(_Symbol,SYMBOL_SPREAD);
Comment("Spread: ",spread);
 

That can also be related to the account type.

For example a fixed or variable spread.

Also spreads differ slightly between trading servers.

However in the case of MT4 strategy tester it will be a fixed value, unless you artificially inflate and deflate a linked extra value in the code.  

The Fundamentals of Testing in MetaTrader 5
The Fundamentals of Testing in MetaTrader 5
  • www.mql5.com
The idea of ​​automated trading is appealing by the fact that the trading robot can work non-stop for 24 hours a day, seven days a week. The robot does not get tired, doubtful or scared, it's is totally free from any psychological problems. It is sufficient enough to clearly formalize the trading rules and implement them in the algorithms, and...
 
Kjetil Sandvik: n MT4 it seems like its a fixed value but in MT5 it seems to be the the "real" spread which is changing accordingly through the day.

Exactly. On MT4:

Always specify Tester-SpreadDon't use current

The spread is constant during the run. It is the current spread for the pair (your broker), at the moment you start the test.

If you start the test on the weekend, the current spread is likely to be very large.

Most brokers with variable spread widen considerably at end of day (5 PM ET) ± 30 minutes. My GBPJPY (OANDA) shows average spread = 26 points, but average maximum spread = 134 (your broker will be similar). The charts show Bid prices only. Turn on the Ask line to see how big the spread is, Tools → Options (control+O) → charts → Show ask line.
 
Thanks alot for clarifying!
Reason: