- Added comprehensive MQ4/MQ5 comparison documentation (60+ pages) - Added MT4 EA implementation plan and tracking documents (60+ pages) - Phase 1: Core infrastructure with input parameters and data structures - Phase 2: Bar detection system for H4, M30, M15 timeframes - Phase 3: Pattern detection logic (Regular/Irregular Buy/Sell patterns) - Reference files: FINAL_H4_ZONES.mq4, MultiTimeframeZoneEA.mq5, Strategy.md
1.6 KiB
1.6 KiB
| applyTo |
|---|
| **/MQL5/Scripts/_Thivyam/**/*.mq5 |
Instructions for _Thivyam MQL5 Scripts
CRITICAL: MQL5 Syntax Compliance
Before writing any MQL5 code, read and follow: mql5-syntax-critical.instructions.md
Key mandatory rules:
- Use dot operator (
.) for pointer member access, NOT arrow (->) - Declare loop variables BEFORE for-loop:
int i; for(i=0; i<n; i++) - Use dynamic arrays (
Type[]) forArraySetAsSeries()andCopyRates() - Verify property constant names in official MQL5 documentation
Script-Specific Instructions
- Purpose: Scripts must perform a single, well-defined task (e.g., order cleanup, data export) and exit cleanly after execution.
- Entry Point: Use
OnStart()as the sole entry point. Do not rely onOnTick()orOnChartEvent()in scripts. - Input Parameters: Expose configurable behaviour through clearly named
inputvariables. Validate parameters up front and abort with descriptive logs when invalid. - Risk Controls: When scripts place or close trades, reuse shared
_Thivyamrisk and execution helpers to honour firm-wide limits. - Error Handling: Wrap calls to terminal APIs in conditionals, check results, and print
GetLastError()codes for any failures. - Logging: Emit concise status updates to the Experts log so automation can trace script progress.
- Cleanup: Release indicator handles, chart objects, or file handles before returning from
OnStart(). - Agent Workflow: Add short comments explaining non-obvious terminal interactions so future automated agents can maintain behaviour safely.