Help: Datetime Type
Here is an example format:
datetime NY=D'2015.01.01 00:00'; // Time of beginning of year 2015 datetime d1=D'1980.07.19 12:30:27'; // Year Month Day Hours Minutes Seconds datetime d2=D'19.07.1980 12:30:27'; // Equal to D'1980.07.19 12:30:27'; datetime d3=D'19.07.1980 12'; // Equal to D'1980.07.19 12:00:00' datetime d4=D'01.01.2004'; // Equal to D'01.01.2004 00:00:00'
You need to do this: determine the current time and write it into a variable (let it be 'time_exp'). Then add five minutes to the variable (5 * 60 seconds) - that is, you need to add the number 300 to the variable 'time_exp'.
Documentation on MQL5: Standard Library / Panels and Dialogs / CDateTime / DateTime
- www.mql5.com
Standard Library / Panels and Dialogs / CDateTime / DateTime - Reference on algorithmic/automated trading language for MetaTrader 5
Thanks @Vladimir Karputov
There is no need to create pending orders in code.
- The pending has the slight advantage, A) you are closer to the top of the queue (filled quicker), B) there's no round trip network delay (filled quicker.)
Don't worry about it unless you're scalping M1 or trading news.
-
Humans can't watch the screen 24/7, so they use pending orders; EAs can, so no need for pending orders, have it wait until the market reaches the trigger price and just open an order.
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
Hello friends i'm trying to creat an EA that is based on pending orders and now the problem is I want all pending orders to be cancelled after 5 minutes of being placed or to be cancelled if they are not yet open orders so please help with the expiration