Demo_Create_OBJ_BITMAP_LABEL_EA
This EA demonstrates how to create and manage an OBJ_BITMAP_LABEL object on a MetaTrader 5 chart. It creates a bitmap button with two image states (pressed/unpressed) using BMP files, and deletes the object on deinitialization. It does not execute any trades or implement a trading strategy.
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 is not a trading strategy but a demonstration utility for creating chart objects in MQL5. There are no entry conditions, exit conditions, position sizing, or money management logic whatsoever. The strategy concept is purely to demonstrate how to programmatically create an OBJ_BITMAP_LABEL graphical object on a chart, set its properties such as anchor corner, X/Y offset distances, and bitmap file paths for pressed and unpressed states. The code creates the object in OnInit, loads two BMP images for the two button states, and deletes the chart object in OnDeinit for cleanup. No trading signals, order management, or risk control mechanisms exist in this code.
Strengths
- Clean and concise code, suitable for beginners learning OBJ_BITMAP_LABEL object creation
- Includes error handling that outputs error codes when image loading fails
- Properly cleans up chart objects in OnDeinit to prevent leftover artifacts
- Uses ResetLastError and GetLastError for error diagnostics, aiding debugging
Weaknesses
- Only a demo code with no actual trading functionality or strategy logic
- No preemptive check for BMP file existence, only reports errors after failure
- Missing object property validation and state management; no click response logic
- Hardcoded image paths and coordinate values, lacking flexibility and configurability
Possible improvements
- Add an OnChartEvent handler to respond to button click events for interactive functionality
- Externalize image paths and coordinates as input parameters for user customization
Risk assessment
Overall risk: Safe
- No trading operations involved, no financial risk
- Hardcoded image file paths; missing files only affect display
Evaluation scores
Parameters
| Parameter | Default | Description |
|---|---|---|
label_name | currency_label | OBJ_BITMAP_LABEL object name on chart |
euro | \Images\euro.bmp | BMP image path for pressed button state |
dollar | \Images\dollar.bmp | BMP image path for unpressed button state |
Similar Utility EAs
Backtests are historical simulations and do not guarantee future results. Not financial advice.