MQL5 Templates

repository·master·Indexed 42 days ago

https://github.com/sibvic/mq5-templates

A collection of templates and snippets designed to accelerate the development of MQL5 indicators and Expert Advisors (EAs), specifically optimized for conversions from PineScript via the Trade Script Convertor. It includes a comprehensive Action system (IAction), a logical Condition hierarchy (ICondition), a Grid system for data display, and money management strategies (IStopLossStrategy), as well as PineScript-style array implementations.

Tokens
7.2K
Snippets
6
Records
96
Agent score
51%

What's inside mq5-templates

  1. Overview of PineScript-like functions for MQL5

    master
    This collection provides a set of MQL5 functions designed to mimic the syntax and behavior of PineScript (TradingView). These functions allow developers to write MetaTrader 5 code using familiar patterns from PineScript, covering string manipulation, strategy-to-indicator conversions, symbol information, timeframe handling, extended mathematics, and plotting shapes.
  2. Use the mq5-templates for MQL5 development

    master
    This repository provides foundational templates for MetaTrader 5 (MT5) development using MQL5. It includes base structures for Expert Advisors (EAs), Indicators, and specialized components like heatmaps to accelerate the development process.
  3. Use abstract stream implementations for MQL5

    master

    The Streams/Abstract directory provides base abstract classes that implement specific stream interfaces. These classes are designed to be extended to create concrete stream implementations for different data types in MQL5/MT5.

    Available abstract implementations include:

    • AFloatStream: Implements IFloatStream.
    • ADateTimeStream: Implements IDateTimeStream.
    • AColorStream: Implements IColorStream.
    • AStringStream: Implements IStringStream.
    • TAStream: Implements TIStream.
  4. Use Enum snippets for MQL5 development

    master
    This collection provides Visual Studio Code snippets for common MQL5 enumerations. These snippets allow for rapid insertion of standard enum types used in MetaTrader 5 development, such as order sides, position sizing, stop/limit types, and moving average types.
  5. Available MQL5 Snippets and Utilities

    master

    The repository provides a collection of specialized snippets and utility classes for MQL5 development, including:

    • Data & Information: InstrumentInfo (instrument details), Syminfo (PineScript-style syminfo functions), and HeatMapValueCalculator (heatmap logic).
    • Iteration: TradesIterator (active trades), OrdersIterator (active orders), and ClosedTradesIterator (historical trades).
    • Trading Logic: TradingCalculator, Condition, MoneyManagement, TrailingController, BreakevenController, and EntryPositionController.
    • Order Management: MarketOrderBuilder, OrderBuilder (for creating order commands), TradingCommands, TradeController, and OrderHandlers (actions for new orders).
    • Visuals & PineScript Conversion: AlertSignal (drawing arrows on conditions), PlotChar (PineScript-style plotchart), and PineScriptUtils (converting Pine Script to MQL5).
  6. Create logical combinations with AndCondition and OrCondition

    master

    You can combine multiple conditions using logical operators:

    • AndCondition: Returns true only if all constituent conditions return true.
    • OrCondition: Returns true if at least one of the constituent conditions returns true.
    • NotCondition: Inverts the result of another condition (logical NOT).
  7. Draw trend lines with Polyline and PolyLinesCollection

    master

    For drawing complex trend lines, use the following:

    • Polyline: An object for drawing trend lines. It manages its own creation, deletion, and redrawing using reference counting support.
    • PolyLinesCollection: A collection manager that handles the creation, deletion, and organization of polyline objects across multiple collections, providing automatic cleanup and memory management.