EA-57849 · Utility

New Bar Formation

This is a simple utility EA that detects new bar formation on the current chart timeframe. It uses a static datetime variable to compare the current bar's open time with the previous bar's open time, printing a message whenever a new bar is detected. It does not open any trades and serves as a boilerplate template for per-bar logic execution.

Open the interactive view (equity curve, symbol switch)

Key facts

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

Backtest results (H1, about 1 year)

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

Strategy analysis

This EA is not a trading strategy but a new bar detection utility. Its core concept uses the iTime function to retrieve the current bar's open time and compares it with a static variable previous_time against current_time to determine if a new bar has formed. When a new bar is detected, one-time-per-bar code logic is executed (currently only printing a message), and then previous_time is updated to the current time to prevent repeated triggers. There are no entry conditions, exit conditions, position sizing, or money management logic — it only provides a foundational framework for per-bar execution. Developers can add their own strategy logic on top of this framework to ensure operations execute only once per bar. PERIOD_CURRENT means it uses the current chart's timeframe, which can also be changed to any specified timeframe.

Strengths

  • Clean and straightforward code logic, easy for beginners to learn new bar detection methods
  • Uses static variables to ensure execution only on genuine new bar formation, avoiding repeated per-tick triggers
  • Serves as a convenient boilerplate template for extending with custom strategy logic
  • Supports adaptation to different timeframes by changing the PERIOD_CURRENT parameter

Weaknesses

  • Functionality is overly simple — only prints a message without any practical action, offering limited utility
  • No error handling mechanism — iTime call failures (e.g., data not loaded) could cause logic anomalies
  • Lacks input parameters, making it impossible to customize timeframe or other options in the EA settings dialog
  • Does not account for multi-symbol or multi-timeframe monitoring needs, limiting extensibility

Possible improvements

  • Add input parameters to allow users to customize the monitored timeframe and symbol, improving flexibility
  • Add validity checks for iTime return values — retry or show error when it returns 0, enhancing robustness
  • Encapsulate the new bar detection logic into a reusable function or class for easy integration across multiple EAs

Risk assessment

Overall risk: Safe

  • This EA performs no trading operations, posing no financial risk
  • iTime function may return 0 when historical data is not loaded, potentially causing false new bar detections

Evaluation scores

Code quality3.0
Strategy logic1.0
Risk management5.0
Robustness2.0
Innovation1.0
Documentation2.0
Overall2.3

Parameters

ParameterDefaultDescription
previous_time0Static variable storing the previous bar's open time
current_timeiTime(_Symbol, PERIOD_CURRENT, 0)Current bar open time, obtained via iTime function

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.