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?
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.
I do not know sorry ..
Please look into the time structure it incorporates what you need.
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
Additionally you can incorporate the calendar control so that it becomes easy to pick your dates.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.