EA-293 · Utility

Demo_resource_EA

This EA demonstrates the use of the #resource directive in MQL5 to embed bitmap image files into a compiled executable. It creates a bitmap label button on the chart that toggles between a euro and dollar image when pressed and released.

Open the interactive view (equity curve, symbol switch)

Key facts

CategoryUtility
RiskSafe
Rating★★★☆☆
TypeUtility tool
TimeframesM1, M5, M15, M30, H1, H4, D1, W1, MN
Indicators—
AuthorMetaQuotes Software Corp.

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 rather a demonstration utility for MQL5 resource embedding. Its core function is to show how the #resource directive compiles external BMP image files into the EA executable, enabling self-contained deployment. Entry and exit conditions are not applicable since it does not execute any trades. Position sizing and money management are similarly not applicable. The EA creates an OBJ_BITMAP_LABEL object in OnInit, anchors it to the upper-right corner of the chart, and loads two bitmap resources corresponding to the button's pressed and released states respectively. OnDeinit removes the chart object for clean teardown. The code also includes commented examples of correct and incorrect resource definitions for educational reference.

Strengths

  • Clearly demonstrates #resource directive usage, serving as an excellent MQL5 resource embedding tutorial
  • Clean code structure with complete OnInit/OnDeinit lifecycle management and proper object creation/deletion pairing
  • Includes error checking and error message output, facilitating debugging and learning how to troubleshoot resource loading failures
  • Comments provide correct vs incorrect resource definition comparisons, helping developers avoid common pitfalls

Weaknesses

  • Does not perform any trading function, serves only as a demonstration with limited practical utility
  • Lacks input parameters (input variables), hardcoded resource paths and position settings reduce flexibility
  • No OnChartEvent handler for button click events, so the button toggles visually but has no functional response
  • Only supports BMP format, not more modern image formats like PNG

Possible improvements

  • Add OnChartEvent handler so button clicks trigger actual operations (e.g., switching symbols, changing display modes)
  • Convert resource paths and object position parameters to input variables for better configurability and reusability

Risk assessment

Overall risk: Safe

  • This EA does not execute any trading operations, posing no trading risk
  • Hardcoded resource file paths may cause loading failures if files are missing, but no financial loss can occur

Evaluation scores

Code quality4.0
Strategy logic1.0
Risk management5.0
Robustness3.0
Innovation2.0
Documentation4.0
Overall3.2

Parameters

ParameterDefaultDescription
label_namecurrency_labelOBJ_BITMAP_LABEL object name on chart
#resource euro.bmp\Images\euro.bmpEuro bitmap resource path for pressed button
#resource dollar.bmp\Images\dollar.bmpDollar bitmap resource path for released button

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.