MQL5 Algo Trading
489K subscribers
3.1K photos
3.1K links
The best publications of the largest community of algotraders.

Subscribe to stay up-to-date with modern technologies and trading programs development.
Download Telegram
Programming for trading involves analyzing chart objects and their creation times to make informed decisions about buy or sell actions. By accessing the time property of these chart objects, you can determine their recentness and strategically decide the subsequent trading operation. Incorporating this logic into your trading code ensures that actions are taken based on the latest market patterns reflected by newly created objects. This approach is essential for developing trading algorithms that respond promptly to market shifts, enhancing the efficacy of your trading strategy. Utilize precise timing data to execute trades aligned with current market conditions.

πŸ‘‰ Read | Docs | @mql5dev

#MQL4 #MT4 #Algorithm
❀28πŸ†3πŸ‘¨β€πŸ’»3πŸ‘2⚑1
Explore how dynamic, multidimensional arrays enhance MetaTrader 5 development. The article introduces an innovative approach for managing complex object properties using dynamic arrays, allowing flexibility beyond traditional static arrays. Developers can now store various data typesβ€”integer, real, or stringβ€”using a custom class that dynamically adjusts to changing data dimensions. This progression facilitates streamlined storage of multi-property objects like graphical elements on a trading chart, solving the challenges of static array limitations. The approach ensures scalability and adaptability in storing dynamically changing object data, vastly improving algorithmic trading strategies with intricate, updatable data structures.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #Algorithm
❀66πŸ‘¨β€πŸ’»13
Discover how to enhance MetaTrader 5 Expert Advisors with a multi-signal framework that leverages the MQL5 Standard Library. Building on modularity, each signalβ€”whether using Moving Averages, RSI, or custom configurations like Fibonacci analysisβ€”acts independently, contributing to a robust collective strategy. Instead of relying on one approach, the system assigns specific roles to signals as either primary triggers or filters. This allows for adaptability across varied market conditions, ensuring resilience even if individual signals falter. By incorporating customizable features that align with user preferences, traders and developers can craft dynamic EAs capable of prevailing in diverse trading environments.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #Algorithm
❀57⚑13πŸ‘¨β€πŸ’»5πŸ‘Œ3πŸŽ‰1
Elevate your algorithmic trading strategy with an innovative approach that integrates the Relative Strength Index (RSI) with market structure awareness to generate high-probability trade entries. Traditionally reliant on breakout and retest models, this method leverages early momentum confirmation for enhanced timing and reliability. By developing a structured system using MQL5, traders can automate the detection of trend channels and RSI divergence, transforming manual strategies into precise, executable algorithms. This programmatic solution offers sophisticated risk management, ensuring more effective entries and reducing reliance on manual signal interpretation. Discover a robust path from market theory to algorithmic practice.

πŸ‘‰ Read | Forum | @mql5dev

#MQL5 #MT5 #Algorithm
❀27πŸ‘Œ2
The continuation of the MQL5 series focuses on reading pre-saved candle data into an MQL5 program for utilization in indicators and Expert Advisors (EAs). With the data stored in a structured file, the process involves opening the file, extracting candle values, and organizing the information for use in indicators or EAs. This section emphasizes the seamless transfer of data from external sources into MQL5, enabling users to visualize candle data.

Building an indicator to visualize this data involves setting indicator properties, determining the display format on charts, deciding the required buffers, and defining display rules for candles. Configuring these properties ensures the indicator is prepared to process and display data efficiently.

The subsequent step involves reading the saved file to arrange data, focusing on candle times. File access o...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Algorithm
❀28⚑2πŸ‘2πŸ‘€1
Statistical arbitrage frameworks are evolving for retail traders, focusing on probabilistic rather than historical market notions. By leveraging statistical methods like cointegration, relationships between diverse assets can be identified and traded. The challenge remains in the stability of these relationships over time, necessitating continuous monitoring and adjustments in portfolio weights.

Implementing techniques like In-Sample/Out-of-Sample ADF validation and Rolling Windows Eigenvector Comparison enhance detection and assessment of asset relationships. These methods fine-tune portfolio management and risk analysis.

Our scripted automation aids backtesting these strategies, highlighting adjustments needed for optimal real-time trading execution. Emphasis is placed on dynamic updates of portfolio weights using tested parameters, ensuring that ...

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #Algorithm
❀31πŸ‘Œ3😐1
Explore the next level of trading with our MQL5-based solution for dynamic support and resistance zones. This algorithm identifies these zones by analyzing market data in real-time, adapting as market conditions change. By transforming static lines into probability zones, it enhances trade execution and reduces uncertainty. Our approach integrates historical price analysis, identifying and marking extreme and average price reactions to reflect realistic market behavior. This innovative system allows traders to leverage consistent patterns while minimizing emotional trading decisions. Implemented through a tailored MQL5 indicator, it enables precise, real-time analysis, promising more informed and strategic decision-making for developers and traders alike.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #Algorithm
❀76πŸ‘Œ3😁2🀣2⚑1
When evaluating the functionality of CopyTicksRange(), several challenges were identified with managing millisecond precision. Originally, the intention was to utilize CDateTime for its flexibility in adjusting time units through increment and decrement methods. However, translating milliseconds (ulong format as seconds since 1 January 1970 multiplied by 1000) proved difficult, as milliseconds alone do not convey precise dates. Utilizing CDateTime or TimeStruct allows for easy manipulation of time units, though the format can become disjointed and unclear.

To address this, a new CDateTimeMsc class was developed. This class, essentially a structure under Structures/Classes, inherits from the prior format and extends functionality to integrate milliseconds when precise times are needed. Furthermore, methods for incrementing and decrementing have been ad...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #Algorithm
❀27πŸ”₯3πŸ‘Œ3⚑2πŸ‘1
The article expands the DoEasy library for MetaTrader 5 by enhancing support for graphical objects. It introduces new library classes for shapes, arrows, and other graphical elements, allowing them to be added to collections. The update also corrects a spelling error across library files and refines how graphical objects' properties are handled, particularly with anchor points. The article outlines improved methods for identifying and managing newly added graphical objects by storing them in a structured list, enhancing memory management, and preventing leaks. Developers can now efficiently track, sort, and integrate graphical objects within the trading terminal, providing enhanced chart management capabilities.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #Algorithm
❀60😁4⚑2πŸ†1
Concept development for improving library classes and defining descendant objects for graphical representation is underway. The focus is on expanding the abstract graphical object class by incorporating specific characteristics for objects in lines, channels, Gann, Fibo, and Elliott groups. This approach ensures that each descendant class highlights its unique properties while aligning with the overall structure of the abstract class.

Enhancements include adding a grouping property to the object class and improving time frame visibility functionality. This allows for more granular control over object properties, facilitating better management and manipulation within the library. Concrete examples involve the creation of classes for specific graphical object types, each with dedicated methods for handling associated properties.

These improvements aim to...

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #Algorithm
❀58πŸ‘Œ6πŸ‘€5⚑1
A mathematical approach to fractals reveals essential principles for model building. The article outlines developing an initial formula for fractals, suggesting that fractal-related values can be represented by a mathematical model applied in algorithmic trading systems. It describes symmetric and asymmetric corridors, highlighting the average step calculation for each. Symmetry simplifies to \(S=n^2\), while asymmetry involves distinct steps in each half of the corridor. A generalized formula for average steps considers probability deviations.

Further refinement of fractal calculations utilizes a prototype power function, allowing testing of mathematical assumptions. Techniques for evaluating function prototypes and verifying results are elaborated upon. Through this structured analysis, a deeper understanding of fractal geometry is achieved, aiding ...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Algorithm
❀60πŸ€”5πŸ‘Œ5πŸŽ‰4
The Billiards Optimization Algorithm (BOA), introduced by Hadi Givi and Marie HubΓ‘lovskΓ‘ in 2023, offers a unique approach to solving optimization problems by drawing inspiration from billiards. It models the search space as a pool table with solutions represented as balls moving towards optimal pockets. The iterative refinement process aims to balance global and local search using a stochastic method.

Implementation details reveal a method influenced by a combination of random and deterministic movement, guided by an equation that adjusts positions based on the proximity to target pockets. The algorithm runs through multiple iterations to refine solutions and approach optimality.

Initial test results suggested room for improvement, particularly in navigating large-dimensional problems or avoiding local minima. Revising the movement equation for...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #Algorithm
❀54✍6πŸ”₯6🀨5πŸ‘Œ4πŸ‘3
Enhancing the library classes involves optimizing existing code to improve readability and reduce redundancy by formalizing repetitive logic into functions or methods. This approach streamlines code management, ensuring a cleaner and more efficient structure.

The addition of a geometric animation frame object class enables easier construction of regular polygons by calculating their vertex coordinates using geometric equations, improving precision and reducing manual calculations.

Adjustments have been made to accommodate geometric shapes, including changes in animation frame naming conventions and the addition of new enumeration types for geometric animations. This ensures consistent handling of all animation frames regardless of their shape or type.

Geometric animation frames now facilitate inserting regular polygons into circumscribed circles, e...

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #Algorithm
❀83πŸ‘13πŸ‘Œ6πŸ‘€4πŸ’”3🀯1
Explore the next phase of algorithmic trading with MetaTrader 5 as we enhance support and resistance zones with decision-making intelligence. Building on earlier work, we're shifting from passive analysis to active decision making. The focus is on programmable entry logic using candlestick patterns within specific zones, vital for precise trading in smaller accounts. Automating detection and notifications ensures traders capture every opportunity efficiently. We present a modular system leveraging MQL5 for real-time alerts, zone-awareness, and advanced candlestick detection. This innovation paves the way for future automated solutions, offering both traders and developers a robust framework to refine and execute trading strategies.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Algorithm
❀94πŸ‘Œ7πŸ‘4πŸ’―2✍1
The Successful Restaurateur Algorithm (SRA) offers a unique approach to optimization by focusing on improvement rather than elimination. Unlike traditional methods, SRA enhances weaker solutions by integrating successful elements from better ones, maintaining diversity and steady improvement.

The implementation involves a main loop that selects the least successful "dish," combines it with elements from the best, and evaluates the new solutions. Parameters like temperature and innovation rate control experimentation intensity, balancing exploration and refinement.

Tests show SRA's broad search capabilities but highlight its challenges in precise solution refinement, ranking it 20th among population optimization algorithms. Despite mixed results, SRA's distinctive strategy provides valuable insights for future algorithm development.

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #Algorithm
❀64πŸ”₯7πŸ†6⚑5🀨5πŸ‘€3✍2
Neuroboids Optimization Algorithm (NOA) reframes population-based optimization as many tiny neural agents. Each β€œneuroboid” is a minimal two-layer network trained with Adam, using the current best candidate as a moving target rather than hard-coded swarm rules.

The loop is straightforward: random initialization, per-agent forward pass to propose a step, error vs. the best solution, backprop updates, then position updates with scaling to [-1, 1] and bounded resampling. A small elite-copy probability adds controlled exploitation while preserving diversity.

In benchmark tests (Hilly, Forest, Megacity), NOA reached about 45% of the maximum aggregated score for small to moderate dimensions, but becomes too slow at very high dimensionality (e.g., 1000 variables). Visual runs show fan-like movement patterns that reflect learned search directions across age...

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #algorithm
❀25πŸ‘6πŸ‘Œ2πŸ”₯1
Part 11 builds a MetaTrader 5 correlation matrix dashboard to quantify cross-asset relationships for portfolio design, hedging, and multi-symbol strategies. It supports Pearson (linear), Spearman (rank-based), and Kendall (order agreement), all computed on price deltas over a selectable timeframe and bar count.

Two visual modes are implemented: a standard grid using configurable thresholds plus p-value β€œstars” for statistical confidence, and a heatmap using color interpolation to reveal subtle correlation differences.

The MQL5 design emphasizes extensibility: symbol-list parsing with Market Watch validation, matrices for correlations and p-values, reusable CDF-based p-value functions, and event-driven UI controls for timeframe and mode switching with automatic refresh on new data.

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #algorithm
❀28⚑4πŸ‘Œ1
GUI animation on CCanvas requires deterministic redraw. Overpainting frames accumulates pixels, so state must be restored before drawing the next frame.

A minimal sprite workflow is implemented by caching the background under a moving element, drawing the element, then restoring the cached pixels on the next update. This scales better than full form redraw for multiple independent elements.

GCnvElement is extended to store an initial pixel snapshot, add resource-to-array copying, and track last text coordinates plus anchor-based X/Y offsets for correct background capture.

ShadowObj is simplified by reusing the new base snapshot and Width/Height accessors. Form.mqh adds a pixel-copier class with ID-based instances, storing rect coordinates, effective clipped size, and save/restore methods for partial canvas regions.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #algorithm
❀67πŸ‘Œ11
Work continues on structural templates and type overloading, moving from basic structs toward data-aware containers used in search and lookup tasks.

The example models a key/value association using two arrays (K as keys, H as values). A direct index access fails when K is unordered, so the relationship must be preserved while enabling efficient search via sorting or binary search.

A refined approach embeds the lookup inside a struct: search K for a key, then return H at the same position. This keeps the mapping intact and prepares the code for reuse.

Generalization then starts by templating one base type to trigger compiler overloading. This introduces warnings when return types and stored types diverge, highlighting a common library-design risk: hidden conversions and mismatched expectations.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #algorithm
❀67πŸ‘Œ4😱3πŸ‘1😁1
Structured vs organized code remains a frequent source of confusion. A practical boundary appears when structures start carrying context through internal procedures, before transitioning to classes and OOP.

A struct with public data can compute average/median, but it also allows external writes. After a reset, memory may be reused incorrectly, producing wrong medians and hard-to-trace faults. This is a typical encapsulation error.

Marking internal arrays as private blocks direct access and even prevents blanket memory wipes, forcing explicit API methods for set/reset/print. The result is tighter invariants, clearer intent, and fewer hidden state bugs, at the cost of more deliberate design.

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #algorithm
❀30πŸ‘Œ2
Part 41 shifts from writing trade journals to reading them back in MQL5, using a practical target: an indicator that ingests a CSV trading history and plots a balance curve from profit/loss over a selected period.

The core technique is treating CSV content as sequential elements (cell-like values), not β€œlines of text”. The workflow starts by opening the file in FILE_READ with CSV parsing and defined encoding, validating the handle, and using FileIsEnding + incremental reads to count total elements for safe loop bounds.

After counting, the file pointer is reset, then all elements are loaded into dynamic arrays. This enables scalable grouping by column (TradeID, LotSize, etc.), avoids fixed-size structures, and prevents out-of-range errors when processing real trading logs.

πŸ‘‰ Read | CodeBase | @mql5dev

#MQL5 #MT5 #Algorithm
❀28⚑5πŸ‘Œ3