Overview
Free time-based entry EA: opens one trade a day at a set server time, fixed direction or by previous candle or EMA, with stop, target and close time.
FXN Time Entry is a free, open-source Expert Advisor for MetaTrader 4 and MetaTrader 5 that opens one trade a day at a time you choose. It is built for time-of-day ideas such as the London or New York open: you set the time, the direction rule, the stop and target, and the close time.
How it works
- At the entry time (server time) the EA opens one market trade; if the spread is too wide or no tick arrives, it retries during the entry window.
- Direction rules: always buy, always sell, with the previous candle, against it, or by the last close vs an EMA, all on the signal timeframe.
- A flat previous candle (or a close equal to the EMA) means no trade that day.
- Stop and target: fixed points, or ATR multiples of the signal timeframe. A target of 0 means no take profit.
- Close time: the trade is closed at the set time. If the close time is earlier than the entry time, it is the next day.
- One trade per day, also after a restart, and none while the previous trade is still open.
- Lot size: risk mode sizes the lot from the stop distance, tick value and tick size so a stop-out costs the set % of balance, rounded down to the lot step. Below the minimum lot the trade is skipped with a message.
Inputs
| Input | Default | What it does |
|---|---|---|
| Entry hour / minute / window | 8 / 0 / 5 | Entry time (server) and minutes a late entry is allowed |
| Direction rule | Previous candle | Buy, sell, previous candle, opposite candle or EMA |
| Signal timeframe | H1 | Timeframe for the candle, EMA and ATR |
| EMA period | 50 | Used by the EMA rule |
| Stop/target mode | ATR | Fixed points or ATR multiples |
| Stop / target (points) | 300 / 600 | Used in points mode (target 0 = none) |
| ATR period / stop / target | 14 / 1.5 / 2.0 | ATR mode: stop and target as ATR multiples (target 0 = none) |
| Use close time / hour / minute | true / 20 / 0 | Close the trade at this time |
| Monday ... Friday | true | Days the EA may trade |
| Lot mode / Fixed lot / Risk % | Risk / 0.10 / 1.0 | Fixed lot, or a lot sized so a stop-out costs this % of balance |
| Magic number | 510501 | Marks this EA's trades; it only manages its own |
| Max spread / slippage (points) | 30 / 10 | Entry spread filter (0 = off) and allowed deviation |
| Order comment | FXN Time Entry | Comment on the orders |
How to use it
- Copy
FXN_TimeEntry.mq4toMQL4/Experts(MT4) orFXN_TimeEntry.mq5toMQL5/Experts(MT5) via File > Open Data Folder, then refresh the Navigator. - Attach it to a chart and allow algo trading (toolbar button and the EA's own setting).
- Any chart timeframe works. Find the broker server offset and test one session open at a time, such as London with the previous H1 candle rule.
- Test in the Strategy Tester and on a demo account before any live use.
Good to know
- All times are broker server time. Check daylight saving changes, which shift sessions by an hour twice a year.
- Spreads widen around rollover and some opens; the spread filter delays entry within the window.
- A close time on the weekend executes at the first tick after the reopen.
- In the MT4 Strategy Tester, download history for the signal timeframe too, or set it to the chart timeframe.
- A time of day has no edge on its own; this is a tool to test and run your idea.
Trading carries risk. Test on a demo account first; past results do not predict future results.
At a glance
- What it is
- A free Expert Advisor for MetaTrader 4, written in MQL4.
- What it does
- Free time-based entry EA: opens one trade a day at a set server time, fixed direction or by previous candle or EMA, with stop, target and close time.
- Shared by
- Alex
- Licence
- MIT
- Version
- 1.0 (1 Dec 2026)
- Settings
- 33 inputs
- Lab check
- Compiled with MetaEditor build 2425 for MT4 on 1 Dec 2026: 0 errors, 0 warnings.
- Price
- Free to download
Settings read from the code
| Input | Type | Default | Note |
|---|---|---|---|
| InpHdrEntry | string | === Entry (server time) === | ===== Entry (server time) ===== |
| InpEntryHour | int | 8 | Entry hour (0-23, server time) |
| InpEntryMinute | int | 0 | Entry minute (0-59) |
| InpEntryWindowMin | int | 5 | Minutes after the entry time in which a late entry is still allowed |
| InpDirection | ENUM_FXN_DIR | FXN_DIR_CANDLE | Direction rule |
| InpSignalTf | ENUM_TIMEFRAMES | PERIOD_H1 | Timeframe for the previous candle, the EMA and the ATR |
| InpEmaPeriod | int | 50 | EMA period (direction rule = EMA) |
| InpHdrStopAndTarget | string | === Stop and target === | ===== Stop and target ===== |
| InpDistMode | ENUM_FXN_DIST | FXN_DIST_ATR | Stop and target in fixed points or ATR multiples |
| InpStopPoints | int | 300 | Stop loss in points (fixed points mode) |
| InpTargetPoints | int | 600 | Take profit in points (fixed points mode, 0 = none) |
| InpAtrPeriod | int | 14 | ATR period (ATR mode) |
| InpStopAtr | double | 1.5 | Stop loss = ATR x this (ATR mode) |
| InpTargetAtr | double | 2.0 | Take profit = ATR x this (ATR mode, 0 = none) |
| InpHdrExit | string | === Exit === | ===== Exit ===== |
| InpUseCloseTime | bool | true | Close the trade at a set time |
| InpCloseHour | int | 20 | Close hour, server time (earlier than the entry time = next day) |
| InpCloseMinute | int | 0 | Close minute (0-59) |
| InpHdrTradingDays | string | === Trading days === | ===== Trading days ===== |
| InpMonday | bool | true | Trade on Monday |
| InpTuesday | bool | true | Trade on Tuesday |
| InpWednesday | bool | true | Trade on Wednesday |
| InpThursday | bool | true | Trade on Thursday |
| InpFriday | bool | true | Trade on Friday |
| InpHdrPositionSize | string | === Position size === | ===== Position size ===== |
| InpLotMode | ENUM_FXN_LOTS | FXN_LOTS_RISK | Lot sizing mode |
| InpFixedLot | double | 0.10 | Fixed lot (used when mode = Fixed lot) |
| InpRiskPercent | double | 1.0 | Risk per trade in % of balance (used when mode = Risk %) |
| InpHdrExecution | string | === Execution === | ===== Execution ===== |
| InpMagic | int | 510501 | Magic number (the EA only manages its own trades) |
| InpMaxSpreadPoints | int | 30 | Max spread in points at entry (0 = no limit) |
| InpSlippagePoints | int | 10 | Max slippage (deviation) in points |
| InpComment | string | FXN Time Entry | Order comment |
How to use it
- Download the compiled file (or the source and compile it in MetaEditor).
- Put it in MetaTrader: File → Open Data Folder → MQL4 → Experts, then refresh the Navigator.
- Test it on a demo account before any real money.
- Want changes? Open a copy in your Lab and ask for them in plain words.