Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1024

 

Guys, do you have a ready-made method - a function that returns the type of the last closed position, exactly the position.

It is clear that there are no positions in the history as such, but I cannot understand how everything that belongs to it is collected in order to understand which position was last long or short

Совершение сделок - Торговые операции - MetaTrader 5
Совершение сделок - Торговые операции - MetaTrader 5
  • www.metatrader5.com
Торговая деятельность в платформе связана с формированием и отсылкой рыночных и отложенных ордеров для исполнения брокером, а также с управлением текущими позициями путем их модификации или закрытия. Платформа позволяет удобно просматривать торговую историю на счете, настраивать оповещения о событиях на рынке и многое другое. Открытие позиций...
 
Konstantin Seredkin:

Guys, do you have a ready-made method, a function that returns the type of the last closed position, exactly the position.

It is clear that there are no positions in the history as such, but I cannot understand how everything that belongs to it is collected in order to understand which position was last long or short

Find the last position with property DEAL_ENTRY_OUT, get a ticket, find deal DEAL_ENTRY_IN and that's all. Using it, you determine the type of deal. For greater certainty that the position is closed completely, you can try to select it on the received ticket. If it is not selected, then it is closed completely.

 
Alexey Viktorov:

Find the last position with DEAL_ENTRY_OUT property, get a ticket, find DEAL_ENTRY_IN deal and that's it. Using it, you determine the type of deal. For greater certainty that the position is closed completely, you can try to select it on the received ticket. If it is not selected, then it is closed completely.

I should try to analyze it, I have always wondered why developers have not done it until now, we have everything and there is no possibility to find out in which direction the position was opened after its closing, I have to write methods myself.
 
Konstantin Seredkin:
I should try to figure it out, I've always wondered why developers haven't done it until now, everything is there, but there is no way to find out which way the position was set after closing it, I have to write methods myself.

Really... And they would not do it if only one phrase - "Make some money" - would give profit to the terminal: ))))

 
And why can't you actually implement a reference to the position history? I mean, by standard means.
 
Сергей Таболин:
And why can't you actually implement a reference to the position history? I mean by standard means.

Because a position is a derivative of an order and a deal. We work with an order, and as a result of negotiations a deal occurs. Then a position appears and again a warrant, a deal, and there is no position. But in the history, we can always track ALL of the orders and deals which affected the change of position. And let me tell you a little secret: As opposed to mql4, in mql5 you can change the magic position during modification and even during closing. The definition of a magik in MT5 is a bit different. In MT4 it is the order master and in MT5 it is the ID of the EA that changed the position properties.

 
Alexey Viktorov:

Because the position is a derivative of an order and a trade. We work with an order, as a result of which a deal takes place. Then comes the position and again a deal, and there is no position. But in the history, we can always track ALL of the orders and deals which affected the change of position. And let me tell you a little secret: As opposed to mql4, in mql5 you can change the magic position during modification and even during closing. The definition of a magik in MT5 is a bit different. In MT4 it is the order master and in MT5 it is the ID of the EA that changed the position properties.

Thank you, that's all understandable.

But when a position appears, it would be desirable to remember it, as well as its closing. That would make a history of positions (as well as order and transaction history ). I am still surprised that there is no such history in MT.

However, I understand, if only mushrooms would grow in your mouth ... )))

 

It's all in the terminal, if you go into the history, it's all implemented there, it would just be nice to have quick access to it


 

Good evening, everybody.

Please tell me which broker has index trading tools on MT5, such as AUDLFX; EURLFX; USDLFX

 
Konstantin Seredkin:

Guys, do you have a ready-made method - a function that returns the type of the last closed position, exactly the position.

It is clear that there are no positions in the history as such, but I cannot understand how everything that belongs to it is collected in order to understand which position was last in long or short

Kim's functions to help.

Reason: