Errors, bugs, questions - page 2404

 
Ilya Malev:

So let it work, who's stopping it? It doesn't work the way MT4 worked anyway, so it's up to you to change this behaviour for 90% of the time, or for the remaining 10%.

Waiting for an example of how to use this behaviour?

 
Ilya Malev:

Do you need an advisor to write one? I think you can do it yourself as well as I can.

You often mention SELECT_BY_TICKET but you don't give any practical use of it.

I do not use this construct myself. Moreover, I think that using it in MT4 is dangerous.

Ilya Malev:

In 90% of cases it's not SELECT_BY_TICKET in history, but it's working with orders as with indivisible entities. Partial closing or opening is a rarity for most forex brokers. Usually they either close/open the order completely or give an offquote

MT5 is also an exchange platform where partial is not at all uncommon. Moreover, there was an example above where the user closes his position partially. It is a perfectly normal practice when, for example, the trader closes a position in parts at different price levels.
 
fxsaber:

You often mention SELECT_BY_TICKET, but you don't give any practical application.

I do not use this construct myself. Moreover, I think that using it in MT4 is dangerous.

Maybe you are right, but this is a part of functionality that does not work in your library the same way as it does in MT4. I actually pointed to this fact without any intention to comment on it.

 
Ilya Malev:

You may be right, but this is a part of the functionality that works differently in your library than in MT4. I actually pointed out this fact without any intention to comment on it.

It is specifically mentioned in the discussion of the library. Relevant examples and arguments are given for the fact that even on MT4 to use SELECT_BY_TICKET is a bad trading logic.

 
Ilya Malev:

If you don't think this mode should be used at all, then make it like it was in MT4 and don't recommend using it.

This mode can be useful in certain situations.

Just in case - server's behaviour during partial closing in MT4 was different for different brokers and is not guaranteed to be the way you described it

You can try to look for a place where in a partial close in MT4 the position will not change the ticket. The code above has been given.

 
Ilya Malev:

1. Maybe I should ask you to give an example now (just not in this thread, it's already cluttered)

We saw a closed position in the terminal history. We need to quickly get its data - we wrote a ticket in the script and that's it.

Or we need to sort the trading history in our own way. Sort the tickets and select.

2. I actually don't care, if it changes the ticket at partial closing or not, because it has no effect on the order selection within the ticket when the partial closing is not used. And when you use it, you should either look at the comment (MT4), or select deals by position number (MT5).

Everything is selectable by ticket. It's just the position's ticket changes when you close it. This is the only difference from MT4.

 
Ilya Malev:

So you need to make an additional function that allows to find out the changed ticket number from the old number, instead of insisting that the SELECT_BY_TICKET functionality that existed in MT4 was "wrong". Although that's your business of course.

There is an MT5-functional that coders may need, but it's hard to implement. And there is the one that is easy to implement but hardly needed.

It makes sense to do something only in the first case. For example, OrderOpenPriceRequest is a super thing, because it's elementary to calculate slippage on opening.

But OrderTicketOld is a very simple thing (POSITION_ID) and about nothing. Here's the opening deal ticket - the thing is hard to implement, that's why it's done.

 
Ilya Malev:

You have a requirement in the libraries part that the Expert Advisor must be written "in MT4-style". Based on this requirement, it is reasonable to implement a function that fits exactly into this style, allowing you to write code as well as you could on MT4.

You haven't shown an EA that wouldn't work.

 
Flood
 
fxsaber:

Partial closing is not necessarily a partial fill on the server side.

So how to select 0.2 closed lots in such a situation in MT5?

I have no idea about it in MT5, but in MT4 I was looking for an opportunity to make a partial close of an order and find a new ticket but without using OrderComment() field

everything works in general like in MT4:

- select an order in the list of market orders and get a ticket

- we request OrderClose() - we get true

- the old ticket has gone into the orders history and a new market ticket has appeared; if the order was closed completely (not partially), no new ticket will appear

The topic of partial closing in MT4 is interesting enough, I asked, but alas, all the Guru have sent to seek happiness in OrderComment() - I do not like it, but apparently people do not bother, a topic with a discussion of an effective algorithm first for MT4, I would have participated


SZY: I can't find the source code, I don't like the implementation - I saved market order tickets into an array and immediately after a partial closing I used ArrayBsearch() to find an order missing in the array, i.e. a new ticket