The great and terrible MT4 forever (or how to strategise a transition) - page 6

 
Alexey Viktorov:

Well, if it's not an exam, it's a litmus test. Pay attention to the position property POSITION_IDENTIFIER

...and you won't have to do useless loops. A closed Hadge account position always has two trades... under index 0 opening and under index 1 closing, unless you did a partial close.

Partial closes are rare, but I use them and netting is used. That's why I've made it universal at once. Is it accurate to say that there can only be two trades for Hedge-positions? As in netting, the brokerage company cannot close partially or in parts depending on the execution policy?
 
Igor Makanu:

Well, this is the price for the speed of MT5 - all trade orders are asynchronous, i.e. MQL5 does not wait for the server's answer, but continues its work

in MT4 all trade orders received a synchronous response from the server


you need to ask what to do and not why

- either process the order closure on the next tick (either in the loop, or pause... or here it depends on the TS)

- or processOnTradeTransaction

I was transitioning from a four ). And these differences, while you encounter, feel, overcome and create an impression of complexity. So, yes, I found solutions in the branch "Peculiarities of mql5 language" and did it. It is clear that when your own library is ready, MT5 will not seem so cumbersome.
 
Vasiliy Pushkaryov:
...About Hedge-positions is it accurate that there can only be two trades? Can't the DC close partially or in parts as in netting, depending on the execution policy?

HistoryDealsTotal() always works and is always faster than cycling through the history of all orders and trades.

 
Alexey Viktorov:

HistoryDealsTotal() always works and is always faster than cycling through the history of all orders and trades.

This is what I do, I control position IDs and then use them for sampling. I just haven't encountered information that a position in a hedge always has only two trades, unless partial closing is used.
 

To switch to MT5 you have to buy it

Then the question is why when you have already bought MT4 ?

So there is only one way - cheaper upgrade or free.

And then the trader will be confronted with the fact that there is only MT5 and that's it.

 
I haven't seen a working MT5 solution for the following

Forum on trading, automated trading systems and trading strategies testing

Features of mql5 language, tips and tricks

fxsaber, 2018.02.15 11:48

I suggest trying to write a script in MQL5 with this kind of trading logic (MQL4-style just for quick sense display)

void OnStart()
{
  OrderCloseBy(OrderSend(_Symbol, OP_BUY, 1, Ask, 0, 0, 0), OrderSend(_Symbol, OP_SELL, 1, Bid, 0, 0, 0));
}

It's not easy at all.

And there are much more subtle situations... If a broker provides an MT4/5, all other things being equal, the choice is always clear.

 
Vasiliy Pushkaryov:
That's what I do, I control the position IDs and then sample them. I just haven't seen information that a position in a hedge always has only two trades unless partial closing is used.

Do you want a manual for every little thing?

 
fxsaber:
I haven't seen any working MT5 solutions for the following

And there are situations that are much more subtle... if a broker provides MT4/5 all other things being equal, the choice is always clear.

And you never will, for the simple reason that partial closing, or closing with a counter position, goes with the ticket of the position, and opening a position does not return the ticket. And anyway ... why such perversions? Probably, it's from that series how to close positions and delete pending orders with one cycle...
 
Alexey Viktorov:

Do you want a manual for every little thing?

Of course I would. I don't think I'm the only one.
Getting either a partial profit or a full profit when counting on information about a full one after all is no small thing for me. You can lose a lot of money by going through the experience route.

So the more detailed the help, the better.

 
Alexey Viktorov:
And you will never meet it for the simple reason that a partial close, or a counter position close goes on a position ticket, and opening a position does not return a ticket. And anyway... why such a perversion?

of code readability. In MQL4 it's immediately clear what's going on.

Reason: