MQL5 Algo Trading
387K subscribers
2.56K photos
2.56K 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
Dive into the latest steps in building the Connexus library for MetaTrader 5! This installment reveals the CHttpClient class, designed to streamline HTTP requests using the WebRequest function. By transforming CHttpRequest objects into HTTP calls, it simplifies complex web interactions, returning CHttpResponse with comprehensive data. To avoid tight coupling issues, the library introduces interfaces and dependency injection, enhancing maintainability and flexibility. This approach allows easy testing with mocks, simulating real scenarios without network dependence. Connexus is evolving into a robust, adaptable tool for developers interfacing MQL5 with external APIs efficiently.
#MQL5 #MT5 #HttpLibrary #Algorithm

Read more...
πŸ‘40❀32πŸ‘¨β€πŸ’»7πŸ‘Œ2πŸ€”1πŸ’―1
Developers focusing on technical indicators may find interest in a tool for marking extremums with lines. Key features include setting periods to define highest highs and lowest lows, using both OHLC data and bid/ask prices for a comprehensive analysis. It incorporates a lookback function to restrict processing to a selected number of bars, optimizing performance. A unique capability is its ability to hide line segments during break of structure, ensuring visibility only on real support and resistance areas. This feature is adjustable, allowing preference for displaying lines on extreme prices and indicating trends. Note: An initial upload contained a logic mistake, but has been corrected with a revised version now available.
#MQL5 #MT5 #Indicator #Strategy

Read more...
πŸ‘29❀18πŸ‘¨β€πŸ’»4πŸ‘Œ2πŸ‘1
Returning to test automation, focus shifts to the second stage of optimizing trading strategies. The first stage involved optimizing parameters for individual strategy instances, with results stored in a database. Next, a selection of strategy groups is undertaken to improve trading metrics like reduced drawdown and increased balance curve linearity.

Implementations involve manual and automated selection from database-stored parameters, utilizing genetic optimization for grouping strategies. Modifications to the CDatabase class are necessary for managing multiple databases, enhancing flexibility in switching between primary and task databases for storing results.

The development of EA for the second optimization stage is discussed, utilizing database management to extract relevant data and create efficient test tasks. The EA setup relies on a structured ap...
#MQL5 #MT5 #EA #Algorithm

Read more...
❀23πŸ‘21πŸ‘Œ5πŸ‘¨β€πŸ’»3πŸ”₯2✍1πŸ’―1
The latest update in Version 2 introduces a 'Time control' feature and removes the 'Profit limit for close all' and 'Withdrawal' parameters. Enhancements include a trailing lot size control, detailed in the RSI Dual Cloud EA code. Trading signals are now verified with the emergence of new bars, analyzing the iAMA (Adaptive Moving Average) and iRSI (Relative Strength Index) indicators.

The process for generating a signal follows two steps. For an "Open Buy" signal:

1. RSI should be below 30, as set in the 'RSI Level Down' parameter.
2. The price needs to surpass the AMA indicator.

To optimize the indicator relationship, the 'Step Length' parameter defines the bar interval between these steps. Regarding the Martingale strategy, upon receiving a trading order, the system checks BUY and SELL positions' profits. For an "Open Buy," if BUY profits are negative,...
#MQL5 #MT5 #RSI #Strategy

Read more...
πŸ‘52❀29πŸ‘¨β€πŸ’»2πŸŽ‰1πŸ‘Œ1
Discover a refined solution for managing Take Profit (TP) and Stop Loss (SL) levels directly on the MetaTrader 5 chart using an Expert Advisor (EA). This approach enhances order management efficiency by leveraging the platform's tickets system to swiftly correct TP and SL values without external dependencies. By integrating a new drag-and-drop feature for stop levels, you can intuitively visualize and modify them while circumventing common pitfalls like negative TP values. Simplify your trading workflows with improved accuracy and speed, thanks to well-defined macros and functions, making efficient order adjustments accessible for traders and developers alike.
#MQL5 #MT5 #ExpertAdvisor #StopLoss

Read more...
πŸ‘34❀28πŸ‘Œ5πŸ‘¨β€πŸ’»4πŸ†3
The built-in economic calendar of MetaTrader 5 often faces synchronization challenges with historical quotes. This is primarily because the quotes use timestamps based on the server's time zone at the formation of the bar, which remain static, while the economic calendar events are linked to the current server time. Events may appear shifted due to daylight saving time adjustments or more significant time zone changes by brokers. This leads to misalignments of historical events with associated bars, complicating news-based strategy testing.

Addressing this, an extended solution has been developed using CalendarCache.mqh and CalendarMonitorCachedTZ.mq5. This updated indicator dynamically updates event information on charts and automatically corrects time discrepancies using the TimeServerDST.mqh library. Comparing CSV files with and without correctio...
#MQL5 #MT5 #AlgoTrading #Backtest

Read more...
πŸ‘30❀23πŸ‘¨β€πŸ’»4⚑2πŸŽ‰1πŸ‘Œ1
Enhancing graphical UI elements in development environments requires meticulous adjustments to object visibility and containment methods. Each graphical component remains confined within its designated boundaries, with overflow parts obscured. The edges of the container or the inner frame outline these visibility limits.

The challenge lies with canvas elements, as typical bitmap cropping techniques fall short due to memory constraints. An alternative approach involves custom scoping, manually concealing overflow sections by coloring them with transparency. This solution necessitates development of auxiliary button objects featuring arrows for UI controls like scrollbars.

Adjust library classes with updates to graphical object properties, sorting methods, and introducing auxiliary object types. Modifications ensure objects respond accurately ...
#MQL5 #MT5 #Algorithm #GraphicalElements

Read more...
πŸ‘36❀35πŸ‘¨β€πŸ’»3πŸ”₯2πŸ‘Œ1
The Expert Advisor (EA) focuses on several core trading and technical principles designed for effective trade replication across multiple accounts and brokers. The trade copying or mirror trading concept is central, enabling fund managers or traders to replicate trading activities from a master account to multiple slave accounts. This system facilitates risk distribution and strategy execution across various brokerage platforms.

At its core, this solution operates within a two-tier architectural setup: the master account, which serves as the source, and the slave accounts, which replicate the positions. Communication between these accounts is executed through a binary file system, allowing for faster and more efficient data transfer than conventional text files.

Position management within the EA is executed in real-time, ensuring open positions, stop...
#MQL5 #MT5 #TradeCopy #RiskMgmt

Read more...
❀30πŸ‘28✍5⚑2πŸ‘Œ2πŸ‘¨β€πŸ’»2
The article discusses advancements in a tool for neural network model editing, particularly enhancing its usability for MetaTrader 5 developers. Key updates include comprehensive neural layer information display, enabling better management of model architectures. With adjustments in the CListView class, the tool now offers clearer visualization of neural layers, aiding developers in model selection and modification. Moreover, by refining input fields, developers can better configure neural layer parameters, enhancing accuracy and reducing errors in algorithmic trading setups. The improvements aim to empower traders and developers to experiment with neural network architectures efficiently without altering source code, thus facilitating streamlined algorithmic trading processes.
#MQL5 #MT5 #AI #NeuralNet

Read more...
πŸ‘41❀27πŸ‘Œ3πŸ‘¨β€πŸ’»3🀑2
An efficient solution for automated trading, this expert advisor reads commands from a text file to execute orders. This method facilitates streamlined order management by allowing traders to place, modify, or close trades without manual input in the trading platform. This approach can be particularly useful for those integrating external systems or scripts to influence trading actions. By processing text-based instructions, the expert can offer enhanced flexibility and automation in trading operations. It's essential to ensure that the text file is correctly formatted and continuously monitored for the system to function seamlessly.
#MQL5 #MT5 #EA #Algorithm

Read more...
πŸ‘28❀15⚑2πŸ‘Œ2πŸ‘¨β€πŸ’»2
Recent improvements in the Replay/Simulator system involved refining a mouse pointer for enhanced integration with chart objects using MQL5 programming. The distinction between ChartOpen and ChartID functions was emphasized, showing their long-term implications for broader applications. Integration challenges were identified due to prior oversights during development, particularly in the interaction of the mouse pointer with the control indicator.

To address this, small but crucial adjustments were made in the mouse pointer code, such as modifying buffer index values to extend coverage. This refinement aids in integrating the pointer functionality into projects, creating a tailored, stable study system. The control indicator and its supporting code were updated for better alignment with price-time coordinates, ensuring smooth operation within gra...
#MQL5 #MT5 #Programming #AlgoTrading

Read more...
πŸ‘30❀17πŸ‘¨β€πŸ’»4πŸ‘Œ1
In the subsequent stage of implementing the script for visualizing deals, focus is on selecting data for an individual deal and rendering the necessary chart objects. Utilize the HistorySelectByPosition() method to obtain historical data by a unique POSITION_IDENTIFIER from MetaTrader 5, which is input through a global variable. The procedure mirrors the logic from the previous selection but simplifies historical order requests.

Opening charts entails verifying symbol validity to prevent errors associated with "non-existent symbols," often arising from variations in broker account types or Market Watch window settings. This includes deviations like commission charges and spread variations contingent on account and instrument types. Symbols are validated using the SymbolSelect() function, ensuring availability in Market Watch.

Once symbols are confirme...
#MQL5 #MT5 #script #DealVisual

Read more...
❀42πŸ‘37✍5πŸ‘Œ4
Consider a straightforward indicator designed to create a smoother line chart while utilizing tick volume to assess market direction. The primary objective is to deliver an accurate depiction of market movements. Unlike the traditional line chart, this indicator filters out minor, volatile fluctuations for clearer insights. Users have the option to modify smoothing levels via input adjustments. Graphical elements enhance the depiction of market trends, providing visual clarity on directional shifts. It is recommended to exercise caution and avoid making trading decisions when the line signifies horizontal movement, as this may indicate a lack of clear market direction.
#MQL5 #MT5 #Indicator #AlgoTrading

Read more...
❀23πŸ‘19πŸ€”2πŸ‘Œ2πŸ‘¨β€πŸ’»2
Chemical Reaction Optimization (CRO) is a unique algorithm that draws on principles from chemistry to tackle complex optimization problems. This method incorporates the energy dynamics of chemical reactions, leaning on thermodynamic laws, to structure its approach.

Four main operators characterize the CRO algorithm. The intermolecular ineffective collision allows molecules to collide without drastic changes, promoting local exploration around current solutions. Decomposition sees molecules split to probe new solution areas. Intra-molecular reactions involve minor structural changes while retaining the molecule, aiding in local searches. Synthesis enables the formation of new solutions by combining two molecules, potentially enhancing solution quality.

This framework maintains a balance of exploration and exploitation, offering a comprehensive to...
#MQL5 #MT5 #Algorithm #Optimization

Read more...
πŸ‘21❀9πŸŽ‰2πŸ‘Œ1πŸ‘¨β€πŸ’»1
In the eighth installment of the series, we focus on implementing the Observer pattern in the Connexus library. This pattern is crucial for managing multiple requests efficiently, enhancing client code reactivity. The Observer allows objects to be notified about changes in the Subject without being tightly coupled. This decouples components, promoting independent and flexible systems.

Key components include the Subject, maintaining a list of Observers and notifying them on state changes, and Observers, which implement an update method to react to these changes. This pattern ensures real-time updates and streamlined code handling.

Implementation involves creating interfaces, adding observer lists, and notification functions. This makes the library flexible and ready for extensions. Additionally, adjustments in folder structure and method naming w...
#MQL5 #MT5 #Observer #DesignPatterns

Read more...
πŸ‘14❀12πŸ‘¨β€πŸ’»4πŸ‘Œ2🀝1
The Profitunity System, developed by Bill Williams, leverages a set of specialized indicators for trading in chaotic market conditions. Key indicators such as Fractals, Alligator, Awesome Oscillator (AO), and Accelerator Oscillator (AC) are utilized. Each indicator contributes unique insights: Fractals identify potential trend reversals, Alligator assesses market trends, AO measures momentum, and AC detects trend accelerations.

Implementing this system in MetaQuotes Language 5 (MQL5) involves coding these indicators and automating entry and exit signals. Once coded, testing and optimizing ensure robust performance across different market conditions. Appropriate exit strategies, such as tracking Alligator and oscillator reversals, are crucial. Automating this strategy provides scalable trading solutions adaptable to dynamic market environments.
#MQL5 #MT5 #Strategy #AlgoTrading

Read more...
πŸ‘21❀12πŸ†4πŸ‘Œ3πŸ‘¨β€πŸ’»2
In the previous installment, an in-depth examination of the ATFNet algorithm was conducted, showcasing its combination of time and frequency domain forecasting models. The ATFNet architecture employs the Transformer’s multi-layer Encoder with multi-headed Self-Attention, particularly in its frequency F-Block, utilizing complex number mathematics. This piece delves into the implementation of the ATFNet class by crafting the CNeuronATFNetOCL class, which encapsulates the entire algorithm. This approach, though not optimal within a single class structure, aligns with previous sequential models that lack support for multi-process operations inherent to T-Block and F-Block.

The internal structure, declared statically, simplifies by separating objects into time and frequency blocks, ensuring clarity and organizational efficiency. It begins with internal o...
#MQL5 #MT5 #Algorithm #TimeSeries

Read more...
πŸ‘25❀19πŸ‘Œ13✍2⚑2πŸ†2😁1
Online learning is a crucial machine learning method for real-time applications, particularly where data streams are rapidly evolving. It allows models to adaptively learn from incoming data, essential for sectors such as trading, where timely and precise predictions are necessary. Implementing online learning in platforms like MetaTrader 5 requires a distinct approach, integrating Python with MQL5 to handle model training and deployment efficiently.

By automating processes using libraries like CatBoost and GRU, models can be updated continuously in response to new data. This setup ensures that models remain relevant, leveraging an infrastructure tailored for dynamic environments. However, moderation is key, as frequently updating models can introduce sensitivity to data sequences, necessitating periodic human review.

Models built incrementally can be...
#MQL5 #MT5 #OnlineLearning #ML

Read more...
πŸ‘22❀16πŸ‘¨β€πŸ’»2πŸ‘Œ1πŸ‘€1
Mutual information is a potent tool for feature selection, offering unique insights into dependencies in complex, nonlinear datasets. The technique excels by identifying predictors that traditional methods might overlook. This article introduces the application of mutual information in identifying effective predictors, emphasizing the algorithm proposed by Peng, Long, and Ding. The focus is on the accurate estimation of mutual information for continuous variables through adaptive partitioning and the Parzen window method, demonstrating how these techniques overcome the pitfalls of fixed binning. With practical code examples in MQL5, traders and developers can implement these methods for enhanced model performance, balancing relevance with redundancy in predictor selection.
#MQL5 #MT5 #Algorithm #FeatureSelection

Read more...
❀10πŸŽ‰6πŸ‘5πŸ‘Œ3πŸ‘¨β€πŸ’»1
MetaTrader 5 beta build 4695 introduces new features in the MQL5 language, including support for additional OpenBLAS library functions, as well as the new TransposeConjugate and CompareEqual functions. These enhancements provide even greater flexibility for matrix and vector operations.

We've also resolved compatibility issues with the MQL5 integration package for Python. The package is now fully compatible with all Python versions up to 3.13.

Additionally, we've optimized and accelerated platform operations involving price data, improved the account opening dialog, and corrected the display of position values.

Read more...
πŸ‘59❀18πŸ‘Œ6⚑5πŸ”₯3πŸ‘¨β€πŸ’»2✍1