EA-49171 · Utility

NEW BAR CHECK

This EA is a utility tool that detects the arrival of a new bar on the current chart timeframe by comparing the bar count at initialization versus on each tick. It triggers an Alert and displays a Comment when a new bar is formed, but does not open any trades.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryUtility
RiskSafe
Rating★★☆☆☆
TypeUtility tool
TimeframesM1, M5, M15, M30, H1, H4, D1, W1, MN
IndicatorsiBars
Author—

Backtest results (H1, about 1 year)

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

Strategy analysis

This EA does not contain any trading strategy; it is purely a new bar detection utility. Its core logic records the total bar count on the current chart during the OnInit function, then continuously compares it against the latest bar count obtained in the OnTick function. When the bar count in OnTick exceeds the value stored at initialization, it determines a new bar has formed and triggers an Alert popup along with a Comment displayed on the chart showing both historical and live bar counts. There are no entry conditions, exit conditions, position sizing, or money management features since this EA does not execute trades. This new bar detection approach is a common foundational technique in MQL5 programming, often used as a building block for strategies that need to execute logic only once per bar. However, the current implementation has some limitations, such as relying on iBars comparison which may behave unexpectedly during history updates or chart reloads, and it only provides notification without exposing the new bar state for other logic to consume.

Strengths

  • Simple and intuitive implementation with minimal code, easy to understand and maintain
  • New bar detection is a very useful foundational feature in MQL5 programming that can be embedded into more complex strategies
  • Uses both Alert and Comment notification methods to ensure the user is promptly informed of new bar arrivals

Weaknesses

  • Using iBars comparison is not the most reliable new bar detection method; history data updates may cause false positives
  • Does not provide a new bar flag interface that other logic can call; only notifies without exposing the state
  • Missing OnDeinit function for resource cleanup; Comment will not be automatically cleared when the EA is removed

Possible improvements

  • Switch to a more reliable new bar detection method, such as comparing the current bar's open time (iTime) or using a standard new bar detection class
  • Add an OnDeinit function to clean up Comment annotations on the chart, and consider encapsulating the new bar detection as a reusable function or class

Risk assessment

Overall risk: Safe

  • This EA does not perform any trading operations, so there is no financial risk
  • iBars may produce false positives during history data updates, but this does not affect trading safety

Evaluation scores

Code quality2.0
Strategy logic1.0
Risk management5.0
Robustness2.0
Innovation1.0
Documentation1.0
Overall2.0

Parameters

ParameterDefaultDescription
BarsTotal_OnInt0Total historical bar count recorded at initialization
BarsTotal_OnTick0Latest total bar count retrieved on each tick

Similar Utility 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.