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

 
PapaYozh:

Don't you have anyone to talk to?

What do you mean? Igor threw a frantic text message at my head. Of course there is no need to get so twisted, but if you can't, but really need to, then you can.

And by bringing up a topic like this, you wanted a serious discussion for 40 pages? Everything that can be said about it seriously has already been said.

 
Alexey Viktorov:

Call it a hedgehog, it won't make any difference. Look closely, how are they different? There is also opening price, opening time, take and stop and everything else an order has in 4.

We have adopted this terminology and that's it. You may get used to it and use it even in 4.

For example, we have the function of order open price in 4

if(OrderSelect(aTicket, SELECT_BY_TICKET))
  return OrderOpenPrice();

If we need to know the profit by an order, we can do this

if(OrderSelect(aTicket, SELECT_BY_TICKET))
  return OrderProfit();

Try to solve these two problems in 5. How much time it will take you to solve them. You won't succeed at the first attempt anyway until you run the algorithm on a real account and face what you have not seen in the tester. Not everyone has so much time to understand and write large-scale libraries. That's why they say MT4 is easier, simpler. It's just elementary less time consuming because of its simplified order system.

 
Vasiliy Pushkaryov:

For example, there is a function in Foursquare to take the open price of an order

You need to know the profit by an order.

Try to solve these two tasks in 5. How much time it will take you to solve them. You won't succeed at the first attempt anyway until you run the algorithm on a real account and face some problems that you would not have encountered in the tester. Not everyone has so much time to understand and write large-scale libraries. That's why they say MT4 is easier, simpler. It's just that less time is spent on it because of its simplified order system.

I don't even know how to tell you...

POSITION_VOLUME

Position volume

double

POSITION_PRICE_OPEN

Position price

double

POSITION_SL

Stop loss level for open position

double

POSITION_TP

Take Profit level for open position

double

POSITION_PRICE_CURRENT

Current price for the symbol

double

POSITION_SWAP

Accumulated swap

double

POSITION_PROFIT

Current profit

double

 
Vasiliy Pushkaryov:

For example, there is a function in Foursquare to take the open price of an order

You need to know the profit by an order.

Try to solve these two tasks in 5. How much time it will take you to solve them. You won't succeed at the first attempt anyway until you run the algorithm on a real account and face some problems that you would not have encountered in the tester. Not everyone has so much time to understand and write large-scale libraries. That's why they say MT4 is easier, simpler. It's just that less time is spent because of its simplified order system.

At the same time in 4ka it is not possible to set the order execution type. And there were also many wishes to do the same as for the broker, and they are well grounded. These are 2 different ways of communication with the exchange, securities brokerage companies. One is simplified, the other is the closest to reality and therefore more complex. And the pros of optimisation and matan are undeniable.

The 4k should be maintained. This is a simple, handy tool with enough possibilities both for trading and for research.

5ka needs to be developed to stay afloat among other offerings.

 
Alexey Viktorov:

I don't even know how to tell you...

POSITION_VOLUME

Position volume

double

POSITION_PRICE_OPEN

Position price

double

POSITION_SL

Stop loss level for open position

double

POSITION_TP

Take Profit level for open position

double

POSITION_PRICE_CURRENT

Current price for the symbol

double

POSITION_SWAP

Accumulated swap

double

POSITION_PROFIT

Current profit

double

What if I now need to look at closed entities. Nothing has changed in 4. What about in MT5?
 
Vasiliy Pushkaryov:

For example, there is a function in Foursquare to take the open price of an order

You need to know the profit by an order.

Try to solve these two tasks in 5. How much time it will take you to solve them. You won't succeed at the first attempt anyway until you run the algorithm on a real account and face some problems that you would not have encountered in the tester. Not everyone has so much time to understand and write large-scale libraries. That's why they say MT4 is easier, simpler. It simply takes less time because of its simplified order system.

your code has no checks, so in 5 it will be similar, usePositionSelectByTicket, this will copy the properties of the position to the environment.... then the principle will be the same as in MT4


Ok, the topic is as old as the world, especially now we are engaged in a blitz-survey: "Who understood what from MT5 Help". ,

the help is detailed, it is enough even without the article material on the order system and the standard library of MT5

 
Vasiliy Pushkaryov:
What if I now need to look at closed entities. Nothing has changed in 4. What about in MT5 now?
I want to understand, is this an exam for me or a free lesson for you? Learn to read the language documentation. There is a lot of interesting stuff there.
 
Alexey Viktorov:
I want to understand, is it an exam for me or a free lesson for you? Learn to read the language documentation. There is a lot of interesting stuff there.

Yeah, no. It's just that recently, after closing a position, I decided to take a profit on it. And it wasn't for 5 minutes, as it used to be in 4. I had to organize a loop with overshooting of trades. Then it turned out that it is not always possible to get profit immediately after closing a position. I had to wrap it in one more loop. I spent half a day on it. My point is this.

Look carefully, how do they differ? There is also opening price, open time, take and stop and everything else the order has in 4.

Do not overreact, I did not intend to give anyone an exam.

 

Vasiliy Pushkaryov:

Don't overreact, I wasn't going to give anyone an exam.

Well, if it's not an exam, it's a literacy lesson. Pay attention to such a position property as POSITION_IDENTIFIER

bool  HistorySelectByPosition(
   long   position_id     // идентификатор позиции - POSITION_IDENTIFIER
   );

...and you won't have to do any 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.


ps; this concludes the illiteracy lecture. :-)))

Документация по MQL5: Торговые функции / HistorySelectByPosition
Документация по MQL5: Торговые функции / HistorySelectByPosition
  • www.mql5.com
HistorySelectByPosition - Торговые функции - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Vasiliy Pushkaryov:

Yeah, no. It's just that recently, after closing a position, I decided to take a profit on it. And it wasn't for 5 minutes, as it used to be in 4. I had to arrange a loop with overshooting trades. Then it turned out that it is not always possible to get profit immediately after closing a position. I had to wrap it in one more loop. I spent half a day on it. What is my point?

I did not want to make an exam.

Well, this is the price for the speed of MT5 - all trade orders are asynchronous, i.e. MQL5 does not wait for answers from the server and 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

Reason: