What is Timed Order EA?
Timed Order is a simple MetaTrader/cTrader expert advisor that lets you execute a trade at a specific time. The EA can be used to schedule a trade during the weekend to be executed when the market opens. It can also be used to set up a trade that will be executed when you are away from the platform. It is important to understand that Timed Order is not a fully automatic trading robot — you have to set the date and time of the trade, set an appropriate stop-loss and take-profit, define maximum deviation parameters, and so on. However, its highly customizable settings allow creation of nearly any kind of a trading order. This EA supports risk-based position sizing in addition to the usual fixed position size. It is available for the following trading platforms: MT4, MT5, and cTrader.
Timed Order is your ultimate solution for pre-programmed trades.
Operation
Timed Order can work in two modes:
- Single trade mode (default)
- Daily mode
In the single trade mode, Timed Order opens a single trade at the time specified by the trader.
In the daily mode, Timed Order will open trades at the specified time on each of the enabled days of the week. For example, it can open a trade for you at 12:00 every day or at 15:00 every Monday and Thursday, and so on.
In both modes, the time can be given either as the server time or as the local time. The time can be specified down to the seconds.
The Timed Order EA supports the following trade types:
- Buy
- Sell
- Buy Limit
- Buy Stop
- Sell Limit
- Sell Stop
- Buy Stop Limit (MT5 only)
- Sell Stop Limit (MT5 only)
You can set up a stop-loss and a take-profit for the order you are planning to open. There are four types of SL/TP supported by the expert advisor:
- Price level — the specific price. If you are setting this for a market order (Buy/Sell), the order may fail if the price moves beyond the SL/TP set as a price level.
- Distance — SL/TP as distance in points. Simple and more or less guaranteed.
- ATR — a multiple of the ATR indicator's value. You control the multiplier, the ATR period, and the ATR timeframe.
- Spreads — a multiple of the currency pair's spread at the time of execution.
The EA supports setting the Entry level. For pending orders, it is obligatory to set either Entry or Entry distance in points parameters. For market orders, it can be used together with the MaxDifference input parameter to avoid order execution at an unfavorable rate.
The expiration parameter can be set up for pending orders for the order to expire at the set time.
You can also control how many attempts the platform will go with to execute the order should it encounter some error.
Another useful option is to set the maximum allowed spread to avoid executing the trade when spreads are too wide. The EA, if instructed to do so via the RetryUntilMaxSpread input parameter, can keep trying to execute the trade until the spread decreases to below the desired threshold value.
A position sizing function can be enabled to calculate the trade size based on your risk tolerance and stop-loss. Alternatively, you can set a fixed position size.
You can configure the alerts to be triggered separately in case of a failure and in case of a success.
Example trades
MetaTrader
Here is how the EA looks when you attach it to a chart in MetaTrader 5. This instance was set up to open a Buy order with a fixed stop-loss level and ATR-based take-profit:
cTrader
And here is an example trade setup for cTrader. The scheduled trade will be a Sell with a fixed-distance stop-loss and take-profit:
No backtesting
Due to the nature of the Time Order EA, there are no backtesting results for it.
Input parameters
Trading
- OrderTime — the date and time when the order should be created. In cTrader, there are six separate parameters instead: year, month, day, hour, minute, and second. This parameter is disregarded in the daily mode.
- OrderType (default = Buy) — one of the following: Buy, Sell, Buy Limit, Buy Stop, Sell Limit, Sell Stop, Buy Stop Limit, Sell Stop Limit.
- Entry (default = 0) — the entry price for pending orders; the desired price for market orders.
- EntryDistancePoints (default = 0) — the distance in points from the price at the time of the order placement to place the pending order. Does nothing for market Buy/Sell orders.
- StopPrice (default = 0) — the stop price for Stop Limit orders. Only in MT5.
- SLType (default = Price level) — one of the following: price level, distance, ATR, spreads.
- StopLoss (default = 0) — the stop-loss value based on the chosen type. For the price level — the specific price. For the distance — the number of points. For the ATR — the multiplier. For the spreads — the multiplier as well.
- TPType (default = Price level) — one of the following: price level, distance, ATR, spreads.
- TakeProfit (default = 0) — the take-profit value based on the chosen type. For the price level — the specific price. For the distance — the number of points. For the ATR — the multiplier. For the spreads — the multiplier as well.
- TimeType (default = Server) — the type of time you set via OrderTime. It can be either your platform's local time or the server's time.
Control
- Expires (default = 0) — the expiry time for pending orders. In cTrader, there are six separate parameters instead: year, month, day, hour, minute, and second.
- Retries (default = 10) — how many attempts to perform before giving up?
- MaxDifference (default = 0) — if OrderType is set to Buy or Sell and some non-zero Entry is given, the EA will only execute the order if the difference between the current price and the Entry value is less or equal to the MaxDifference value. Its value is set in points.
- MaxSpread (default = 3) — if the spread at order time is greater than this value, the order is not placed.
- RetryUntilMaxSpread (default = false) — if true, the EA will wait for the spread to go down to below the MaxSpread value before placing the order.
- Slippage (default = 30) — the maximum tolerable slippage in points.
- ATR_Timeframe (default = PERIOD_CURRENT) — the timeframe for the ATR indicator. It is used only if you set either SLType or TPType to ATR.
- ATR_Period (default = 0) — the ATR indicator's period. It is used only if you set either SLType or TPType to ATR.
Daily mode
- DailyMode (default = false) — if true, the Timed Order will operate in the daily mode using the parameters below and disregarding the OrderTime parameter.
- DailyTime (default = "18:34:00") — the time when the order should be created when working in the daily mode. In cTrader, there are three separate parameters instead: hour, minute, and second.
- Monday (default = true) — if true, the EA will open the daily trade on Monday.
- Tuesday (default = true) — if true, the EA will open the daily trade on Tuesday.
- Wednesday (default = true) — if true, the EA will open the daily trade on Wednesday.
- Thursday (default = true) — if true, the EA will open the daily trade on Thursday.
- Friday (default = true) — if true, the EA will open the daily trade on Friday.
- Saturday (default = false) — if true, the EA will open the daily trade on Saturday.
- Sunday (default = false) — if true, the EA will open the daily trade on Sunday.
Position sizing
- CalculatePositionSize (default = false) — if true, the position size will be calculated based on the given risk and stop-loss.
- FixedPositionSize (default = 0.01) — the fixed position size to use if CalculatePositionSize = false.
- Risk (default = 1) — the risk tolerance in percentage of account balance/equity. Works only if CalculatePositionSize = true. This input parameter is ignored if UseMoneyInsteadOfPercentage is set to true.
- MoneyRisk (default = 0) — the risk tolerance in account currency. Works only if CalculatePositionSize = true. Requires UseMoneyInsteadOfPercentage set to true.
- UseMoneyInsteadOfPercentage (default = false) — if true, the position size is calculated based on risk amount given in account currency (MoneyRisk) instead of balance/equity percentage risk (Risk). Works only if CalculatePositionSize = true.
- UseEquityInsteadOfBalance (default = false) — if true, the position size is calculated based on account equity instead of balance. Works only if CalculatePositionSize = true. Ignored if UseMoneyInsteadOfPercentage = true.
- FixedBalance (default = 0) — if set to a non-zero value, it is used instead of account balance/equity for position size calculation. Works only if CalculatePositionSize = true.
Alerts
- AlertsOnSuccess (default = false) — if true, the EA will issue an alert when the order is placed successfully.
- AlertsOnFailure (default = false) — if true, the EA will issue an alert if it fails to create the order.
- EnableNativeAlerts (default = false) — if true, the EA will use MetaTrader's native pop-up alerts.
- EnableEmailAlerts (default = false) — if true, the EA will use MetaTrader's email alerts. Email should be properly configured in MetaTrader via Tools->Options->Email.
- EnablePushAlerts (default = false) — if true, the EA will use MetaTrader's push notification alerts. Notifications should be properly configured in MetaTrader via Tools->Options->Notifications.
Miscellaneous
- Magic (default = 20220913) — the magic number for orders to filter positions opened by this EA. Not present in cTrader.
- OrderCommentary (default = "TimedOrder") — the commentary for positions opened by this EA.
- Silent (default = false) — if true, the EA won't output any information in the chart commentary field.
- Logging (default = true) — if true, the EA will log its messages into a log file. The file name starts with "TO-Log-". Not present in cTrader.
Download (ver. 1.01, 2023-11-20)
MetaTrader 4
Timed Order in .zip Timed Order in .mq4
MetaTrader 5
Timed Order in .zip Timed Order in .mq5
cTrader
Timed Order in .zip Timed Order in .cs
You can open a trading account with any of the MT4 Forex brokers to freely use the expert advisor for MetaTrader 4 presented here. If you want to use an MT5 version of the EA, you would need to open an account with a broker that offers MetaTrader 5. Please see our list of cTrader Forex brokers if you would rather use the cTrader version of this expert advisor.
Discussion
Warning! Before you ask basic questions regarding installation of the expert advisors, please read this MT4 Expert Advisors Tutorial to get the elementary knowledge on handling them.
Do you have your own trading results or any other remarks regarding this expert advisor?
Discuss the Timed Order EA with other traders and MQL4/MQL5 coders on our forum.
Changelog
1.01 — 2023-11-20
- Added the daily mode option to let you open trades on every selected day of the week.
- Added an option (EntryDistancePoints) to set pending order's entry price as the distance from the price at the time of its creation.
- Added an option (RetryUntilMaxSpread) to let the EA wait until the current spread tightens to the allowed value before trying to open a trade.
- Added parameters to set seconds for the trade and expiration time for the cTrader version.
- Fixed minor typos in the source code.
1.001 — 2023-10-31
- Fixed position size calculation bug in the MT4 version. It resulted in the fixed position size used all the time.
1.00 — 2022-09-23
- First release of the Timed Order expert advisor.