- Thomas Pierre Maurice Moine:
MQL4 - Get the delay (between open/close) of execution of lasts trades
Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
General rules and best pratices of the Forum. - General - MQL5 programming forum? (2017)
Next time, post in the correct place. The moderators will likely move this thread there soon. - Thomas Pierre Maurice Moine: I suppose the function must be called in onTrade(),
Perhaps you should read the manual. Do you see any OnTrade in the documentation? Program Running - MQL4 programs - MQL4 Reference
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up. - Thomas Pierre Maurice Moine: i also suppose i can use OrderCloseTime and OderOpenTime.
Select the order, and substract the two times. You haven't stated a problem, you stated a want. Show us your attempt (using the CODE button) and state the nature of your difficulty.
No free help (2017)Or pay someone. Top of every page is the link Freelance.
Hiring to write script - General - MQL5 programming forum (2018)We're not going to code it for you (although it could happen if you are lucky or the issue is interesting).
No free help (2017)MT4:
-
Do not assume history has only closed orders.
OrderType() == 6, 7 in the history pool? - MQL4 programming forum (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)
-
Thank you for your help
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I need a code snippet to get the delay of execution of the lasts trades in history.
The reason is I have an EA which, very rarely, can have a bug : It opens and close orders within less than a second, and repeat that forever. It can wash the account.
So the idea is to to return true if the last(s) order(s) are closed that fast (which is the bug signature), and then close all orders and turn off autotrading (i already have those functions).
I suppose the function must be called in onTrade(), and i also suppose i can use OrderCloseTime and OderOpenTime.
Can you help to clarify how I can do that ?
Thanks