NewBar
NewBar is a utility class that detects the formation of new bars on a specified chart timeframe. It provides a simple boolean method to check if the current tick belongs to a new bar, preventing multiple signal processing within the same bar. This is a foundational building block commonly used by other trading EAs to ensure one trade per bar.
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
NewBar is not a trading strategy itself but a technical utility class designed to detect the formation of new bars on a chart. Its core concept compares the current bar's timestamp against a previously stored timestamp to determine whether a new bar has started. Entry conditions are not applicable since this tool does not execute any trading operations. Exit conditions are similarly not applicable. Position sizing and money management are not involved as the class solely provides time-detection functionality. This tool is typically called by other EAs to prevent duplicate order placement or redundant signal calculation within the same bar, making it an essential infrastructure component for building robust trading systems.
Strengths
- Simple and efficient new bar detection mechanism that reduces duplicate signal processing
- Modular design allowing easy integration and reuse by other EAs
- Prevents the common problem of multiple entries within the same bar, improving system stability
Weaknesses
- Provides only a single function with no trading logic included
- Lacks support for simultaneous multi-timeframe bar detection
- No error handling mechanism for timestamp anomalies or data refresh scenarios
Possible improvements
- Add multi-timeframe new bar detection support to monitor multiple periods simultaneously
- Implement IsNewBar callback event or signal mechanism for more flexible caller integration
- Add handling logic for data refresh and anomalous timestamp situations
Risk assessment
Overall risk: Safe
- This tool is a pure utility class with no trading risk involved
- Must ensure callers correctly use the new bar flag, otherwise logic errors may occur
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
Timeframe | PERIOD_CURRENT | Timeframe for new bar detection |
LastBarTime | 0 | Timestamp of the last bar |
Similar Utility EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.