Part Four of the MQL5 series is live. This installment will cover three fundamental aspects critical to any developer: Structures, Classes, and Time functions.
Structures in MQL5 serve as user-defined data types that can store information related to one or multiple related entities. They can enhance code clarity and reusability in trading scripts and expert advisors.
Classes, on the other hand, exist as blueprints for creating objects. Objects are specific instances or realizations of a class, each possessing unique properties and capabilities as dictated by its parent class.
Lastly, Time functions are essential tools enabling developers and algorithmic traders to work with time-related data. They're used to retrieve current server time, convert time values, and much more.
Remember, questions are encouraged and increase collective understanding. The goal is to make MQL5 accessib...
Read more...
Structures in MQL5 serve as user-defined data types that can store information related to one or multiple related entities. They can enhance code clarity and reusability in trading scripts and expert advisors.
Classes, on the other hand, exist as blueprints for creating objects. Objects are specific instances or realizations of a class, each possessing unique properties and capabilities as dictated by its parent class.
Lastly, Time functions are essential tools enabling developers and algorithmic traders to work with time-related data. They're used to retrieve current server time, convert time values, and much more.
Remember, questions are encouraged and increase collective understanding. The goal is to make MQL5 accessib...
Read more...
π4β2π1
Presenting the Stochastic Diffusion Search algorithm, an intriguing component of Swarm Intelligence metaheuristic, resting on a solid mathematical foundation. Originating from 1989, it was designed for discrete optimization. Its potential for global continuous optimization surfaced in 2011.
This fascinating algorithm relies on direct communication between agents, similar to communication mechanisms observed in nature among Leptothorax acervorum ants. It facilitates strong hypothesis evaluation and efficient dissemination of promising solutions, significantly reducing computational complexity.
A noteworthy aspect of SDS is its potential applications in the Restaurant Game or Gold Mining Game. These scenarios stimulate optimization problem-solving through agent information exchange and hypothesis evaluation. Nevertheless, SDS might struggle with problems that don't align with the conc...
Read more...
This fascinating algorithm relies on direct communication between agents, similar to communication mechanisms observed in nature among Leptothorax acervorum ants. It facilitates strong hypothesis evaluation and efficient dissemination of promising solutions, significantly reducing computational complexity.
A noteworthy aspect of SDS is its potential applications in the Restaurant Game or Gold Mining Game. These scenarios stimulate optimization problem-solving through agent information exchange and hypothesis evaluation. Nevertheless, SDS might struggle with problems that don't align with the conc...
Read more...
π4π₯1
In the latest algorithm examination, analysts set their focus on the behavior of candlesticks patterned after a frog's hop. This approach denotes that a frog does not merely leap a single 'leaf' block in a 'pond' but covers a range from leaf 1 to leaf 3 or beyond.
This particular indicator serves to obscure standalone candlesticks that don't fit into the specified 'frog hop' pattern in the experiment. Consequently, if a candle is a bull and the subsequent candle is a bear, with its preceding candle also bearing the same characteristic, it is marked as an 'alone' candlestick and concealed on the chart. The same can be said for a bear candle.
The results of this experiment can be viewed easily; With the hidden 'Alone Candlestick' on the left and the Standard Chart on the right. This offers an intriguing insight into the behavioristic patterns of candlesticks in the world of algorithms.
Read more...
This particular indicator serves to obscure standalone candlesticks that don't fit into the specified 'frog hop' pattern in the experiment. Consequently, if a candle is a bull and the subsequent candle is a bear, with its preceding candle also bearing the same characteristic, it is marked as an 'alone' candlestick and concealed on the chart. The same can be said for a bear candle.
The results of this experiment can be viewed easily; With the hidden 'Alone Candlestick' on the left and the Standard Chart on the right. This offers an intriguing insight into the behavioristic patterns of candlesticks in the world of algorithms.
Read more...
β6β€4π2
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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