No description
Find a file
2026-06-05 16:34:05 +03:00
AI EA BMP FILES Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
1. Forex Algo-Trader.ico Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI Canvas Editor.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI Canvas Interact.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI Canvas Primitives.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI Canvas Render.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI Canvas Scrollbar.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI Canvas Shell.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI Canvas State.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI Canvas Theme.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI CLEAR.bmp Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI EA PART 9.mq5 Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI HISTORY.bmp Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI JSON FILE.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI Logic.mqh Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI LOGO.bmp Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI MQL5.bmp Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI NEW CHAT.bmp Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
AI SEARCH.bmp Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
Article-22495-Dispatch-Driven-AI-Trading-Signals.mqproj Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00
README.md Generated by MQL5 Wizard for the article https://www.mql5.com/en/articles/22495 2026-06-05 16:34:05 +03:00

Article-22495-Dispatch-Driven-AI-Trading-Signals

This repository is an article-derived reference project based on the original MQL5 article. It does not claim to reproduce the full original source code unless files are explicitly attached.

Overview

This project documents and reconstructs the architecture described in MQL5 article 22495. The article presents a canvas-based AI trading assistant for MetaTrader 5 that bridges the gap between free-form AI chat and executable trading actions.

The described system introduces:

  • a dispatch-driven action console with 7 actions
  • structured AI responses using a line-based KEY: VALUE protocol
  • parsing of AI output into trade-ready fields
  • unified routing for market and pending order placement
  • chart annotations for signals and levels
  • a custom canvas UI with prompt editor, popups, markdown rendering, and toast notifications

The repository should be treated as a technical reference/reconstruction unless the full article attachments are present.

Original Article

Repository Purpose

The purpose of this repository is to preserve the structure and implementation ideas of the article as a reusable reference for MQL5 developers.

It is primarily useful for:

  • studying a modular canvas-based EA architecture
  • understanding how to constrain LLM output for deterministic parsing
  • reviewing a dispatch-table approach for multiple trading actions
  • reconstructing an article-based Expert Advisor from its described modules
  • exploring chart-linked visualization of AI-generated trading signals

Key Concepts

  • Dispatch-driven action system using stable integer action IDs
  • Seven-button signal console on the chart
  • Separate handlers for:
  • Get Chart Data
  • Twin Bars
  • Quick Scalp
  • Daily Signal
  • Trend Read
  • Key Level
  • Clear Drawings
  • Shared AI bar preamble defining bullish/bearish/doji semantics
  • Bar formatting in descending time order
  • Line-oriented KEY: VALUE AI response protocol
  • Parser for extracting structured fields from AI output
  • Unified trade execution path for market and pending orders
  • Volatility-aware stop/target buffering
  • Canvas-based dashboard and editor instead of standard chart controls
  • Hover-code based interaction dispatch
  • Search/history popups, scrollbars, toast notifications, and markdown-like text rendering

Algorithm / Architecture Summary

The article describes a modular EA split across include files and a main .mq5 entry point.

High-level flow:

  1. User clicks an action from the signal console.
  2. A central dispatcher maps the selected integer action ID to its handler.
  3. The handler gathers chart bars and context for the requested analysis type.
  4. A constrained AI prompt is built using:
  • a shared bar-definition preamble
  • time-ordered bar data
  • action-specific instructions
  1. The AI returns a line-based response in KEY: VALUE format.
  2. The EA parses the response using a dedicated key-value extractor.
  3. Depending on the action:
  • market orders may be placed immediately
  • pending orders may be derived from level type and bias
  1. The result is added to chat history and rendered as chart drawings anchored to the active timeframe.
  2. Drawings can later be cleared through a dedicated action.

UI architecture described in the article includes:

  • theme and palette module
  • canvas primitive helpers
  • centralized state storage
  • reusable scrollbar state
  • custom multiline prompt editor
  • render orchestrator for main dashboard and popups
  • interaction layer for keyboard/mouse routing
  • logic layer for AI requests, parsing, trades, and persistence
  • shell/main EA lifecycle wrappers

Mentioned or Attached Files

Explicitly attached files

The article lists the following attachments:

  • AI Canvas Theme.mqh
  • AI JSON FILE.mqh
  • AI Canvas Primitives.mqh
  • AI Canvas State.mqh
  • AI Canvas Scrollbar.mqh
  • AI Canvas Editor.mqh
  • AI Canvas Render.mqh
  • AI Logic.mqh
  • AI Canvas Interact.mqh
  • AI Canvas Shell.mqh
  • AI EA PART 9.mq5
  • AI EA BMP FILES.zip

Files mentioned in article text

  • AI ChatGPT EA Part 9.mq5 as the main Expert Advisor entry point
  • Embedded bitmap resources:
  • AI MQL5.bmp
  • AI LOGO.bmp
  • AI NEW CHAT.bmp
  • AI CLEAR.bmp
  • AI HISTORY.bmp
  • AI SEARCH.bmp
  • Icon resource:
  • 1. Forex Algo-Trader.ico

Statistics

  • Source modules described: 9 include modules + main EA entry point
  • Dispatch actions: 7
  • UI approach: Canvas-based custom interface
  • AI response format: Line-based KEY: VALUE
  • Order styles described: Market and pending orders
  • Backtesting: Mentioned and illustrated in the article

Tags

mql5 metatrader5 expert-advisor openai llm canvas-ui algorithmic-trading signal-parsing dispatch-pattern chart-annotation

Difficulty

Advanced

This article describes a non-trivial MQL5 system involving UI rendering, event handling, parsing, AI integration, and trade execution.

Limitations

  • This repository is based on article analysis and attachment references.
  • Full verified source availability depends on whether the listed attachments are actually present in the processed repository input.
  • Some implementation details in the article are summarized rather than fully reproduced line-for-line.
  • The article references prior parts of a series for some canvas and AI infrastructure, so this project may depend conceptually on earlier work.
  • No installation or usage steps are provided here because executable completeness cannot be guaranteed from article text alone.
  • Sensitive configuration shown in article excerpts, such as API key handling, should not be treated as production-safe practice.

Reference