Wrong prices when trades open MQL5 - page 2

 
RiccardoBorello01 #: Ok, here are the right pictures

You did not supply 2 different test results of two different spreads. How do you expect to debug the problem if you don't compare the two situations?

However, for your example, the spread for the buy order was 17 and for the sell order it was 16. This suggests a floating spread and not fixed spread. Are you sure you are setting the spread properly?

 
Fernando Carreiro #:

You did not supply 2 different test results of two different spreads. How do you expect to debug the problem if you don't compare the two situations?

However, for your example, the spread for the buy order was 17 and for the sell order it was 16. This suggests a floating spread and not fixed spread. Are you sure you are setting the spread properly?

This is precisely the problem: I do not understand why, whatever spread I set, the result does not change.

For example, even if I set the spread to 1000, these trades remain the same

 
RiccardoBorello01 #:

This is precisely the problem: I do not understand why, whatever spread I set, the result does not change.

For example, even if I set the spread to 1000, these trades remain the same

It is working for me, both on virtual ticks and on real tick data.

Floating ...    2020.01.06 10:01:35   market buy 0.1 EURUSD sl: 1.01572 (1.11668 / 1.11671)
100 points ...  2020.01.06 10:01:35   market buy 0.1 EURUSD sl: 1.01572 (1.11668 / 1.11768)

I'm using official build 3320. What build are you using?

 
Fernando Carreiro #:

It is working for me, both on virtual ticks and on real tick data.

I'm using official build 3320. What build are you using?

I have tried both on the official build 3320, and on the Oanda build 3325
 
RiccardoBorello01 #: I have tried both on the official build 3320, and on the Oanda build 3325

Is your code using the current symbol (e.g. "_Symbol") or is referencing the symbol by name? Is your EA perhaps multi-symbol?

 

Can you show a screenshot of your "Settings" panel?


 
Fernando Carreiro #:

Is your code using the current symbol (e.g. "_Symbol") or is referencing the symbol by name? Is your EA perhaps multi-symbol?

I use the current symbol, since in the code as a symbol parameter I put null

int ticket = trade.Buy(CalculateLotSize(diff*10000),NULL,0,longSL,longTP,"BUY");
int ticket = trade.Sell(CalculateLotSize(diff*10000),NULL,0,shortSL,shortTP,"SELL");

Here is the screenshot

Files:
settings.png  28 kb
 
RiccardoBorello01 #: I use the current symbol, since in the code as a symbol parameter I put null. Here is the screenshot

Can you try closing MetaTrader and then clearing/deleting all log files and all cache files and then restarting again?

Log files in folder "<data folder>\Tester\logs"

Cache files in folder "<data folder>\Tester\cache"

 

Also, try testing with virtual ticks to see if there is a difference and then come back to real ticks.

I think I remember once that it did not work for me and I did that and it started working again.

 
Fernando Carreiro #:

Also, try testing with virtual ticks to see if there is a difference and then come back to real ticks.

I think I remember once that it did not work for me and I did that and it started working again.

The virtual ticks are the ones obtained by setting the modeling to "every tick", right?

In this case I did everything and I noticed that obviously the trades are different between virtual ticks and real ticks, but the problem is still present in both cases