Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 485

 
Artyom Trishkin:

Isn't there going to be a requote? I think the first answer to the question about requotes in the tester (!!!) is that the opening prices are mixed up.

Or have I already forgotten everything?

Vladimir Zubov:

There will be requotes in the tester too.

Run it in the tester

void OnTick()
  {
   if(OrdersTotal() == 0)
    {
     Print("Bid = ", Bid);
     int ticket = OrderSend(_Symbol, OP_BUY, 0.1, Bid, 50, 0, 0);
     if(OrderSelect(ticket, SELECT_BY_TICKET))
      Print("OrderOpenPrice ", OrderOpenPrice());
    }
  }

And see the result.

2018.03.03 09:36:58.521 2017.01.02 00:00:00  Test button click EURUSD,H1: OrderOpenPrice 1.05119
2018.03.03 09:36:58.521 2017.01.02 00:00:00  Test button click EURUSD,H1: open #1  buy 0.10 EURUSD at 1.05119 ok
2018.03.03 09:36:58.521 2017.01.02 00:00:00  Test button click EURUSD,H1: Bid = 1.051
 
Vladislav Andruschenko:

I agree with you.

This topic is very hackneyed and there is still no 100% solution to the problem of wrong stops.

  1. 2*spread
  2. 3*spread
  3. 0-1 point

all of these options have a place.

If you can pull a floating spread in the symbol information, why you can't pull a floating stop level is unclear to me.

So, this is the idea. After all, the stop level is regulated by the broker.

They may change it as they wish, even 10 times more during news releases.

Why not? A zero SYMBOL_TRADE_STOPS_LEVEL indicates a floating (not equal to zero, but floating) stop. And then you have to guess - once or twice you can catch a 130 error, gradually increasing the size of the stop in accordance with the spread.

 
Alexey Viktorov:

Run it in the tester

And see the results.


That's because the slippage is setto 50

 
Artyom Trishkin:

Why is it impossible? The zero SYMBOL_TRADE_STOPS_LEVEL indicates a floating (not equal to zero, but floating) stop-loss. And then you have to guess - once or twice you can catch a 130 error, gradually increasing the stop size in accordance with the spread.

Exactly, that's guessing. :-)

The stop-loss ratio can also change from broker to broker, from news release, the dealing director's birthday and so on.

Even the brokerage company regulations say about it.

 
Alexey Viktorov:

Run it in the tester

And see the results.

Strange. Maybe these builds of the terminal have already been corrected for a long time...

I made these "childish" errors a long time ago (about 10 years ago) - and then there were requotes in the tester. I could not understand why. But then I realized I was buying with Bid :) Since then I remember that behavior, but I have never caught it myself again - once is usually enough not to continue writing codes that way.

 
Vladislav Andruschenko:


Are you 100% sure about this statement?

Vlad, further discussion on this issue is getting bogged down with discussion of the broker. So you better print out the prices, spreads, compare and analyse them yourself.

As for exactly two spreads, this goes back to the very introduction of floating spreads. That's when I read about it, use it and don't want to remember where I read it, who wrote it and other details.

 
Vladislav Andruschenko:

Exactly, that's guessing. :-)

The stop-loss ratio can also change from broker to broker, from news release, the dealing director's birthday and so on.

We may use the Stop-Loss factor as an indicator and we will see what happens when we do this.

Well, this is water.

I wrote what to do. Unfortunately, there is no other way.

 

This way has been used for a long time and by everyone.

There are dozens of threads on the forum.

But no one has ever proved that it should be multiplied by 2 (and not by 3).

Alexey Viktorov:

Vlad, further discussion of this issue descends into a discussion of the broker. So you better print out the prices, spreads, compare and analyse them yourself.

As for exactly two spreads, that stretches back to the very introduction of floating spreads. That's when I read about it, use it and don't want to remember where I read it, who wrote it and other details.

I don't need it. I asked you if you were sure about it or if you think so because it works. (But you haven't tested this theory on 100+ brokers)

Does it work for you? fine. I was only hinting - that you don't have to be so sure about it.

You can get caught...


If the stops are too small - it's easier to close virtually.

 

So you can get out of this situation - if there is an error, then each time you try to modify the order, the stop will have to be increased by 1 pip. Until the order is modified normally.

It turns out like this.

 
Vladislav Andruschenko:

This way has been used for a long time and by everyone.

There are dozens of threads on the forum.

But no one has ever proved that it should be multiplied by 2 (and not by 3).

I don't need it. I asked you if you are sure or if you think so because it works. (But you have not tested this theory on 100+ brokers)

Vlad, apart from other schemes that are risky to discuss, there is also the natural price change between sending an order and executing it. In one case the price deviation may increase the distance from the current price to the set stop, and in another case it may decrease it. And in this case the distance from the price, exactly from the current price, rather than from the order opening price will be less than two spreads. It is in this case that you will get an error.
Reason: