EA-15679 · Session Trading

AutoTrader

This EA is a session-based trading toggle utility that automatically enables or disables the MetaTrader AutoTrading button (Ctrl+E) based on a user-defined time window. Outside the active trading session, it also closes all open positions. It does not generate its own trade signals or open positions based on a strategy.

Open the interactive view (equity curve, symbol switch)

Key facts

RiskMedium
Rating★☆☆☆☆
TypeUtility tool
TimeframesM1, M5, M15, M30, H1, H4, D1
Indicators—
AuthorAM2

Backtest results (H1, about 1 year)

Not backtested yet — this EA could not be converted automatically.

Strategy analysis

The strategy concept of this EA is to control the enabling and disabling of the trading system based on a time window, rather than generating trade signals from market technical indicators. For entry conditions, when the current time enters the user-defined start time (default 9:30) and AutoTrading is disabled, the EA simulates the keyboard shortcut Ctrl+E via the Windows API to enable AutoTrading. For exit conditions, when the current time falls outside the trading session, the EA iterates through all open positions and closes each one, while also disabling AutoTrading. Regarding position sizing, the EA has no position management logic whatsoever; it simply closes all positions without considering position size or profit/loss status. For money management, there is similarly no money management mechanism—the position closing is indiscriminately executed across all holdings. Overall, this is a purely utility-type EA that relies on the Windows API keybd_event function to simulate keyboard input, introducing platform dependency and reliability concerns.

Strengths

  • Well-implemented time control logic with support for overnight session boundaries
  • Simple and concise implementation, easy to understand and modify
  • Automatic position closing prevents risk of holding positions outside trading hours

Weaknesses

  • Depends on Windows user32.dll keybd_event function, cannot run on non-Windows platforms
  • Keyboard simulation approach to toggle AutoTrading is highly unreliable and may fail due to window focus issues
  • Position closing has no slippage protection, no error handling, and no position filtering—partial closures may fail
  • No new bar detection mechanism; checks are performed on every tick causing unnecessary resource consumption
  • Use of Sleep function is not recommended in EAs and may cause thread blocking

Possible improvements

  • Replace keybd_event keyboard simulation with MQL5 native TerminalInfoInteger and account permission APIs to improve cross-platform compatibility and reliability
  • Add error handling and retry logic for position closing, implement position filtering (e.g., by symbol, by P&L), and add new bar detection to reduce unnecessary computation

Risk assessment

Overall risk: Medium

  • keybd_event keyboard simulation may fail if MetaTrader loses window focus, leaving trading state incorrectly toggled
  • Position closing lacks error handling; during volatile markets, requote or slippage may cause closure failures
  • Indiscriminately closing all positions outside trading hours may conflict with positions intended by other EAs

Evaluation scores

Code quality2.0
Strategy logic2.0
Risk management2.0
Robustness1.0
Innovation1.0
Documentation1.0
Overall1.5

Parameters

ParameterDefaultDescription
StartHour9Trading session start hour
StartMinute30Trading session start minute
StopHour23Trading session end hour
StopMinute30Trading session end minute

Similar Session Trading EAs

Backtests are historical simulations and do not guarantee future results. Not financial advice.

Get the weekly Arena report

One email a week: ranking changes, new signals and new research. No spam; unsubscribe any time.