You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Didn't read the other answers, the solution may be out there.
If I understood correctly: there're two closed trades. You want to get the closing time of the last trade and the opening time of the second to last trade and get the highest price in the mean time.
This code should work (not fully tested and may not be the best solution):
Didn't read the other answers, the solution may be out there.
If I understood correctly: there're two closed trades. You want to get the closing time of the last trade and the opening time of the second to last trade and get the highest price in the mean time.
This code should work (not fully tested and may not be the best solution):
Thank you. I will test this and see
https://www.mql5.com/en/docs/basis/function/functionoverload
Thanks for the advice
Thanks for the advice
You don't want “the last two closed trades.” You want the last two on the current chart. Go through the list and find them.
Do not assume history has only closed orders.
OrderType() == 6, 7 in the history pool? - MQL4 programming forum #4 and #5 (2017)
Do not assume history is ordered by date, it's not.
Could EA Really Live By Order_History Alone? (ubzen) - MQL4 programming forum (2012)
Taking the last profit and storing it in a variable | MQL4 - MQL4 programming forum #3 (2020)
You don't want “the last two closed trades.” You want the last two on the current chart. Go through the list and find them.
Do not assume history has only closed orders.
OrderType() == 6, 7 in the history pool? - MQL4 programming forum #4 and #5 (2017)
Do not assume history is ordered by date, it's not.
Could EA Really Live By Order_History Alone? (ubzen) - MQL4 programming forum (2012)
Taking the last profit and storing it in a variable | MQL4 - MQL4 programming forum #3 (2020)
That's some new insights I didn't know about. I will definitely look into that. Thanks.