Skip to content
All library documents

Building an MQL5 Order-Sending Class for an Automated Trading System

Article MQL5 articles

Summary

This tutorial introduces the code structure for a basic automated trading system in MQL5, focusing on a custom class that sends orders. It explains how to create an include file, add a class with private and public members, and connect that class to an Expert Advisor. The design goal is deliberately narrow: rely on the platform to display and manage orders and positions, while the custom class handles sending trade requests and stores relevant instrument details.

The article walks through testing the order system with a simple interface that gathers order parameters and keyboard actions to submit buy or sell orders at a specified price. It emphasizes initializing the class before using its procedures and checking the resulting order in the platform’s Trade tab. This is an early installment in a larger series, so the implementation is intentionally basic and does not provide a complete trading strategy or a full replacement for the standard library. The guidance is educational, and the author cautions against using the current price when manually checking order placement.

Key ideas

  • A custom class can isolate order-sending logic from the rest of an Expert Advisor.
  • Private and public members control which parts of a class can be accessed externally.
  • The example delegates order and position display and management to the trading platform.
  • A simple interface can be used to submit test orders and inspect them in the Trade tab.
  • The implementation is an introductory order-system component rather than a complete Expert Advisor.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.