Amon1953: This is probably a simple and naive question, but I've already racked my brain aboutHistorySelectByPosition(ORDER_MAGIC==1) I needa history of positions with magic = 1. Something I don't understand. Whatever I do, I don't get the history. Where should I enter the number of a magician?
In five, order !=position. And a transaction. An order (order) generates a trade. And a deal gives rise to a position, either changing it or closing it.
Accordingly, to find how a position was closed, you need to select the trades of this position, find the closing trade and look at its properties - the reason for closing may be specified there.
but I've tried it this way.
What function should I use next to go through the closed positions?
Which function should I use next to go through the closed positions?
What should be done with the found orders anyway?
I need to find the last closed SL position to make a decision
if(HistorySelectByPosition(ORDER_MAGIC==1))
{
int PosTotal= ??? which function to use?
Alert("PosTotal ",PosTotal);
for(int i=PosTotal-1; i>=0; i--)
{
Alert("PositionsTotal ",PosTotal);
}}
I need to find the last closed SL position to make a decision
There is a huge difference between
a) Find out if the last position closed at stop, and
b) Find the last position closed by a stop.
--------
What do you need?
I need to find the last closed SL position to make a decision
I'm not good at MQL5, but I think the search should start like this
I'm not good at MQL5, but I think the search should start like this
I need a closed position, not a trade or order
I need a closed position, not a trade or order
Confused
HistoryOrderSelectConfused
HistoryOrderSelectHow can a warrant help?
How can a warrant help?
The original question was
This is probably a simple and naive question, but I've already racked my brain aboutHistorySelectByPosition(ORDER_MAGIC==1) I needa history of positions with magic = 1. Something I don't understand. Whatever I do, I don't get the history. Where should I enter the number of a magician?
The original question was.
In five, order !=position. And a transaction. An order (order) generates a trade. And a deal gives rise to a position, either changing it or closing it.
Accordingly, to find how a position was closed, you need to select the trades of this position, find the closing trade and look at its properties - the reason for closing may be specified there.