Loading…

Time Based Order Placer

Some trades are planned well ahead of when they need to be sent - a session open, a scheduled news release, a level that only matters at a specific moment. This EA arms itself with one target date and time, waits, and sends exactly one order at that instant: market or pending, buy or sell, with the usual stop loss, take profit and position sizing options shared across this catalogue. A missed-window guard keeps it from firing hours late. If the target time has already passed by more than InpMissedWindowSeconds by the time the EA next receives a tick - the platform was closed, the chart was frozen, the terminal just started - it logs the miss and disarms instead of sending a now-stale order into whatever the market happens to be doing when it finally wakes up. Position sizing, when risk-based, is built from the broker's tick value and tick size rather than a hardcoded contract size, so it prices correctly on gold, indices and JPY crosses as well as plain FX pairs. Notes and limitations - Fires once per EA attachment. Reattaching the EA (or changing an input, which reruns OnInit) re-arms it for the same InpTargetTime. - Server time, not local or broker's advertised timezone label - check the terminal's clock against the intended event before relying on it. - No news feed or economic calendar is read; the time is whatever is typed in, so it is only as accurate as the trader's own planning. - If risk sizing produces a lot size of zero for the given stop distance, the order is skipped rather than sent at an unintended size. - MQL5, netting accounts only: refuses to place the order if a foreign-magic position already sits on the chart symbol at send time, to avoid a silent merge. This check is only made once, at the scheduled moment - it is not re-checked later if a pending order triggers well after a foreign position has since been opened.

Expert advisor · MT4 · v1.0 · Free

About Time Based Order Placer

Time Based Order Placer is an expert advisor (trading robot) for MetaTrader 4. It places pending buy/sell stop or limit orders and can size trades from your balance and risk percent. It has 13 settings, such as Target time, Order type and Pending price. MQL source code included.

Files in the download: TimedOrderPlacer.ex4, TimedOrderPlacer.mq4, TimedOrderPlacer.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
Target time2026.01.01 00:00Server time to place the order (yyyy.mm.dd hh:mi)
Order typeTIMED_BUYOrder type to place at that time
Pending price0.0Price for pending order types (ignored for market orders)
Missed window seconds60How late the target time may be before the order is skipped
Stop loss pips50Stop loss distance from the fill/pending price, in pips (0 = none)
Take profit pips100Take profit distance, in pips (0 = none)
Use risk sizingfalseSize by percent risk instead of a fixed lot
Risk percent1.0Percent of equity risked, when risk sizing is on
Fixed lots0.10Lot size when risk sizing is off, or as a fallback
Magic number20260114Magic number for the order this EA places
Slippage pips3Slippage tolerance for market orders, in pips
Max retries5Attempts before giving up
Retry wait ms500Pause between attempts, milliseconds

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Trading Sessions · News Trading · Risk & Lot Size · Pending Orders · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria