Questions from Beginners MQL5 MT5 MetaTrader 5 - page 881

 
Vladimir Karputov:

To do this, you need to collect (restore) a virtual position from the trading history.

But almost no one needs this. Use trades from the trading history - that is enough in 99% of cases.

So how to use? There is only the time of opening a position, how do I know the time of the last deal in a closed position?

 
lil_lil:

So how do I use it? There is only the time of opening a position, how do we know the time of the last trade in a closed position?

An easier variant: we recognize the trade type (BUY or SELL), trade direction (IN, OUT) and trade time. All this is caught and done in OnTradeTransaction. There, thanks to ENUM_DEAL_REASON, it is immediately visible whether this trade was closed at Take Profit or Stop Loss.

 
Andy:

Please ask this question.

If you check the size of a candle (for example, the opening price minus the closing price on a bearish candle), then when comparing an already closed candle on M5 with a size of 3 pips with this number (0.0003), if the condition is equal, it does not always show that the condition is met, but if the sign > 0.0003, it always holds on a 4 pips candle.

It turns out that the size of a candle is not exactly 3 points or what else might be the reason?

See reference double. Comparison of real numbers.

 
Vladimir Karputov:

There is an easier way: we recognize the type of trade (BUY or SELL), the direction of the trade (IN, OUT) and the time of the trade. All this is caught and done in OnTradeTransaction. Also thanks to ENUM_DEAL_REASON it is immediately visible whether this trade was closed at Take Profit or Stop Loss.

But what if the Expert Advisor was not active at that time? We would like to get the data from the account history. But unfortunately, this cannot be done in an unambiguous way. Only with a lot of reservations.

 
Ihor Herasko:

What if the EA was not active at the time? After all, we would like to get the data from the account history. But this, unfortunately, cannot be done in an unambiguous way. Only with a lot of reservations.

Then there is only one option: to restore the virtual position with all trades included into it.

Something likeHistoryPositionInfo version 2. Only we need to refine the output of entry and exit prices.
 
Andy:
Excuse me, can we explain here?

Without the reference, it's very simple. The == sign means absolute equality. The > sign means more and will show exactly when it is more, i.e. 4, 5, etc. The >= sign, on the other hand, means more or equal and will show 3, 5 and more...

 
Andy:
And the >= sign does not always show 3, sometimes it skips.

You have been given a link to the help, which explains exactly why and how to do this. Or should I read it aloud to you at bedtime? Tell me the address where to come, but prepare a tidy sum of money.

 
Andy:
And the >= sign does not always show 3, sometimes it skips.

Then go to the help. The rules for comparing real numbers are well described there.

 
Andy:
The forum is for communication and you don't have to make fun of questions.

You were given a link to a reference that answers your questions. But you don't even want to follow the link. Why not make fun of the mega lazy guy?

 
Andy:
I've already read everything, and my post was not to you, but in response to another forum member.

The forum is for communication

Reason: