function () which returns true if the position is closed by the TP or Sl
Yes: bool closedByTPorSL(int position){ return positionClosed(position); }
How To Ask Questions The Smart Way. 2004
Be precise and informative about your problem
On Mql4 it was easy, we just had to compare if orderpriceclose() == ordertakeprofit()
On mql5 there is no corresponding function.
I tried with ordergetdouble (ORDER_TP) but it returns 0
if someone could give or write me a simple code to check if my order hit the TP
and at the same time simply explain to me the difference between Order, Deal, Position
-
That will not work! Doubles are rarely equal. Understand the links in:
The == operand. - MQL4 programming forum #2 2013.06.07And There can be slippage.
- Best you can do is bool isByTP = MathAbs(OrderClosePrice() - OrderTakeProfit()) < MathAbs(OrderClosePrice() - OrderStopLoss());
Hello ,
I would like to know if a function that returns true if the postion (select by ticket) reached the TP or SP exists ?
Or check if the position is closed by a reverse transaction.
I have researched in the documentation and the forums but I don't know how.
Sorry, if there are grammar mistakes because I speak French and I use the translation.