MQL5 Algo Trading
393K subscribers
2.59K photos
2.59K 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
Experiencing difficulties using the iMomentum() function to get a valid Momentum in coding processes? Assistance is at hand with an easy-to-comprehend code, inclusive of basic principles, minimal functional elements and sound learning practices. This can be used as a foundation, alterable according to specific needs.

Increased understanding can be attained by establishing direct contact, for a detailed explanation of this code at https://www.mql5.com/fr/users/william210. One can also provide input on fresh ideas for development on the post at https://www.mql5.com/en/forum/453288.

There are additional free indicator codes available to aid in initial steps of Mql5 development — Bands Bollinger for beginners by William210 at https://www.mql5.com/en/code/46194, Ichimoku for beginners by William210 at https://www.mql5.com/en/code/46250, MACDr for beginners by William210 at https://www....

Read more...
👍6
In a recent shift from the Soft Actor-Critic algorithm, we now spotlight the Behavior-Guided Actor-Critic (BAC) technique since its introduction in April 2021. BAC distinguishes itself with an alternative approach allowing for a balance between environmental exploration and model operation, which the Soft Actor-Critic algorithm also aimed to achieve but had its limitations due to imposing restrictions on the trained models.

The unique trade-off of BAC lies in the introduction of an entropy component within the reward function, enabling us to maneuver the balance. However, it is crucial to note that this approach inevitably poses some constraints on the trained models. It demands a conceptual understanding of the probability of incorporating actions, a task somewhat tricky to execute for a continuous action space.

To conquer these challenges, the BAC algorithm swaps the entropy comp...

Read more...
👍4
A comprehensive algorithm, devised for trading strategy, roots its foundation in intricate technical indicators and detailed trend analysis. Illustrating its application is an MQL include file and an Expert Advisor, thus providing a hands-on understanding of the underlying mechanisms.

The crux of the script revolves around three custom classes - each with a distinct role in the schematic configuration. The Trend Class is the cornerstone that marks out the long-term trends, leveraging a spectrum of techniques including moving averages and price changes, to name a few.

At the heart of different types of trading signals resides the Signal Class. It is armed with universally-shared methods and attributes such as trend-related settings, take profit, and stop loss provisions.

Rounding off the trio is the Probability Class. This component meticulously computes statistics and probabilities...

Read more...
👍5🤔3
In developing an automated strategy, refining our selection of indicators through progressive testing remains an essential technique. However, this introduces an optimistic bias due to the inherent noise of financial time series, leading to overfitting. One must gauge the degree of overfitting to mitigate its repercussions. David H. Bailey et al.'s academic paper "The Probability of Backtest Overfitting" introduces a method called Combinatorially Symmetrical Cross Validation (CSCV), aimed at estimating overfitting in strategy optimization.

CSCV is a step-by-step process that begins with the collection of necessary data for chosen performance criteria. It provides flexibility in selecting any performance metric, ranging from simple profit to ratio-based metrics. Ensuring consistent data collection for each test run guarantees a dependable valuation for all test runs.

CSCV then proce...

Read more...
👍41
In today's article, gradual improvements are being introduced to the simulation system to achieve greater data consistency and processing efficiency. The need for a consistent behavior in the system is emphasized; a system that performs differently and unpredictably at various times cannot be utilized efficiently.

Addressing the issues of the existing system, the article explains the challenges in situations of high volatility - inefficient creation and presentation of 1-minute bars and synchronization issues. The solution demands a change in the system construction, which requires careful modeling and understanding.

The article proceeds to detail the process of introducing a new system for constructing 1-minute bars with the market replay service. Modifications are made to the service file and a new variable is added to help identify the time spent or required to create 1-minute b...

Read more...
👍5
Unveiling a highly functional MQL include file and an Expert Advisor, showcasing operative functionality of classes. This combination imparts a trading strategy founded on numerous technical indicators in conjunction with trend analysis.

The script features custom classes delineated to create and manage trading signals emerged from variegated technical circumstances. Taking a closer look, we find:

1. The Trend Class - Tasked with the responsibility of discerning the long-term trend using an assortment of trend-evaluation methodologies, including moving averages, price fluctuation, and composite analysis.

2. Signal Class - Serves as the foundational class for diverse types of trading signals and comes equipped with methods and attributes that are common to all signal types, such as designated take profit, stop loss, and trend-related configurations.

3. Probability Class - Dedicate...

Read more...
5👍4
Multi-Currency trading robots, offering the ability to trade, manage orders, and implement stop loss and profit strategies for more than one symbol pair from only one symbol chart, contribute significantly to efficient and effective trading. Triangular moving average indicator facilities their application, calculated in multi-timeframe or single-timeframe mode. The Multi-Currency Expert Advisor TriangularMA_MTF_MCEA, thereby, caters to traders' essential needs by leveraging the capabilities of MQL5.

Trading for 30 pairs, including EURUSD, GBPUSD, AUDUSD, among others, is possible. For brokers with special pair names with prefixes or suffixes, it offers input properties for pair name prefix and pair name suffix. Handling of prefix and/or suffix pair names is simplified. An option for Trading Session enables correspondence with trading time.

Signal calculation in this expert advisor...

Read more...
👍7
Continuing Design Patterns in Software Development: Presenting Structural Design Patterns. They're essential for understanding how classes form larger structures - a valuable tool for advancing software development skills.

Key subjects in this article encompass various Structural Patterns such as Adapter, Bridge, Composite, Decorator, Facade, Flyweight, and Proxy. Gain insights into their practical applications in the world of software development and their use in the MQL5 programming language for designing solutions within the MetaTrader 5 trading terminal.

Moreover, understand the role of Object Oriented Programming (OOP) in comprehending Design Patterns.

Concluding with Disclaimers: All information provided for educational purposes and is not prepared for trading or advice. Results are not guaranteed. Use this information at a personal risk.

A must-read for professionals aim...

Read more...
👍31👏1
In this technical piece, we focus on developing a quality score which an Expert Advisor can display following a strategy test using a trading model. The article showcases an example of a simple randomly-based system for executing trade operations. As part of the system's rules, attention was paid to various critical factors such as trade volumes, candlestick analysis, and shielded time periods for opening positions.

The article explores the coding details of these aspects, with reusable components being moved into separate files for programmer convenience.

Considering the quality factor, the tutorial explains the usage of the OnTester function and leverages the risk-reward ratio to calculate the average system quality. Two approaches of calculating system quality are discussed, namely, the Sunny Harris model and Van Tharp's System Quality Index (SQN).

The SQN technique is design...

Read more...
🔥4
This morning, the comprehensive official documentation provides examples pertaining to all codes and functions for those who seek guidance. The primary aim is to rewrite existing code in a simpler format, enhancing its re-usability and manageability.

Ideal for beginners launching their coding journey and for seasoned developers seeking basic efficiency, it's intended to aid swift evolution. Personal development within codes benefitted greatly from these adaptations. Encouragement is extended to provide feedback, preferences between the official documentation code or this revised version are appreciated.

An array of codes have been developed, focused towards Mql5 iFunctions. These include beginner-friendly codes such as ADX, Alligator, AMA - Adaptive Moving Average, ATR - Average True Range, Bands Bollinger, Ichimoku, MACDr, Momentum, Moving average, Rsi, and Stochastic.

Whilst co...

Read more...
👍8👌1
Fresh insights reveal a foundational method of data analysis for precise programming simulation. Detailed tying in of the service file representation of ticks and their processing, and alignment to shift this data for use in file format opens up a robust tool for data discovery. Empowered by this technique, developers can utilize analytical tools to get insights from the simulator-generated data, thereby gaining a comprehensive grasp of the significant systems to be implemented.

Mastering this data analysis method will provide an understanding of how to design more complex functions and understanding of macros for random value generation within a specific range.

Insights into a system simulating free random walk to generate a confusing graph are thought-provoking. Furthermore, highlighting the crucial considerations for tick simulations and 1-minute bar values redefines the underst...

Read more...
👍21
From the technical standpoint, the Oscillator Indicator is an exceptional trading tool designed with advanced algorithms, serving as a valuable asset to both professional traders and those starting on the trading journey. It bolsters trading acumen by supplying timely, precise signals that advise the ideal entry and exit points for trades.

The underlying strength of_this Indicator lies in its ability to effectively highlight trend terminations. This feature aids traders in refining their decision-making process, hence enhancing the potential to maximize their profits.

The Oscillator Indicator's compelling performance reiterates its value as a necessary resource in achieving sustained success in financial markets. Make all your trading decisions fact-based and algorithm-backed with the Oscillator Indicator and watch your performance grow exponentially.

Read more...
👍81
Substantial strides have been made in developing a market replay system, simulating a distinctive symbol with dynamic yet stable capabilities, increasing the breadth of potential scenarios that can be tested. The aim is to authentically parallel movements observed in a real market scenario.

However, the simulations created so far struggle to encompass the complete range of possibilities, often missing critical data points. The current model, based on the RANDOM WALK principle, proves to be insufficient due to its inability to completely mirror the span of actions within different market conditions. Merely relying on chance is not a viable solution.

A supervised form of RANDOM WALK, fusing abstract mathematical concepts and code has the potential for achieving accuracy while ensuring all specified points are reached. The upcoming discussion will delve into the simplistic core concep...

Read more...
👍2
The ability to successfully conduct trading operations stems from effective utilization of MqlTradeRequest structure when creating a trading request. Specifics of each operation, trade volume request, and the trading instrument itself are among the elements affected by trade requests. Ensuring these factors are properly accommodated can significantly increase the proficiency of trading operations.

For instance, the interaction between the client terminal and trading server, engaged in order placement, is dictated by trade requests. The specification of actions forms the backbone of these requests, with the resulting operations being handled appropriately.

In addition, while filling in required fields of the structure, one can set a trade order to the server. These entries can range from the proposed volume of a trade deal, price, stop-limit order level, to even comments on an order...

Read more...
👍42
The complex world of technical analysis has an intriguing instrument at its disposal: a system that pinpoints the occurrence of six rising bull candles or falling bear candles. It then earmarks an arrow to signal this event. This tool is invaluable for traders as it can pinpoint potential operational breaks in reversal trading.

Observing the formation of six soldiers enables traders to halt operations temporarily. This pause is critical, allowing traders to circumnavigate the potential pitfalls associated with getting caught in a breakout. Understanding these systems, patterns, and signals can play a pivotal role in maximising profitability over time and minimizing losses.

Read more...
👍2
Expounding on the intricacies of candlestick plotting – the methodology emphasizes the importance of checking if either the upper or lower Wick range of a candlestick is greater than the Body range. This process is essential to accurately project the wingding. In the graphing world, this specialized method can offer vital insights into the trend patterns. Utilizing it effectively may significantly enhance the accuracy and reliability of charting endeavours. A comprehensive understanding of this approach is an effective tool in a programmer's arsenal.

Read more...
👍3
Unveiling the functionalities of the Donchian Channel indicator, a comprehensive tool in market trading. Developed by Richard Donchian, it utilizes the highest high and lowest low from a stipulated number of periods to determine market volatility. Clear demarcation of high and low values exhibits the channel and aids in discerning price stability.

The indicator underscores four key buffers: Upper Donchian Channel (Buffer 0 - Green Line), Middle Donchian Channel (Buffer 1 - Blue Line), Lower Donchian Channel (Buffer 2 - Green Line), and MA Donchian Channel (Buffer 3 - Red Line). Each contributes to the overall authenticity of this dynamic trading instrument.

Breaking down the code, the high and low values from the set 'n' period are extracted initially, followed by an average to generate the Middle Line of the Channel. A moving average of the Middle Donchian Channel is then calculate...

Read more...
👍41
Addressing a technical concern within the realm of developing a replay system, an issue appears regarding the use of current replay systems. They are ill-fitted for the exploration and practice of certain operation systems, an issue largely stemming from a lack of pre-analytical capabilities. The unavailability of these crucial bars leads to an inability in gaining reliable indicator information. Addressing this is the necessity to conduct careful and appropriate calculations considering the largest period needed for each indicator to generate useful data.

Furthermore, modifying the replay system necessitates an understanding of details regarding the chart period to be used in the replay, along with the minimum period required for useful information generation. These considerations determine efficiency when we apply them to create a market simulator. The difference between the replay...

Read more...
👍4
In the realm of trading algorithms, a novel feature has been integrated into a specific indicator. This feature offers an input field dubbed 'multiplication factor'. Users are given the leverage of inputting any value of their preference to identify a custom hammer or inverted hammer.

For instance, when using a multiplication factor of 1.25, the algorithm is designed to search for a hammer wherein the shadow of the hammer is at least 1.25 times of the body. In contrast for the inverted hammer, the factor applies inversely.

The results are denoted by plotting a specified color input into the system, making the custom hammer or inverted hammer easy to distinguish. This update leads to improved efficiency and precision in recognizing trading patterns, providing an upper edge to strategists in their respective trading markets.

Read more...
👍611
Proposing a new approach to handling the problem of large, unwieldy source code in the context of swapping or adding ONNX models. This involves utilizing object-oriented programming to streamline workflows and enhance the outcomes of trading strategies.

Three distinct classification models were trained on MetaQuotes-Demo server data, each with different counting techniques and averaging periods. Through the utilization of the base class, the models shared a uniform interface and were implemented with methods like PredictPrice or PredictClass as per the specific requirements.

Key functions were redefined for each model class to manage the sizes of the input and output tensors. Complementary Expert Advisors were created for the evaluation of every model's performance.

The final test combined the strengths of all models; the hard voting technique offered improved outcomes - profita...

Read more...
👍2