Questions from Beginners MQL5 MT5 MetaTrader 5 - page 261

 
YAndrey:
I have found time to study positions and their properties. I do not understand - if positions are opened and closed, how can I enumerate all historical positions that were opened and closed by the symbol? I want to select the entire history of positions for the symbol, and then search the history of deals for each historical position. How can I do this? It is described everywhere how to get the history of orders and deals, but how to get a list of positions??? You slightly misunderstood the question. I am not asking how to deal with a CURRENT position, it is obvious. How to get the HISTORICAL positions that used to be, but have gone into the past? I understand that the POSITION lives from the moment when the volume of deals becomes different from zero, to the moment when it became equal to zero. How to get a list of POSITION? Not orders and deals, but positions for the selected pair???

Although MetaTrader5 deals with net positions, it does not contain a history of net positions. This is surprising, but true. You can only access current, open positions. Historical positions are not directly available. The only thing you can do is to simulate the history of the positions based on the history of orders or deals. This is always a non-trivial solution, but there are several articles that describe these algorithms. Anatoly pointed out one of these articles to you.

YAndrey:
... I understand that the POSITION lives from the moment, when the volume of deals becomes different from zero, till the moment, when it is equal to zero.
If you trade on the FORTS, it is even more complicated. Positions are reopened at every clearing. Clearing takes place twice a day, at 14:00 and 18:45. If you opened a position in the morning at 10:01 and closed it in the evening at 20:00 and did not perform any other transactions, you will have three historical positions with different identifiers: 1. From 10:01 till 14:00 2. From 14:03 to 18:45 3. From 19:00 to 20:00
 
C-4:

...

If you trade on the FORTS, it is even more complicated. The position is reopened at every clearing. Clearing takes place twice a day, at 14:00 and 18:45. If you opened a position in the morning at 10:01 and closed it in the evening at 20:00 and did not perform any other transactions, you will have three historical positions with different identifiers: 1. From 10:01 till 14:00 2. From 14:03 to 18:45 3. From 19:00 to 20:00
Tremendous. ) And in this case, how to collect position history? Although, if this operation (reopening) is marked with comments, we can get to the beginning of the position by these comments. Are all properties of the originally opened position retained upon re-opening ? For example magic.
 
tol64:
Bummer. ) And how to collect the position history in this case? Although, if this operation (reopening) is marked with comments, then we can use them to get to the beginning of the position. When re-opening, are all properties of the originally opened position retained? For example magic.

It does not matter whether the broker maintains the properties of the position or not. After all, the position itself is not saved in the terminal history. After clearing, the position is closed, and in its place two trades are recorded with the direction of out and in and "variation margin close/open" in the comments. What kind of position this is, which initial order triggered it, and who owns it - all these fascinating questions are offered to us, the users.

Trade on the FORTS, gentlemen! This trains wit, programming skills and great analytical abilities.

 
C-4:

It does not matter whether the broker maintains the properties of the position or not. After all, the position itself is not saved in the terminal history. After clearing, the position is closed, and in its place two trades are recorded with the direction of out and in and "variation margin close/open" in the comments. What kind of position this is, which initial order triggered it, and who owns it - all these fascinating questions are offered to us, the users.

Trade on the FORTS, gentlemen! This trains wit, programming skills and great analytical abilities.

It seems to be simple.

The position is opened with its own comment. All deals that have comments "variation margin close/open" refer to the position the beginning of which is marked by a user. The closing of the position can also be marked with a comment or a magic mark.

 
C-4:

Although MetaTrader5 deals with net positions, it does not contain a history of net positions. This is surprising, but true. You can only access current, open positions. Historical positions are not directly available. The only thing you can do is to simulate the history of the positions based on the history of orders or deals. This is always a non-trivial solution, but there are several articles that describe these algorithms. Anatoly pointed you to one of these articles.

If you trade on the FORTS, it is even more complicated. A position is reopened on every clearing. Clearing takes place twice a day, at 14:00 and 18:45. If you open a position in the morning at 10:01 a.m. and close it in the evening at 8:00 p.m. without carrying out any other transactions, you will have three historical positions with different identifiers: 1. From 10:01 till 14:00 2. From 14:03 to 18:45 3. From 19:00 to 20:00.
What happens between 18:45 and 19:00? I get money in my account??? Is it blocked??? It turns out that there is no money and there is no position...? Is there a description anywhere?
 
YAndrey:
What happens between 18:45 and 19:00? Does money appear in my account??? Is it blocked??? Otherwise it turns out that there is no money and no position...? Is there a description anywhere?

Between 18:45 and 19:00 there is a stock market space-time singularity:)) Seriously, anything can happen at the time of clearing. The quote often shows crazy numbers in the tables and incomprehensible movements. It makes no sense to analyse these values.

In general, the brokerage calculation and variation margin accrual on FORTS deserves a separate detailed post in the trader's manual. I should gather my thoughts and post it. For demonstration purposes, let's analyze several real broker's reports. The system of their calculation is very different from the traditional calculation system of MT4 and even MT5.

 
barabashkakvn:

Several questions arise:

  1. what do you understand by "point"? If you take GBPJPY, the spread is about 63 pips or 6 pips.
  2. You cannot see any comments in this screenshot.
  3. This screenshot does not show links between orders and trades

Go like this: right-click on the "History" tab and select "Orders and Trades". It should look something like this:


Item by 4 digits.

In this screenshot, you can see how a profitable short-term trade closed at a loss instead of a profit. I need to pips at a total negative position, so as a series of pluses to bring the total loss to a total plus. How can I do this without closing the entire position?

Files:
1.jpg  236 kb
2.jpg  108 kb
 
superprofit:

Point by 4 characters.

In the screenshot you can see how a profitable short-term trade closed in a loss, instead of a profit. I probably use the wrong order type, but when I put a TP on part of a position, then the whole position is closed. I need to pips at a general negative position to output a series of pluses to bring the overall loss in the overall plus. How do I do this without closing the entire position?

In the second picture, we cannot see the history of "creation" of a sell position on NZDUSD. In the picture you can only see the sell at 0.87314 and the buy the next day at 0.87169. If the total position would have been 0.02 lots, there should have been a profit, BUT 0.02 lot has closed only a part of the position. In this case only the minus is shown, not the plus as it would be desirable. Therefore, when you close the entire position, look at what prices and at what lots the entries and exits were.
 
paladin800:
In the second figure you cannot see the whole history of "creation" of a sell position on NZDUSD. In the picture you can see only selling at 0.87314 and buying the same amount at 0.87169 the next day. If the total position would have been 0.02 lots, there should have been a profit, BUT 0.02 lot has closed only a part of the position. In this case only the minus is shown, not the plus as it would be desirable. Therefore, when you close the entire position, look at what prices and at what lots the entries and exits were.

I have to ask: is it a minus, not a plus, but it's actually a plus? In Mt4, everything is simple - you open an extra position, which closes on the plus side. In Mt5 -132 is it a real minus or only minus in the report and on the balance? Are you really a theorist too, that you cannot answer?

Is it possible that nobody can give an answer to a simple question: whether you can win back the total deficit by 10 pips by pips?

You open 0.02 lots by 100 (no matter what is the currency) to the south, add the same 0.02 to sell by 120. In total you sell 0.04 by 110. Then we sold another 0.02 at 130 and closed it at 125 and did it 100 times (we increased the total volume up to 0.06 at 130 and reduced it to 0.04 at 125). The last "current" quote is 125. Well, how much easier to formulate a question? There is a whole forum of theorists, or what?

 
superprofit:

I have to ask: is it a minus, not a plus, but it's actually a plus? In Mt4, everything is simple - you open an extra position, which closes on the plus side. In Mt5 -132 is it a real minus or only minus in the report and on the balance? Are you really a theorist too, that you cannot answer?

Is it possible that nobody can give an answer to a simple question: whether it is possible to make back a total deficit with pipsips at 10 points?

You open 0.02 lots by 100 (no matter what is the currency) to the south, add the same lot 0.02 to 120 and total 0.04 to 110. Then we sold another 0.02 at 130 and closed it at 125 and did it 100 times (we increased the total volume up to 0.06 at 130 and reduced it to 0.04 at 125). The last "current" quote is 125. Well, how much easier to formulate a question? A whole forum of theorists, or what?

The difference between MetaTrader5 and MetaTrader4 is in the principles of trading. In MetaTrader5 you can open:

A position

A position is a market commitment, the number of contracts bought or sold on a financial instrument. A Long position (Long) is an obligation to buy or sell a financial instrument, and a Short position (Short) is an obligation to deliver it, expecting the price to fall in the future. For each account, only one position for each financial instrument can exist.

That is, if there is a Sell position of 0.08 lots for ХХХУУ instrument, an attempt to open a Buy position with 0.02 lot volume will result in keeping a Sell position of 0.06 volume on your trading account. And if the position with the volume of 0.08 is originally unprofitable, you can't make this position profitable by partial closing.

Reason: