MQL5 Algo Trading
390K 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
Analyzing the principles of Charged System Search (CSS) for problem-solving in mathematical modeling and machine learning. Inspired by Coulomb's law in physics, CSS envisages possible solutions as charged particles that interact based on their charge and distance from each other. Through Newtonian mechanics, it computes each particle's position, aiming to strike a balance between exploration and exploitation of the algorithm.

The optimization power of metaheuristic algorithms plays a pivotal role here. Such algorithms stochastically search for near-optimal solutions to problems until a certain condition is fulfilled or a specific number of iterations is hit. This approach is considered as beneficial as it simplifies exploration of search spaces and decision making, without the need to devise new specialized heuristics.

The CSS algorithm maneuvers charged particles within this spher...

Read more...
Discover the intersection of algorithmic trading and artificial intelligence with the book "Neural networks for algorithmic trading with MQL5". Specifically designed for algorithmic traders, this illustrative resource offers insights into the integration of neural networks into MQL5 trading robots.

The book is comprehensive, spanning seven chapters that neutrally discuss everything from the basics of machine learning to advanced architectural solutions. Readers will have the opportunity to understand various types of neural networks, inclusive of Convolutional and Recurrent models, and explore the practicality of attention mechanisms.

Different methodologies for improving model convergence, such as Batch Normalization and Dropout, are elaborately dissected in this book. Practical guidance on the nuances of training neural networks along with embedding them into trading strategies ...

Read more...
👍31
The rather abstract field of Explainable Artificial Intelligence (XAI), reason out decisions made by machine learning models, poses distinct questions. As datasets burgeon and become intricate, it's challenging for data scientists to delineate algorithm behavior across all data horizons. XAI, in theory, empowers the building of trust in these models by explaining their functionality and validating their readiness for production deployment. Nevertheless, the explanations rendered should not be accepted blindly.

Machine learning comprehends relationships and interactions lurking in data, but determining these within the model calls for employing model explanation techniques. Insightful questions arise; which features are most informative? How does an output change with alterations in a feature? Which features warrant additional engineering? Answers, although valuable, confront formidab...

Read more...
👍32👏1
Efficiency in trading strategies is instrumental; how one times the entries and exits can make a significant difference to returns. Presenting a concise snippet of code that enables time subtraction and could be employed to optimize trade timings. The key here is a tick counter, which executes the subtraction operation.

Bear in mind, the foundational date employed is 1970.01.01 00:00:00, a parameter that is notably versatile for multiple calculation requirements. This function may provide a considerable uplift in devising time-sensitive strategies, as the usage is incredibly straightforward. Implement it by adding it to the chart, followed by the visual prompt via a Comment with relevant information on screen.

Efficient code can be a game-changer in trading where precision meets profit. Learn and adapt, harness the potential of this programmable tool to strategize and win!

Read more...
👍5👏1
Over a time of great evolution in software development, changes have been witnessed in the MetaQuotes team. Use of native WebRequest for MetaTrader 5 since 2014 signifies significant leaps. The transformation of tools such as IASS, PASS, and SAAS becoming mandatory in various software initiatives, makes the developer's and end user's jobs easier.

Significant changes have also been observed in database management. The once oddball approach of database access via REST API, has transitioned to the preferred method for myriad applications. The numerous providers of these services make them highly accessible and cost-effective.

The article provides an in-depth analysis on five alternatives to connecting a Postgres database to MetaTrader 5. Also, instructions on setting up a development environment, installing Postgres as a remote database, connecting to it and inserting/retrieving data ...

Read more...
2👍2👏2
If you've been looking for a comprehensive list of modified moving averages to use in your strategies, consider this compendium open to the IT community. This is not the original material - it has been brought here from the MQL5 forum, as it is otherwise unavailable to the public.

The algorithms include the Simple Moving Average (SMA), Exponential Moving Average (EMA), and Wilder Exponential Moving Average (Wilder), among a host of others. To further amplify its utility, price points used to construct moving averages range from open, close, high, low, median and weighted average, providing a versatile tool for trading predictions.

Tailor it to your preferences with the adjustable MA_Period defaulting at 14 for the averaging period of the moving average. MA_Shift equals 0 allowing you to shift the moving average by a certain number of periods, and ShowInColor can be set to ‘true’ en...

Read more...
🎉4👌21👍1
In our constant pursuit towards achieving a 100% automated Expert Advisor (EA), minor revisions to the pre-existing segments of code are crucial due to potential interactions between the trader and the EA. Primarily, alterations in sections where data exchanges occur are fundamental. The factors to consider include robustness, reliability, stability, scalability, encapsulation, and efficiency of the system. The precise efficacy of the system depends extensively on having three core code directories: development, working, and stable. This structure aids refactoring and debugging, allowing programmers to pinpoint areas requiring modification or elimination.

Essential modifications have been made to the timing system and the order system. These changes provide greater stability and agility, respectively. Further steps delineate towards transforming the manual EA, ensuring proper automa...

Read more...
👍61👏1
Discover the benefits of using current profit over pip distance for take profit in Expert Advisors (EAs). The EA NextBot code manages this effectively, particularly useful when juggling multiple open positions or using different EAs concurrently. One considerable advantage includes sidestepping potential pitfalls that a pip-based take profit might encounter, such as limiting profits due to broker slippage. For a comprehensive understanding of this, consider referencing the code of EA SwingBot.

The key to this approach is calculating the total number of open orders through a magic number, a unique identifier assigned to an order. A distinct code is then used to calculate the current profit by iterating through all open orders using a loop function. After each iteration, the order's profit adds to a variable thus accumulating the total profit. Additionally, minimum profit can be set ex...

Read more...
👍4👏1
A detailed examination of the challenges faced when developing a replay/simulation system for trading is available. Key points include the importance of maintaining code reliability and stability, as well as the complexity of creating a replay/simulation system that mimics a real account's operation.

This assessment also identifies potential pitfalls of developing a replay/simulation system, such as dependencies in the main code and the lack of utility in creating a simulation if the same resources are not available when the real account is used.

Within this article, you'll find a breakdown of these complexities, including the necessary timer mechanisms for accurate bar trading simulation. It discusses setting a timer in a replay/simulation system, using the MetaTrader 5 platform as a case study.

Furthermore, it deals with the challenge of adapting time-focused codes and systems...

Read more...
👍21👏1
Discussing the elaboration and working of the C_Mouse class, which applies the principles of object-oriented programming for smooth extension of functionalities. Untested parts can be implemented and tested in parallel, without affecting the main code. This reduces the potential for inadvertent bugs, offering advantages especially for large production projects. The article also emphasises the importance of using directory structures to revert back to earlier development stages when necessary.

There is further exploration of the integration of this with the C_Studies class, using pointers for extended functionality. Thus transforming minor projects into valuable additions to the final project, all while preserving the integrity of the class system. Analyzing two paths for system progress, with detailed code comprehension, this article provides essential insights for developers.

The...

Read more...
👍42
This update brings a notable implementation twist to the Commodity Channel Index, using exponential moving averages rather than the simple moving averages traditionally used by creator Donald Lambert. This change, practical and designed to enhance adaptability, demonstrates the evolving nature of programming methods.

This new method incorporates the use of conditional compilation, ensuring functionality on both MQL4 and MQL5. From a comparative standpoint, this strategy brings a significant advantage, enhancing compatibility and efficiency.

For those keen on keeping up with the latest CodeBase publications, rest assured that every piece of source code is readily available under the "Public Projects" tab in MetaEditor, listed under the name "FMIC". This easily accessible resource fosters a continuous learning environment to both seasoned and novel programmers alike. Keep pace wit...

Read more...
1
Progress report on latest development efforts – efforts have been geared towards building the replay/simulation system further. A pivotal component that has been left largely untouched upon – the order system – has now been brought front and center. This crucial part of the entire modeling system enables practical analyses. The aim is to accurately mimic a trading server in a way that is unnoticeable to the user.

The final product is expected to provide a seamless experience that is identical in both the tester and the real market, without necessitating compilation adjustments between them. By focusing on a single-compile Expert Advisor (EA), the user experience is expected to be much enhanced. The plan is to start with a basic EA model and adapt progressively.

Adaptation involves incorporating the revolutionary C_Orders class. Encapsulation is highly upheld, and the process invol...

Read more...
👍31👏1
The complexity of programming continues to make strides in solving intricate and multifaceted problems in stochastic and variable environments. The Control Transformer method, presented in a recent academic publication, proves to be a promising approach. This system utilizes reinforcement learning to engineer flexible control strategies suitable for various contexts. Such adaptability unlocks a new realm of potential in dealing with intricate problems in robotics, autonomous driving, and more, including the world of trading.

The Control Transformer mechanism is divided into several modules characteristic of hierarchical models. One of the main advantages of this method lies in its potency in addressing issues of controlling over extended planning horizons. The solution entails decomposing the problem into manageable subtasks or segments. To structure these tasks, Probabilistic Road M...

Read more...
👍6
There's an insightful update to share with fellow developers and followers in the world of algorithmic trading. Recently, an unusual implementation of the Commodity Channel Index (CCI) has come to light, which employs exponential moving averages. Quite interestingly, it deviates from the conventional method established by its inventor, Donald Lambert, who integrated simple moving averages in the CCI design.

Furthermore, the code attests versatility with an ability for conditional compilation, making it compatible with both MQL4 and MQL5 coding languages. This broadens its utility for any coder who likes to dabble in MetaQuotes Language programming.

For those familiar with the CodeBase and eager to access and utilise this code, it's readily available. The source code is not tucked away in some corner but placed openly for review and use under the "Public Projects" tab of the MetaEdit...

Read more...
42🤣1🏆1
Evolving programming practices draw inspiration from various natural processes. An intriguing example is the Saplings Sowing and Growing (SSG) algorithm by A. Karci, which models tree growth, a long-term survival strategy in nature.

The SSG algorithm serves as an enhancement for other evolutionary population algorithms. Rather than providing a detailed explanation or specifications for algorithmic implementation, the algorithm extends room for experimentation, allowing developers to flex their creativity and apply it based on their understanding.

Conceptualizing trees as optimization agents, the algorithm involves a sequence of steps: planting and growing seedlings, with three primary variation operators - crossing, branching, and vaccination. Although SSG doesn't directly optimize, it improves the quality of optimization in tandem with other algorithms.

The operators of the SSG al...

Read more...
👍51
Presenting a currency observatory that ensures simplicity while offering customization. Users have the liberty to adjust line color, line width, and font size according to their preference to foster better comprehension. Facilitating thorough analysis, the daily start time defaults to 00:00 however, users can amend this timeframe to start the day at hours and minutes of their picking.

The software leverages advanced computation for precise understanding. An instance to consider would be, if the European Union's Euro gains by +1% and the US Dollar drops by -0.50%, then the EURUSD cross result is an impressive 1.50% which simply implies that 1 subtracted by (-0.50%). This computational methodology persists throughout other currency crosses as well, ensuring accurate and comprehensive results.

Users can expect efficient results delivered in an uncomplicated manner due to the refined a...

Read more...
👍5🤣32
MQL5 - a language used widely in the development of trading systems on MetaTrader 5 platform - is rich is resources. For developers working with MQL5, mastering these tools and concepts is pivotal.

The role of simple variables and data types in MQL5 is important to recognise when engaging with algorithmic trading system design. The utilisation of simple data types like integer, float, double, string, and bool forms the basis of coding trading software.

Of particular significance is the Datetime data type, which finds near universal usage in trading software. This article looks at a deeper study into the variables and data types in MQL5, underlining their usability when creating MQL5 trading software.

The repository of advanced variables and data types includes Constants, Arrays, Enumerations and Structures among others. Their value lies in their efficient usage in global and loc...

Read more...
👍72👏1🤣1🏆1
Master the language of MQL5, the robust platform for algorithmic trading, with our comprehensive series. The fifth installment focuses on making array functions more accessible and digestible for everyone. It addresses common misconceptions and intricacies of coding and promotes inclusivity in the domain of MQL5 programming. Herein, a detailed walkthrough of each array function is provided, illuminating the path to coding transformation.

This series isn't just about becoming proficient in MQL5. It's about building a coder community where ideas are exchanged and puzzles are solved collectively. Share, learn, and grow as part of a larger network of novice and seasoned programmers.

Part 5 covers the following array functions: ArrayBsearch, ArrayResize, ArrayCopy, ArrayCompare, ArrayFree, ArraySetAsSeries, ArrayGetAsSeries, ArrayIsSeries, ArrayInitialize, ArrayFill, ArrayIsDynamic, Ar...

Read more...
5👍4🤡1🏆1
Dive into machine learning with part 2 of the article on "Quantization and other methods of preprocessing input data in machine learning.” Explore in-depth the various methods of preprocessing sample data implemented in MQL5 for much precise results, sans complex mathematical equations. Consider embarking on an experiment providing valuable insight into the viability of data quantization.

Dissect the function of the "Q_Error_Selection" script, which loads a sample from the "train.csv" file, transfers its contents into the matrix, preprocesses the data, systematically loads quantum tables, and gauges the data's error relative to their original state for every predictor.

Understand the script settings for loading data, managing spikes, streamlining correlation estimation, handling time-unstable predictors, creating uniform and random quantum tables, and saving the transformed selecti...

Read more...
👍53👏2
A process of recording trade information within a CSV file is proposed. Users will need to save these files in the elaborated folder -- MQL5\File. Optimal results are achieved with utilizing the same Meta Trader 5 broker's terminal to reconcile time differences. This method has outstanding applicability to both Forex and Gold charts that were previously tested.

The procedure for running the expert adviser on each chart is simple. Enter the file name (filename.csv) in the expert adviser's input field. During trading, it visually uses distinct indicators. Blue arrows with trend lines signify buy signals, likewise, red arrows alongside trend lines indicate sell signals.

It's significant to underline that once the expert adviser is removed, all the visual objects (both arrows and trend lines) disappear. This approach ensures a clean slate for future operations. Thus resulting in a strea...

Read more...
👍113👏2🤡1