MQL5 Algo Trading
391K subscribers
2.58K photos
2.58K 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
Automated trading systems are becoming essential for financial markets. These systems analyze the market and execute trades using predefined rules and algorithms. Yet setting up and running robots on multiple charts can be time-consuming. In response, a universal robot template for MetaTrader 4 and 5 can be established, simplifying the setup process and saving time for traders.

This solution was inspired by the desire for user comfort and the need for multicurrency characteristics testing. While this template does not offer a perfect solution, it is highly beneficial in testing multiple strategies and maintaining system efficiency.

There are some notable differences between MetaTrader 4 and MetaTrader 5 terminals that impact the use of this template. The latest MetaTrader 5 has a powerful tester that provides features enabling tests on multiple instruments simultaneously but MetaT...

Read more...
πŸ‘5
In the realm of trading, speed and efficiency are key factors that greatly contribute to success. An innovative script file has been designed to provide traders the advantage of placing a multitude of buy orders with just a single command.

Aimed to serve those who manage high-volume trades, precision is still guaranteed with predefined default take profit and stop loss values. Set in a 5-digit broker format, the default can be adjusted to TP=40 and SL=20 for traders who engage with a 4-digit broker.

The command parameter, Num_of_Buy, determines the total number of trades that will be opened immediately by the trader. The script file's innovation lies in its expediency, enabling traders to capitalize on market conditions swiftly and productively.

The fact that it considerably reduces the complexity of placing multiple buy orders, moreover, translates to considerable time savings -...

Read more...
πŸ‘7❀2
In the complex world of forex and crypto trading, fundamental insights could be unlocked using robust time-series techniques. Box and Jenkins' esteemed method of time series prediction proves to be a powerful tool despite latest advancements. The derived Autoregressive Integrated Moving Average (ARIMA) model, mastering temporal dependencies in data series, allows for efficient forecasts in the realm of non-stationary time series. By leveraging Powell's method of function minimization, this article crafts an ARIMA training algorithm using mql5 programming language.

A comprehensive overview of ARIMA model, along with its derivatives such as AR, MA, and ARMA, is provided for a better understanding of the forecasting strategies. A comprehensive methodology to calculate model coefficients and constant offset is also discussed.

The ARIMA training algorithm, encased in the CArima class, ...

Read more...
❀4πŸ‘4πŸ†1πŸ‘€1
A sharp look at an Expert Advisor (EA) for trading provides significant insight into its functioning. This specifically discusses an EA that only represents buy positions, refraining from the deployment of Stop Loss (SL) and Take Profit (TP) functionalities.

The focal setting parameters can be divided into two major sections for clarity. The first section comprises general settings, including instructions for starting trade, ending trade, and procedures for when an order is closed.

Risk management is given equal prominence with its own settings. The parameters include settings for the lot size, constraints on the number of open positions for each trading symbol, and a daily limit on the number of deals for every symbol.

The EA's efficacy was assessed using standard settings on a $10,000 account, equipped with a leverage of 100. Notably, the trading symbol being used in this scen...

Read more...
πŸ‘4
Investing time and effort in the development of a market simulation system is crucial for effective backtesting and trading practice. The introduction of Bid-based plotting systems has elicited new improvements needed, especially related to code duplication and tick volume errors.

Understanding and rectifying these issues can significantly enhance the simulator's functionality. Remember, a code that works effectively in particular situations but not in all does not meet the standard, necessitating meticulous debugging and amendments.

Moreover, by looking at the system flowchart, which is a great tool for accelerating coding, one can detect redundancy. Changes are undertaken to modify the tick reading code, avoiding code duplication and the resultant issues it may cause.

Another essential improvement aims at finding a solution for tick volume malfunctioning. Achieving this requir...

Read more...
❀5πŸ‘2
Financial markets, characterized by their multifaceted nature, are influenced by a multitude of factors that may include news, geopolitical events, technical elements, among others. While monitoring such markets, only a fraction of these influences is usually noticed. Adept recognition of main trends through dedicated tools becomes crucial, while other factors can be glossed over as stochastic noise. Reinforcement learning emerges as an indomitable tool for creating strategies in such complex environments. However, there are shortcomings with existing approaches like the Decision Transformer, which may struggle to adapt in variable stochastic atmospheres.

To address this, the Google team introduced the Dichotomy of Control (DoC) approach in October 2022. It is based on stoic principle of segregating elements under our control from those which are not. This algorithm thus comprehends...

Read more...
❀1πŸ‘1
Notwithstanding the broad disparity in trading models for the forex and stock markets, creating a replay/simulation program involves addressing several common complexities. In such programs, the use of price representation concepts is crucial. They often use Bid or Last as the underlying values. However, the issue arises in systems that use Bid as the base – whilst these work smoothly for the stock market, they fail to deliver consistent results in forex or any market following similar price representation principles. Fixing these issues requires a granular understanding of trading models and adjusting the program to handle different markets seamlessly.

Taking a closer look at the price representation in the stock market and forex, we find that the underlying values fluctuate between Bid and Last based on the particulars of the market. This difference necessitates the development of...

Read more...
❀2
Become familiar with a class that empowers developers to craft buttons on charts, behaving similarly to chart objects with time and price coordinates. These objects can be freely adjusted on the chart, maintaining their position even when scrolling.

For those keen to further their understanding of Object-Oriented Programming, chartevents management, or designing graphical interfaces, this resource proves invaluable. It cleverly responds to chart modifications and mouse maneuvers. When the mouse interacts under certain conditions, the Button is selected and becomes manipulable.

Watch as the dragging process is tracked through a custom chart event known as EVENT_DRAG. The button's onChartEvent function is consistently invoked in the built-in OnChartEvent function, relaying pertinent information to the various handler functions.

A tutorial video has been prepared, providing insights ...

Read more...
❀2πŸ‘2πŸ‘1
In the latest installment of our ongoing discussion on market simulation, the focus shifts to resolving issues related to extremely low transaction volumes. The primary concern was when such sparse data threatened the system's stability, especially during Last plotting type-based simulations.

The proposed solution, informed by previous principles used in Bid plotting-based simulations, features making integral changes to the class structure, enabling a more efficient aggregation of common values. This strategy facilitates the modification of code to remove existing limitations on Last price simulations and opens up a specific entry point for this simulation type.

The structural changes ensure that both simulation modes based on Bid and Last could benefit from improvements made to time management. Furthermore, the adjustments streamline the class code to allow for both simulations t...

Read more...
πŸ‘3
In the dynamic and highly unpredictable world of Forex trading, the influence of seasonal trends can often go unnoticed. Yet a deep analysis reveals clear patterns tied to long-term economic cycles, agricultural seasons and holiday periods, which can play a pivotal role in shaping trading strategies. This overlooked tool offers an opportunity for traders who are willing to move beyond the standard parameters of fundamental and technical analysis.

Seasonality represents a specific principle - a predictable formation of a market model depending on the time of year, repeating at regular intervals. Think about the regular increase in demand for heating oil during winter months, driving the price uptick, or the fluctuating supply and demand of soybeans attributed to agricultural cycles. Traders who can identify and understand these trends, real-time or across different years, will gain a...

Read more...
πŸ‘1
Confronted with the quest of understanding Object Oriented Programming or the workings of chartevents? Or perhaps, curious to innovate with graphical interfaces? A learning resource has been put together that focuses on a class designed to create buttons on a chart. These buttons, akin to chart objects, hold time and price coordinates.

Unique to this class is that the buttons can be dragged on the chart, and maintain their position through scrolling. The incorporated main Idea enables the class to react to chart changes and monitor mouse movements, allowing for interactivity.

Once the mouse matches the pre-set conditions, a button gets selected and becomes draggable, monitored via the custom chart event: EVENT_DRAG. An integral part of this setup is the button's onChartEvent function. This function, always activated in the built-in OnChartEvent mechanism, disseminates the necessar...

Read more...
πŸ‘7❀2πŸ‘1
Diving into time series analysis: It plays a pivotal role not only in assisting fundamental analysis but also in liquid markets such as forex, often driving investment decisions. Speaking of traditional technical indicators, they exhibit a significant lag, causing traders to shift their favour towards alternatives, one prominent example being neural networks. Yet, it's essential to bring polynomial interpolation into the discussion.

Polynomial interpolation is advantageous, primarily due to its ease of understanding and implementation. It lays out the relationship between past observations and future predictions through a simple equation, thereby highlighting the impact of past data on upcoming values and guiding the formulation of broad concepts or potential theories on the behavior of the studied time series.

Moreover, its adaptability to both linear and quadratic relations makes ...

Read more...
❀5πŸ‘1πŸ‘1
Market simulation and replay systems can prove to be a challenging endeavor when trying to integrate Bid price-based charting and Last price-based charting. After going back and forth with numerous prototypes, an efficient solution has now been established, which successfully simulates price movement based on a 1-minute chart time.

However, it's still in the developing stages. At present, the function to "go back in time" needs to be discarded as it runs the risk of obstructing upcoming features. Although the idea is fascinating, it's not functional in practice as it initiates issues that need to be addressed.

One of these issues is locking at a determined "stop" point in the system's time control, for which the simulation service adjusts the minimum limit as it progresses. To prevent users from exceeding this limit, a clear notification method was implemented, making a large leap...

Read more...
πŸ‘1πŸ‘1
Introducing the Adaptive Volatility Analysis (AVA) Indicator: a powerful tool measuring market price movements with a precision that eclipses the capabilities of standard indicators. Unlike traditionally static views, the AVA continuously modifies its analysis to reflect current market dynamics. The tool's innate adaptability provides a distinct advantage in predicting sudden shifts in volatility.

The AVA's foundations rest on the Average True Range (ATR), typically examining the last 14 trades to quantify market movement. The incorporation of two Exponential Moving Averages (EMAs), applied to the ATR values, assists in the identification of price movement trends. The indicator defaults to a short-term EMA of 2 and a long-term EMA of 5, while longer periods (e.g., 10 and 50) are options for extended term analysis.

The AVA's distinctive characteristic is the Factor of Adaptive Volati...

Read more...
πŸ‘4πŸ‘Ύ2❀1πŸ‘1
For those seeking precision in calculating drawdown, an algorithm is available that leverages magic number and symbol for increased accuracy. This method takes into account the specific parameters of each trade, providing a deeper insight into potential profitability.

However, it’s important to understand that this approach tailors the drawdown calculation towards specific trading conditions, potentially narrowing the analysis context. If the requirement is to account for overall account drawdown without discrimination, the code needs to be amended. This can be achieved by removing the filters corresponding to magic number and symbol.

This flexibility in the code not only enables a more granular calculation but also opens up the opportunity to view the broader trading landscape contributing to an understanding of overall risk and maximizing return potential. Remember to modify resp...

Read more...
πŸ‘5✍2πŸ‘2❀1
Highlighting the robust possibilities of Object-Oriented Programming (OOP), insightful details and guidelines on the development of an Expert Advisor for live market simulations have been underscored. The efficient creation of viable Expert Advisors demands a keen understanding of project structure and market specificities for maximum effectiveness.

Primarily the creation of a robust, secure, and reliable code from the start is underscored, emphasizing on the indispensable role of mouse and keyboard interfaces in chart-centric applications such as MetaTrader 5.

Furthermore, the profound value of developing an Expert Advisor applicable to diverse assets without breaching server rules has been accentuated. These EAs need to simulate the experience of a trading server connection, maintaining identical rules and standards across real and simulated markets.

Technical nuances, like the ...

Read more...
❀2πŸ‘2πŸ‘2
Linear Discriminant Analysis (LDA), a supervised machine learning algorithm, finds a linear combination of features that best separate dataset classes. Similar to Principal Component Analysis (PCA), LDA targets dimensionality reduction, although in diverse circumstances each carries out effectively. The key objectives of LDA notably include maximizing class separability, minimizing within-class variability, enhancing between-class variability, effectually dealing with multiclass classification, and reducing dimensionality while preserving significant class-discriminatory information.

LDA, however, carries certain assumptions - data are independent, normally distributed within features, and classes retain the same co-variance matrix. If such assumptions are in any form violated, LDA's performance could be impacted. Its sensitivity to outliers is noted when covariance matrices are est...

Read more...
πŸ‘2πŸ‘1πŸ”₯1
Understanding the basis of a given code and its interpretations are crucial in its successful application. For those submitting Expert Advisors, ensure to name the most appropriate symbol and timeframe to optimize its usage. If submitting include files, specify their purpose such as -- for trailing procedures or calculating the size of a position to be opened.

All images attached should adhere to a standard size, preferably not exceeding 750x500 pixels. For illustrations featuring indicators or graphical objects in chart forms, consider a black and white color scheme for easy printability.

The naming convention of attached codes must be considered. Aim to use Latin letters, preferably English, for effective communication and understanding. For instance, opt for 'research.mq5' as opposed to language-specific terms like 'issledovanie.mq5', 'erforschung.mq5', 'estudio.mq5', 'ricerca.mq...

Read more...
πŸ‘5πŸ‘2
Following the detailed construction of the first class, now turns attention towards creating the C_Mouse class – a program designed to expand these high-level programming ideas and make them more useful. The aim is to keep the class code as simple to understand for other developers as possible, ensuring minimal use of complex modeling that can confuse less experienced programmers.

The C_Mouse class interacts with the user through the common mouse and keyboard inputs, aiming to keep the user-platform interaction as simple and effective as possible. A resource file is incorporated within the executable for ease of portability without separate downloads.

Simplicity in coding and their maintenance is realized through the use of definitions, where they are initially defined and later removed, avoiding unnecessary repeated declarations.

Inheritance plays a pivotal role in allowing the C_...

Read more...
Huge strides have been made in creating a structured analysis of the key aspects in forex trading - Historical Levels. Being the most recurring prices over the lifetime of a trading symbol, they directly reflect the economic conditions of a financial environment and often act as pivotal boundaries impacting price/rate movements.

Scientific analyses have documented the strong correlation of these Historical Levels to financial phases, creating a compelling case for their incorporation into a trader's market analyses toolkit. The observation that price behavior around these levels significantly influences candle shape has been exploited to predict potential price jumps.

In light of this insight, two rules have been derived, both revolving around the 'Jump Factor'. A bullish candle at the support level qualifies if 'close-low' increments beyond the jump figure. Similarly, at the resi...

Read more...
πŸ‘10πŸ‘Œ2πŸ†2πŸ‘1
Gain insightful understanding of Fourier transform, a method invaluable in decomposing a wave into its possible component parts. A tool that initially was the brainchild of Joseph Fourier, its uses have been extended to an array of applications beneficial to traders.

By integrating over an array of frequencies, the Fourier transform delivers a spectrum of components, each corresponding to a distinct frequency. The frequencies, in practice, are efficiently predetermined to a manageable number, rendering the transform formula manageable.

The modern Fourier application encapsulates n components, each with varying wave values at distinct times. The aim is to establish the components' f(t), constituting both real and imaginary parts. With this setup, it redefines any function f(t) within the interval 0 to 2 pi with complex numbers as an β€˜infinite sum’.

In practical terms, Fourier Tra...

Read more...
πŸ‘6πŸ‘2