IsConnected
This EA monitors the terminal's connection status to the trade server in a loop, printing 'Online' or 'Offline' messages whenever the connection state changes. It uses CTerminalInfo to detect connectivity transitions and logs the timestamps of connection and disconnection events. It is purely a monitoring utility with no trading functionality.
Open the interactive view (equity curve, symbol switch)Key facts
Backtest results (H1, about 1 year)
Not backtested yet — this EA could not be converted automatically.
Strategy analysis
This EA does not involve any trading strategy; it is purely a connection status monitoring tool. Its core logic runs a while loop polling the terminal's connection status every second, detecting changes by comparing the current state with the previous state. When a transition from offline to online is detected, it records the Connect_Start timestamp; when transitioning from online to offline, it records the Connect_Stop timestamp. The tool performs no entry or exit operations and involves no position sizing or money management. It uses a 'first' flag to handle state initialization on the first run, ensuring the initial state transition is correctly captured. The overall implementation is straightforward and serves only diagnostic and monitoring purposes.
Strengths
- Simple and straightforward implementation with clear logic
- Real-time monitoring of connection state changes helps diagnose network issues
- Records connection and disconnection timestamps for post-incident network stability analysis
Weaknesses
- Uses a blocking while loop with Sleep, occupying the EA thread and preventing other EA events from being processed
- Print messages have confusing logic: prints 'Offline' when going online, and 'Online' when going offline
- Does not use event-driven approach (e.g., OnTimer), resulting in inefficient resource utilization
Possible improvements
- Replace the blocking while loop with an OnTimer event-driven approach to avoid occupying the EA thread
- Fix the print message logic error to ensure correct Online/Offline output during state transitions
Risk assessment
Overall risk: Safe
- The blocking loop prevents the EA from processing other events (like deinit), potentially making it difficult for the terminal to remove the EA normally
- Pre_IsConnected is initialized to true, so if already connected on first check, no state change notification is triggered
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Sleep interval | 1000ms | Connection status polling interval (ms) |
first | true | First run flag for state comparison initialization |
Now_IsConnected | false | Current connection status |
Pre_IsConnected | true | Previous connection status |
Similar Utility EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.