This is something similar on CodeBase -
-----------
Pending orders by time - expert for MetaTrader 5
The Expert Advisor works with pending orders: it sets Buy Stop and Sell Stop at the specified time. Pending orders are set with the Stop Loss. The EA uses virtual Take Profit, i.e. it monitors open positions, and when the current position profit reaches Take Profit, the EA closes it by market.
-----------
Pending orders by time 2 - expert for MetaTrader 5
Modification of the Pending orders by time EA: now you can set either a permanent (Lots > 0 and Risk ==0) or dynamic lot (Lots == 0 and Risk > 0). Added trailing.
This is more like that -
-----------
TimeEA - expert for MetaTrader 5
A Simple Expert Advisor The EA opens a position of the specified type at the time specified in the EA parameters. The position is closed at the time specified in the appropriate parameter.
Thanks so much. I've tested it and it works great however I can't set a specific date on it for instance tomorrow(I can set the time but not the date). Have you an idea on how to setup this kind of order or maybe there is a different EA for that?
I do not know sorry ..
Please look into the time structure it incorporates what you need.
struct MqlDateTime { int year; // Year int mon; // Month int day; // Day int hour; // Hour int min; // Minutes int sec; // Seconds int day_of_week; // Day of week (0-Sunday, 1-Monday, ... ,6-Saturday) int day_of_year; // Day number of the year (January 1st is assigned the number value of zero) };
You can literally make it do what you need.
Please see: https://www.mql5.com/en/docs/constants/structures/mqldatetime
![Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Date Type Structure Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Date Type Structure](https://c.mql5.com/36/22/documentation-on-mql5-constants__6.png)
- www.mql5.com
Additionally you can incorporate the calendar control so that it becomes easy to pick your dates.
![Graphical Interfaces VIII: The Calendar Control (Chapter 1) Graphical Interfaces VIII: The Calendar Control (Chapter 1)](https://c.mql5.com/36/22/graphical-interfaces-viii-the-calendar.jpg)
- www.mql5.com
![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
Hey,
Does anyone how to setup a program which would buy at current market price but at a specific time. For instance buy EURUSD on this day at 8AM with a stoploss and take profit with X amount of basis points?