MT5 New-Bar and Connection Event Logger

MT5 New-Bar and Connection Event Logger
Download ALL MT5 experts (1796)
YouTube Video Thumbnail



Similar MetaTrader Tools

MT5 New-Bar and Connection Event Logger

Info

The MT5 New-Bar and Connection Event Logger is a Expert Advisor for MetaTrader 5 that overviewthe mt5 new-bar & connection event logger is a lightweight diagnostic expert advisor. It monitors newly observed chart bars and MetaTrader 5 terminal connection states, recording detected events in a local CSV file for subsequent inspection and analysis.

Usage

This tool is typically used for automated trading on major forex pairs and gold.

Platform

This Expert Advisor works exclusively on MetaTrader 5 (both build 600+ and newer versions).

Setup

Place the downloaded file in MQL5/Experts folder via File ? Open Data Folder in MetaTrader 5.


How to Install and Use MT5 New-Bar and Connection Event Logger

1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.

2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.

3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.

4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.

Frequently Asked Questions

Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.

Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.

Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.

What this tool does

OverviewThe MT5 New-Bar & Connection Event Logger is a lightweight diagnostic Expert Advisor.

Typical Use Case

This Expert Advisor excels in automated trading and technical analysis on MetaTrader 5.

Compatible Platform & Setup

This Expert Advisor works on MetaTrader 5. Place the file in the MQL5/Experts folder and restart the terminal.

Description & Settings

Related: Real-Time Visualization of Optimization Results - another powerful expert for MetaTrader 5 traders.

Overview

The MT5 New-Bar & Connection Event Logger is a lightweight diagnostic Expert Advisor. It monitors newly observed chart bars and MetaTrader 5 terminal connection states, recording detected events in a local CSV file for subsequent inspection and analysis. The utility is intended for traders, MQL5 developers and system administrators who need greater visibility into trading-terminal activity, particularly when developing automated strategies, monitoring systems and signal-processing integrations. It does not open, modify or close trading positions.

Also recommended: Zig Zag EA - similar expert with strong performance on MetaTrader 5.


Key Features

New-Bar Detection:
Identifies newly observed bars on the monitored chart.

Connection Monitoring:
Records observed terminal connectivity states and detected changes.

CSV Event Logging:
Stores event records for review using Excel, other spreadsheet applications or custom analysis tools.

Duplicate Prevention:
Avoids repeatedly recording the same observed bar during normal processing.

Lightweight Operation:
Designed as a diagnostic utility without trading execution.

Development Support:
Provides useful event information for testing Expert Advisors, indicators and automated monitoring workflows.

How It Works

When the Expert Advisor starts, it initializes its monitoring functionality and records the initial observed state.

During operation, it monitors chart activity and identifies newly observed bars. Relevant events are written to a CSV file, providing a chronological record that can assist with debugging and operational analysis.

The connection-monitoring component also tracks terminal connectivity information, allowing developers to investigate observed connection-state changes and related system behaviour.

The logger records events observed while it is operating. It does not reconstruct a complete historical record of events that occurred before activation or while the application was unavailable.

Installation and Usage

Download the attached MQL5 source file.

Open the file in MetaEditor 5.

Compile the Expert Advisor.

Open MetaTrader 5 and select the chart you wish to monitor.

Attach the New-Bar & Connection Event Logger to the chart.

Review any available settings under the Inputs tab.

Allow the utility to run while market data is being received.

Locate the generated CSV file and inspect the recorded events.

The tool is suitable for observing activity on different symbols and timeframes. The accompanying demonstration was performed using BTCUSD on the M1 timeframe.

Understanding the CSV Output

The generated CSV file provides a record of the events detected by the Expert Advisor.

New-bar records help identify when the logger observed the appearance of a new chart bar. Connection-related records provide information about the observed terminal connection state.

These records may be useful for:

- Investigating missing or delayed signal events.
- Comparing chart-bar activity with external automation logs.
- Diagnosing interruptions in MT5-connected workflows.
- Reviewing the behaviour of event-driven trading infrastructure.
- Supporting development and testing of automated trading systems.

The CSV is a diagnostic record, not a transaction history or proof of successful order execution.

Testing and Validation

The utility was tested in a MetaTrader 5 demo environment.

During testing, the logger successfully recorded the initial connection and bar events, followed by seven consecutive BTCUSD M1 new-bar events without duplicate bar records in the observed sequence.

No trading orders were placed.

Connection-recovery handling was also tested through simulation. A forced live network-disconnection test was not performed.

These results describe the completed test scenarios and do not guarantee identical behaviour under every network or terminal condition.

Important Notes

The Expert Advisor is intended for diagnostic and educational use.

It does not generate trading recommendations or execute transactions.

Event detection depends on the terminal's operation and the data available to the program.

The generated CSV should be reviewed when investigating missing or unexpected activity.

This utility does not replace comprehensive monitoring, alerting or recovery infrastructure.

Developer

This utility is provided as a free, standalone MQL5 CodeBase contribution for educational, diagnostic and development purposes.

You may also like: Random Lot Trading EA - excellent alternative for expert users on MetaTrader 5.

Source Code

#property copyright "RobotFX"
#property link "https://robotfx.org"
#property version   "1.00"
#property description "This code is educational. Feel free to use, modify and upgrade as you wish. Visit ROBOTFX.ORG for professional trading tools"
#property indicator_chart_window
#property indicator_plots 0
input int PollSeconds = 2;
enum BarEvent
  {
   BAR_NONE = 0,

.......

Leave your opinion, ask a question, share some knowledge

⚠ Limitations & Risk Warning

  • This tool is provided for educational and testing purposes only.
  • Past performance does not guarantee future results.
  • Trading involves substantial risk of loss. Use on a demo account first.
  • Results may vary depending on market conditions, broker, and settings.
  • We recommend thorough backtesting and forward testing before using with real funds.
© ROBOTFX Free educational tools by RobotFX. Use entirely at your own risk; we are not liable for any financial losses incurred.