MQL5 Algo Trading
392K 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
A solid grasp of the MQL5 program structure is an essential foundation for software development. This briefing highlights the critical components and the sequence that should be maintained to design software effectively.

The MQL5 program begins with the Preprocessor, which prepares the program for the compilation process. It includes Macro substitution( Program Properties( Including Files( Importing Functions( and Conditional Compilation (

Following Preprocessor, the next line of defense in the MQL5 program structure are Input and Global Variables. They play a significant role in dictating the accessibility and scope of information across the entire software.

Next comes Functions and Classes, the functional components of the MQL5 program designed at the same level of event handlers. These aid in defining inputs and specifying program behavior given a series of commands.

Eve...

Read more...
๐Ÿ‘7๐Ÿ‘1
Indicators play an indispensable role in MetaTrader 4 (MT4). Under scrutiny, we have one such indicator capable of plotting historical trade levels. This function permits the selection of a preferred history period to visualize past trades.

On potential variations, there might be an addition featuring a trend line encapsulating price movements. Although this prospect is premised on user demand, its implementation could make the chart seem cluttered. Maintaining chart clarity is of paramount importance, hence why this feature is currently not incorporated.

This embodiment of a straight-forward approach design should be a valuable tool for traders, especially those harnessing MT4. Viewing past trade levels can provide a wealth of information, assisting in building a robust trading strategy and enhancing the overall trading experience.

Remember, simplicity in a system is not detrime...

Read more...
๐Ÿ‘8๐Ÿ”ฅ2
Understanding how to leverage the power of multi-currency Expert Advisors (EAs) can be a game-changer for every trader. They can make trades across over 30 pairs based on one symbol chart, using robust indicators like Bollinger Bandsยฎ On Keltner Channel in this instance. The unique ability of these EAs to carry out multi-currency trades is well-documented, making them reliable options for traders.

Capitalizing on the robust capabilities of MQL5, it's possible to develop a highly effective multi-currency EA that relies on two indicator signals for open orders. It uses the Bollinger Bandsยฎ on the Keltner Channel, with the latter providing the price data. Despite the absence of iBandOnArray() in MQL5, the indicator handle function ensures an ease of operations better than in MetaTrader 4.

Trade options available include using the Parabolic SAR (iSAR) indicator for trailing stops, trad...

Read more...
๐Ÿ‘5โค2๐Ÿ‘1
The "wd.Multi_LineMA.mq5" MT5 custom indicator provides traders with an in-depth understanding of Moving Average values from a higher timeframe (MTF Multi TimeFrame). It contains features that let users view trails over specific bar lengths and a dynamic MA horizontal price line. This indicator processes a Moving Average based on parameters like period, method, and applied price, and can display Moving Average values from a higher timeframe on the current chart. Conversely, it can either present a restricted lowerTF plot or hide lowerTF values if the current timeframe is higher than pre-set. The Moving Average trail feature enables users to regulate the trail length for a set number of bars. The indicator also includes a Horizontal Price Line that relocates based on the last Moving Average value. Real-time values calculate the MTF Multi-Timeframe Moving Average, and the indicator dupl...

Read more...
โค9๐Ÿ‘4๐Ÿ’ฏ2๐Ÿ‘1๐Ÿ‘Œ1
Unlocking the potential of Decision Trees in programming. Comprehending the problem at hand through a flowchart-like structure, each Node encoding attribute features, branches determining the test outcome, and leaf Nodes predicting results. Distinguish types of Nodes, from internal Nodes, which make decisions based on features, to leaf nodes, which complete the decision-making process.

Build a comprehensive understanding of Nodes, which feature crucial information like test conditions, thresholds, and child Nodes. Utilize decision trees such as CART and ID3, which utilize Gini impurity, mean squared error, and entropy to make informed decisions.

The decision tree algorithm is formed through splitting subsets based on features until conditions are met, nesting the build_tree function inside the fit function for more user-friendly operations. Real-time predictions are made after care...

Read more...
โค4๐Ÿ‘2๐Ÿ”ฅ2
Recognizing there are no reports of memory leaks in MQL5 applications such as expert advisors, scripts or indicators, this post draws attention to the possibility of these occurrences through the misuse of the 'new' operator. These leaks can occur with complex programs possessing many classes and data collections, often overlooked due to the intricate nature of the program. Highlighting the importance of early detection and fix of such problems, the strategy tester is proposed as a tool that could be utilized for both developing a coherent trading logic and detecting software-related issues.

A proposed solution comes in the form of an include file, the "checker_for_memory_leaks". This file was contributed by Dominik Egert: https://www.mql5.com/en/forum/438987. The header file is capable of monitoring any upcoming memory leaks during application testing in the strategy tester for Exp...

Read more...
โšก4โค2๐Ÿ‘1๐Ÿ‘Œ1
Promoting versatility in system applications, this article outlines the process of adapting the replay system implemented initially for the stock market, to Forex and other related markets. It underscores unique challenges forex markets pose in testing and training that the stock market doesn't, and how the MetaTrader 5 platform is capable of tackling such hindrances.

It further explains the peculiarities of trade performance in the forex market and the role of central banks in dictating the market dynamics. By using a floating point numbering system, it tries to build a system flexible enough to handle a wide range of conditions, independent of the market type.

The functionality is further improved by enabling the system to validate data during the replay startup and displaying integral information related to calculation and display modes to the user. However, it warns against re...

Read more...
โค2๐Ÿ‘2๐Ÿ‘1
Surveying the landscape of accessible multi time-frame indicators? This indicator provides a structure based on recursion that is friendly for those new to programming. The role of the indicator calculation is easily interchangeable, offering versatility to developers while maintaining a straightforward functionality. Moreover, this same piece of technology has a functional role that enables the downloading of multi time-frame data. With appropriate alterations, developers can potentially create varied symbol implementations. This update note also includes a further structural re-arrangement: the block previously located below has moved just under the initialization of the counted_bars variable. The change reflects an efficiency-focused optimization by setting counted_bars to equal firstBarToDraw when counted_bars is less than firstBarToDraw. As a whole, a more efficient, flexible too...

Read more...
๐Ÿ‘3๐Ÿ‘Œ1
Existing financial market predictive models continue to pursue relevancy and precision. This pursuit directs us towards frequency domain digital filters as tools for feature extraction. The Discrete Fourier Transform (DFT) allows time series analysis in the frequency domain and provides considerable benefits for large data sets, especially when leveraging the Fast Fourier Transform (FFT) algorithm.

Upon employing in-phase, in-quadrature, and quadrature mirror filters, we attempt to dissect their application in time series analysis. In-phase filters, such as bandpass filters, deliver preservation of input-output phase relationships. However, using in-phase filters like lowpass following a bandpass filter could potentially uncover valuable process tendencies.

In contrast, in-quadrature filters (or quadrature filters) provide unique value by introducing a 90-degree phase shift. This ...

Read more...
๐Ÿ‘5โค2โšก1๐Ÿ‘1
For traders and developers who understand the algorithmic nuances of chart patterns in relation to relative strength indicators (RSIs), examining engulfing bar levels can be a fascinating avenue. With this in mind, it becomes crucial to set effective alerts when these bars dip below or rise above established RSI levels. This way, potential trading opportunities can be identified and acted upon swiftly.

An underemphasized aspect of digital trading is vigilant monitoring, and this approach brings it into focus. Automated alerts can significantly reduce the time spent on manual oversight, enabling quicker reactions to market trends. Furthermore, employing a methodical alert system centered around engulfing bars and RSIs could increase efficiency, especially for high-frequency traders.

Algorithmic trading systems now provide the option to set such alerts โ€“ enabling a seamless integratio...

Read more...
๐Ÿ‘10โค2๐Ÿ‘Œ1
Today's discussion looks at the profound yet less explored concept of metabars. A metabar, in essence, is a conditional fusion of consecutive bars into one larger unit. Despite its similarity to higher timeframe bars, the core difference lies in the floating size of a metabar and its lack of attachment to a specific start and end time. This unique composition allows traders to spot various candlestick analysis patterns more frequently.

Leveraging this, the previous article established the blueprint for creating a Doji candlestick indicator on metabars and demonstrated its practical application. This following segment will attempt to build a trading strategy using such indicator aiming at possibly increasing the profit-making opportunities as more deals can be anticipated with the employment of metabars.

However, simply opening and closing trades based on the indicator results cannot...

Read more...
๐Ÿ‘2โค1
Unveiling MT5 port, a custom-designed indicator, primarily engineered for personal use. A distinguished feature is the capability to customize a checklist, invaluable in methodically verifying rules prior to initiating a trade. It is pivotal to comprehend, however, that this is not an automated function. Manual input is needed to construct the checks and appropriately brand them in alignment with the selected strategy.

A useful feature is the TAG setting, which authorizes the operation of numerous instances of this indicator on a single chart. It's a crucial requirement that all instances should possess unique TAG values. Additionally, the 'Window Position' attribute enables defining the location for default window opening.

To round it off, the allowance for defining personal checklist rules is flexible with 'Check01...Check20' settings. An innovative tool, giving room for more stra...

Read more...
โค5๐Ÿ‘1
A new Expert Advisor has been developed with a unique function. Focused on manual trade training, this tool employs the Martingale method, which can conveniently be switched on or off as per user requirements. However, it's crucial to note that this functionality is exclusively active under the Strategy Tester Mode. This tool is particularly beneficial for developers, presenting functionality while providing the flexibility to modify its application as per individual needs. As with any algorithmic solution, users are encouraged to rigorously test before broader application.

Read more...
โค2๐Ÿ‘1
Presenting a newly developed Expert Advisor (EA) designed specifically for Manual Trade Training applications. It harnesses the mathematical probability concept of Martingale that can be selectively activated or deactivated based on the user's preferences. Crucially, its functionality is exclusive to Strategy Tester Mode โ€” a unique adaptation tailored to cater to specific testing and experiment requirements of evolving IT landscape. Using this state-of-the-art software, trial-and-error processes can be drastically reduced, providing broadened perspectives and precision in outcomes. It is a reflection of maintaining the balance between old and new - keeping the traditional concept of Martingale intact while integrating it into modern technology. It's an innovative solution that contributes to the ongoing pursuit of making Manual Trade Training more efficient and streamlined. Experience...

Read more...
๐Ÿ‘7โค1
An in-depth look at the utilization of category theory in volatility forecasting, specifically when dealing with the S&P 500. Learn how graphs, derived from economic calendar data such as MQL5, are construed as categories and analyzed as domain against the S&P 500 volatility readings which act as codomain. This thorough exploration provides insight into how technicalities like Functor Morphisms between categories don't simply link objects, but also correlate the homomorphisms, thus profiling an edge in volatility forecasting for traders.

Moreover, the piece highlights how category theory allows for transfer learning where optimal coefficients obtained from compute-intensive calculations can be applied across different currencies and equity indices thereby enhancing performance. Lastly, delay advantage in functor relationships is covered, showing how it can be exploitatively ...

Read more...
๐Ÿ‘3โค1๐Ÿ”ฅ1
Introducing an enhanced feature for chart plotting: the ability to draw custom grids using the Rectangle shape. Now, users can select a range within this polygon to fit their preference.

This added functionality allows either the utilization of a rectangle range or custom points, offering greater flexibility. True to its form, the parameters consist of a simple boolean system: set the mode to 'true' to utilize the rectangle range, switch it to 'false' to stick with custom points.

This feature offers precise control over grid creation, paving the way for a more flexible and customizable chart plotting experience. Enhance charts, streamline data visualization, and make every plot worthwhile with this updated feature. Simplicity and control, combined to bring you the best in grid plotting.

Read more...
โค3๐Ÿ‘2๐Ÿ‘1
Utilizing a Heikin Ashi chart typically improves the cleanliness and clarity of trends, providing a less noisy representation of data. However, a significant imperfection remains - obscuration of true bar/candle values, most notably, the exact closing prices.

The Heikin Ashi 'Closing Price' is essentially the application of a 'Total Price', while its 'Open Price' operates as a moving average of its closing prices. To counter this, consider representing data as dual lines instead, aiding in maintaining visibility of true bar/candle values. The implementation of this indicator will feature a dotted line for 'opening values' and a solid line to depict 'closing values'.

Be aware that the default line colour applied is gray, which some may find a tad uninspiring. It's recommended to choose a colour that correlates positively with the individual's preference and the appearance of their ...

Read more...
๐Ÿ‘5๐Ÿ†5โค1
Addressing an issue experienced by many developers, the use of Heikin Ashi charts, this post presents a solution. Despite their appeal for less noise and clearer trends, a critical flaw inherent in these charts is the obscuring of true bar/candle values, in particular, the closing prices.

The Heikin Ashi closing price is simply an alternate price known as the "total price", and its opening is a moving average of its own closing prices. Therefore, it is suggested to display it as two separate lines. This adjustment is made possible through the use of this particular indicator.

In this modification, the bars/candles' accurate values are still visible. The opening is highlighted by a dotted line whereas the closing is distinguished by a solid line. It is crucial to note, however, that by default Gray/Gey is the chosen line colour, which might appear dull. Users may personalize the co...

Read more...
๐Ÿ‘4
Presenting the book "MQL5 Programming for Traders". This is the most comprehensive guide authored by experienced algorithmic trader Stanislav Korotky with MetaQuotes' support.

The book is intended for programmers of all levels. Beginners can learn the basics, while users with experience in other programming languages can immediately advance to the applied part: creating trading robots and analytical applications in MQL5.

The book is freely available online, under the "Book" section of the www.mql5.com website.

Read more...
โšก4๐Ÿ‘1๐Ÿ”ฅ1๐Ÿ‘Œ1
The usage of Category Theory, originally proposed by Samuel Eilenberg and Saunders Mac Lane, is very prominent in today's technologically advanced landscapes. Driven by transformational approach, the theory applies not only to areas like linguistic structure research or algebraic topology, but also intriguingly to coding through functional programming languages such as Haskell.

It's time to extend the horizon further and investigate the relationships different categories can share among themselves. Introducing - Functors, which formalize these inter-category relationships.

Let's apply this to a trader's data set. Envisage linking ocean-tide data from Californiaโ€™s coast and the volatility of the NASDAQ Index. By mapping ocean tide data to NASDAQ volatility using functors, can ocean tides be an indicator for this index's volatility? Can seemingly unrelated data sets produce valuable ...

Read more...
๐Ÿ‘3๐Ÿ‘Œ1