MQL5 Algo Trading
400K subscribers
2.63K photos
2.63K 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
The text covers the integration of AutoIt with MQL5 for automation tasks in MetaTrader 5. AutoIt is highlighted as a tool for Windows GUI automation, offering capabilities not possible with MQL5 alone, such as script and expert advisor management on charts and alert handling.

The integration process includes using AutoItX, a DLL library for AutoIt functions, compatible with MetaTrader 5. This requires setting up a working environment and handling limitations due to AutoIt's reliance on standard Win32 API components.

The text introduces classes such as CAutoit and CTerminalController to encapsulate AutoIt functions for streamlined automation in MetaTrader 5, focusing on GUI element identification and control interactions for efficient task execution.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #AutoIt
❀148πŸ‘¨β€πŸ’»17πŸ‘Œ10πŸŽ‰6😁5🀣4⚑2
An Expert Advisor (EA) has been developed to alert users about the Depth Per Inch (DPI) of their monitors, a crucial tool for those working with varying screen resolutions. Typically, panels are designed to function with a limited range of resolutions when default settings are applied. However, to ensure compatibility across all monitor resolutions, integrating DPI measurements into panel dimensions is essential. This code provides a solution, facilitating the creation of adaptable panels that adjust according to the specific DPI of the user's display. This ensures consistent performance and appearance regardless of the monitor setup.

πŸ‘‰ Read | Forum | @mql5dev

#MQL4 #MT4 #EA
❀33πŸ†3⚑2πŸ‘Œ2πŸ‘¨β€πŸ’»2πŸ‘1
The article delves into developing advanced container controls for modern UI design within MetaTrader 5, emphasizing their integration within the MVC paradigm. Key controls like Panel, GroupBox, and Container are explored for placing various UI elements, each having distinct properties: Panels act as general-purpose containers, GroupBoxes group elements for specific functionalities, and Containers enable seamless content scrolling with automatic event handling for intuitive navigation. The article highlights implementing a Singleton class for shared data management, and auto-repeat classes for standard OS-like button behavior. These innovations enhance developers' ability to create user-friendly, ...

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 provide a mechanism for overriding by derived classes when necessary. The following hashtags are recommended based on the key focal points of the content: #Singleton
❀32πŸ‘Œ2πŸ‘€2πŸ‘¨β€πŸ’»1
Modern algorithmic trading requires balancing high returns with risk management to protect capital against volatility and systemic risks. An Expert Advisor (EA) achieves this through a multi-layered protection framework integrating dynamic lot sizing, exposure controls, and real-time monitoring. This approach uses adaptive measures, including equity floors, drawdown management, and recovery protocols to regulate trades and adjust exposure dynamically.

A sophisticated automated trading system focused on gold employs a martingale recovery strategy with robust protections like dynamic stops and daily loss limits. By using EMA crossovers, the system strategically places trades and manages risk through multi-layer defense mechanisms to limit potential losses while allowing for recovery from setbacks. During volatile market sessions, the EA employs circuit brea...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #EA
❀32πŸ†3πŸ‘¨β€πŸ’»2πŸ‘Œ1
In the latest iteration of our MetaTrader 5 series, we transform the Kagi chart engine into a full-featured Expert Advisor. Building on the Kagi structure, we introduce features enabling automated trading in response to market changes. The EA now detects reversal signals, places trades, manages risk, and visualizes signals with markers. Designed for flexibility, traders can enable or disable trading, choose trade directions, and select between manual or automatic lot sizing. Enhanced risk management includes stop loss, profit-taking, and optional trailing stops, all aligned with Kagi patterns. This update equips traders with a comprehensive system for any instrument on MetaTrader 5.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #EA
❀27⚑3πŸ‘Œ3πŸ‘¨β€πŸ’»2
We are progressing with the system for automating the optimization of trading strategies in MetaTrader 5. At its heart is a database designed for optimization projects. We've crafted a script to initiate projects, notably for the SimpleVolumes strategy, but adaptable to others. Exporting optimized strategy groups into an EA database occurs automatically, updating trading systems' settings without recompilation.

We've reorganized the project files, moving non-strategy-specific components to a library in the MQL5/Include folder. Remaining components like stage EAs and scripts reside in MQL5/Experts. This setup facilitates automatic optimization across varying strategies, easily integrating new strategies like the SimpleCandles strategy into this framework.

For SimpleCandles, the strategy employs a candle direction approach for trading decisions, rely...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #Trading
❀20πŸ‘Œ4πŸ‘¨β€πŸ’»2
The recent archive of models offers a diverse set of options for personalizing model training, particularly due to varying hyperparameters. These machine learning models are developed in Python and are then converted to ONNX format, ensuring ease of use without requiring code adjustments in the encludnik. The configuration remains straightforward, although users can apply custom filters for enhanced model performance, such as optimizing stop loss and take profit across different timeframes.

The models connect via a header file, exemplified on 31 March 2024. Examples include clustering techniques using the k-means method and training data spanning from 2010 to 2020, with forward testing from 2020 to 2024. The "ONNX Trader Clusters" bot embraces these models, supporting the training method from "Matching trades using clustering." By linking the ...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #MachineLearning
❀18πŸ‘¨β€πŸ’»6πŸ‘Œ4πŸŽ‰2
A library offering concise descriptions for each error in the MQL5 Reference has been developed, with regular updates as the documentation evolves. The latest update was released on February 29, 2024. For optimal use, ensure the file ErrorDescription2.mq5 is placed in the \MetaTrader 5\MQL5\Include folder. An upcoming library will feature a class to streamline error handling in MQL5, enabling simplified user error reporting through methods like Raise(my_error). This endeavor promises enhanced efficiency in managing errors within MQL5 projects. Stay informed for future developments and releases.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #Library
❀16πŸ‘Œ3✍1⚑1
The Chaos Game Optimization (CGO) algorithm, introduced by Siamak Talatahari and Mehdi Azizi in 2020, employs chaos theory principles and chaotic sequences for achieving global optimization in complex multidimensional spaces. The algorithm's effectiveness lies in its ability to leverage chaotic sequences, which help in navigating around local optima and enabling the discovery of high-quality solutions across diverse problem domains.

Implementation of CGO involves an algorithm class derived from a base class, with specific methods like SetParams, Init, Moving, and Revision that set parameters, initialize search spaces, orchestrate agent movements, and revise solutions, respectively. Key components include generating new solutions using chaotic sequences and updating best-known solutions.

Test results indicate that CGO's performance, though mode...

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #Optimization
❀16πŸ‘3πŸ‘Œ3
The development of an Inverse Fair Value Gap (IFVG) detection strategy continues in MetaQuotes Language 5 (MQL5). Following detection of Fair Value Gaps (FVGs), IFVGs are introduced to identify states where a mitigated gap inverts direction due to price action. Settings like colors for state visualization, trading modes, and handling overlapping FVGs are configurable.

The implementation involves setting up input parameters, declaring global variables, and utilizing existing MQL5 libraries for managing trades. Specific functions are defined for creating and updating visualization elements such as rectangles and labels to display FVG zones and states. Historical data is analyzed during initialization to process past FVGs, updating their states to guide decision-making.

The system extends its capability by scanning and updating setups with the appearance of new bar...

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #EA
❀21✍4⚑3πŸ‘Œ2
A script has been developed to calculate autocorrelation and partial autocorrelation functions, displaying results graphically. Key input parameters include:

1. N: Data window for calculation, where a default value of 100 is set. Capable of handling large datasets, it efficiently processes over 100,000 bars.

2. K: Number of lags for analysis, defaulted at 16. Typically, analysis remains effective with lags under 40, though the script supports up to 500.

3. start_pos: Defines data window offset, with zero indicating calculations start from the latest loaded bar.

4. duration: Chart display period, set for 10 seconds.

These settings facilitate comprehensive time series analysis, enabling efficient examination of large datasets for technical insights. Adjust parameters according to specific analysis needs.

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #script
❀20πŸ‘Œ2
A library for keyboard operation is essential for managing keyboard layouts and key processing. It includes comprehensive data on various keyboard layouts, allowing for the configuration and recognition of different key arrangements. This library aids in determining the status of keys, whether they are pressed, released, or held down, and provides efficient processing for these events to trigger corresponding actions in applications.

An example usage scenario includes handling key inputs in a software program, where the library detects the keyboard layout in use, interprets user input correctly, and reflects real-time key status changes. By integrating such a library, developers can ensure their applications respond accurately to various keyboard inputs across different systems and configurations. This enhances user interaction and input reliability in d...

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Keyboard
❀15πŸ‘Œ2
Explore a new approach in trading with the integration of RSI for smart stop-loss mechanisms. The research compares two strategies: a traditional fixed stop-loss against an innovative RSI-based stop-loss system. The findings reveal that while RSI lowers the risk of being hunted, traditional methods demonstrate higher profitability and consistency in practice. Notably, the RSI strategy showcases reduced risk and psychological benefits for traders, offering an alternative for those seeking a more methodical approach. For developers and traders, this insight highlights the importance of risk management and presents RSI as a potential tool to minimize stop-loss hunts, albeit with some trade-offs in profitability.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Strategy
❀19✍2πŸ‘Œ2
Deploying machine learning-driven trading applications poses numerous challenges, primarily due to hard-to-detect errors not addressed in standard literature. A major issue is model assumptions violation, which often leads to silent failures in trading algorithms. All statistical models require assumptions about data relationships, and flexible models with minimal assumptions are often preferred. However, a model without any assumptions is unfeasible.

Models depend on the assumption that the target is a function of given observations. Violating this foundational assumption can lead to unnoticed failures. Existing statistical tests to verify assumptions are problematic and may yield misleading results, exposing practitioners to substantial risks.

A proposed solution involves generating new candidate targets from input observations. This self-supervised le...

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #ML
❀24πŸ‘€5πŸ‘Œ2
An advanced MetaTrader 5 Expert Advisor (EA) seamlessly combines Smart Money Concepts (SMC) like Order Blocks, Fair Value Gaps, and Break of Structure with real-time market sentiment analysis. The EA dynamically adapts to market conditions, selecting optimal strategies for bullish, bearish, or neutral phases. It operates across multi-timeframes to analyze trends and volatility, ensuring a cohesive trading approach. By focusing on sentiment and structural price insights, the system intelligently executes trades aligned with market directions, enhancing efficiency and precision. This framework offers a sophisticated tool for traders and developers aiming to implement adaptive algorithmic trading strategies.

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #EA
❀33πŸ‘Œ2
Analyzing indicator combinations for the VGT ETF was the previous focus, but here the goal shifts towards selecting complementary indicators methodically. The process of selecting technical indicators is prone to subjectivity and could lead to biases like survivorship and hindsight-confirmation. Rigorous methods are crucial, particularly for ETFs like FXI, which exhibits dynamic behavior influenced by external events. Volatility, momentum shifts, and liquidity changes mandate a robust analytical approach.

A Python-based plan integrates segmentation of FXI’s data into quarterly β€˜discrete-windows’ to assess indicator performance across market regimes. Data preparation is critical to ensure integrity with operations to validate, re-synchronize, and label data properly. A well-organized dataset facilitates reliable indicator scoring with minimal errors.
...

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #Dataset
❀54⚑7πŸ‘Œ5🀯4
The primary function of this indicator is to assess the possibility of price maximums and minimums. It begins by gathering historical price data for analysis. By evaluating the current market conditions and comparing them to historical statistics, the indicator generates signals. These signals can serve as an auxiliary filter to predict potential market reversals.

Key parameters include iPeriod, denoting the period length with a minimum of 2, and History, indicating the number of bars analyzed for statistical collection. A History value of 0 implies a comprehensive analysis of all data. Be aware that larger history values may slow down initialization. The Percent parameter sets the signal threshold; a higher value results in less frequent alerts. Initial calculations may require additional time due to the extensive statistical gathering process.

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #Indicator
❀30πŸ‘€4
Automating trading processes is instrumental in addressing prop firm challenges. These firms impose strict rules that differ from personal trading, requiring adherence to drawdown and risk limits. Traders often excel in strategy but struggle with emotional discipline and manual risk monitoring.

The designed Expert Advisor (EA) offers a solution by automating trade execution with built-in risk management. It evaluates trade setups based on strict criteria, preventing rule breaches with a 2% risk cap per trade. Utilizing ATR for stop-loss levels, it avoids risks during volatile news periods.

The EA's robust logic handles gold's volatility specifically. It dynamically adjusts position sizing and employs precise trade management. This includes trailing stops and profit-taking mechanisms to optimize reward-to-risk ratios. Key features include drawdown protect...

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #EA
❀64✍5πŸ’―4πŸ‘€4πŸ‘Œ3
Currently drafting a series of articles on developing a multicurrency Expert Advisor (EA) with multiple trading strategies. Code from these articles will be available in a library, and it's advised to review it sequentially to understand progressive improvements.

Part 1 focuses on integrating multiple strategies within a single EA, enhancing risk diversification and trading stability without managing them separately. Part 2 progresses by shifting market position handling to the EA level, enabling strategies to function virtually. Part 3 involves revisiting and optimizing the architecture based on initial development experiences.

Part 4 adds functionalities for handling pending orders and ensuring state persistence after system restarts. Part 5 introduces variable position sizing, moving beyond fixed sizes for live trading.

Part 6 aims to aut...

πŸ‘‰ Read | VPS | @mql5dev

#MQL5 #MT5 #ExpertAdvisor
❀19
Recent evaluations have highlighted performance and accuracy issues with the standard API functions ChartXYToTimePrice and ChartTimePriceToXY. ChartXYToTimePrice fails to function correctly when X and Y parameters fall outside the visible chart window, defaulting to zero values. Additionally, ChartTimePriceToXY experiences inaccuracies in certain scenarios. Both functions exhibit slow performance.

To address these issues, a revised script demonstrates improved accuracy across all parameter ranges. It utilizes a method where X and Y coordinates are translated to time and price and then reverted back. Accuracy is validated if input coordinates match the output. A discrepancy indicates functional errors, notating the issue during execution. The script concludes by reporting the final outcome, remaining silent if functionality is assured.

πŸ‘‰ Read | AppStore | @mql5dev

#MQL5 #MT5 #script
❀22
Introducing a tool designed for technical traders focusing on delta metrics: Cumulative Delta, Net Delta, and their divergences. Key features include tracking aggregated buy and sell volumes through Cumulative Delta and analyzing the difference in buying and selling pressure via Net Delta for each bar. The tool also offers a session reset for tailored intraday analysis and includes EMA smoothing for more refined and legible delta curves.

Engineered to meet the needs of traders monitoring order flow dynamics and volume imbalances, these features allow detection of pivotal divergences. Such divergences include bullish and bearish indicators, where potential market reversals are highlighted. Additionally, hidden and exhaustion divergences provide insights into trend confirmations and possible corrections. This solution remains lightweight and fast, focusi...

πŸ‘‰ Read | Calendar | @mql5dev

#MQL5 #MT5 #OrderFlow
❀21πŸŽ‰4πŸ”₯2