MQL5 Algo Trading
387K subscribers
2.56K photos
2.56K 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
The Gray Wolf Optimization (GWO) algorithm, developed in 2014, is a metaheuristic stochastic swarm intelligence algorithm inspired by the hunting behavior of gray wolf packs. The hierarchy among wolves includes alpha, beta, delta, and omega. Alpha wolves dominate, with betas and deltas aiding decision-making. Omegas, with the least influence, obey all higher-ranking wolves.

Mathematically, the alpha wolf represents the best solution, beta the second best, and delta the third. Omegas signify all other potential solutions. The algorithm's core stages, search, encircling, and attacking, help determine the optimal solution. During the search, alpha, beta, and delta wolves guide the pack toward the prey, while omegas continue to seek better solutions.

Encircling involves reassessing positions based on the fitness function, leading to refined prey location estimates. When attacking, wolv...

Read more...
πŸ‘28πŸ”₯18❀5πŸ‘Œ5πŸ‘¨β€πŸ’»4πŸ†2⚑1
A new Trade Management Script has been released for opening market orders efficiently. Users can define essential trade parameters:

- Order Type
- Stop Loss (in pips)
- Take Profit (in pips)
- Lot Size
- Slippage
- Magic Number for Trade
- Price for Placing Pending Orders

This script facilitates precise trade execution by allowing detailed input specifications. Utilize this tool to streamline your trading process and enhance order management. For visual reference, an example can be accessed via the provided image. Focus on optimizing your trading strategy with these configurable options.

Read more...
πŸ‘82❀45πŸ‘6⚑5πŸ‘¨β€πŸ’»4πŸ”₯2πŸ€”1
The complexity of financial markets is growing with technology. Over 95% of trading turnover is now generated by trading robots. Machine learning models are the logical next step, offering more robust trading systems than linear algorithms. Neural networks enable trading robots to analyze vast datasets, identify patterns, and forecast price movements effectively.

The development cycle of a trading robot includes stages such as data collection, processing, sample expansion, feature engineering, model selection and training, creating trading systems in Python, and monitoring trades. Python offers speed and flexibility in machine learning, with tools available to facilitate this process.

The project’s objective was to create a profitable machine learning model for trading using Python. The steps are:
- Collecting data from MetaTrader 5.
- Expanding the sample through data augmentation...

Read more...
πŸ‘26❀9✍6πŸ‘Œ5πŸ‘€4πŸ€”2πŸ’”1
The development of our Expert Advisor (EA) with a focus on economic data is progressing. Previously, we implemented a system to store economic data in a news calendar database and developed foundational classes for the expert's functionality. Today's update involves expanding these classes to facilitate trading based on economic data, aiming for future profitability.

Key updates include the addition of a new database view displaying unique events from the MQL5 economic calendar and new expert inputs for better filtering of economic data during trades, enhancing flexibility.

Notable UI Improvements:
- Concise, modern graphics with better responsiveness
- Display of terminal date and time highlights during news events
- Dynamic updates for news event details

Enhanced Filtering Options:
- New inputs for risk management, DST schedules, and news settings, providing granular control ove...

Read more...
πŸ‘25❀14⚑2πŸ’”2πŸ‘¨β€πŸ’»2πŸ‘€2😁1
In the previous segment, a Telegram-integrated Expert Advisor was linked with MQL5. Initial steps included setting up the application and developing code to send and receive messages via Telegram. This foundational bot setup enabled straightforward MQL5 messaging to Telegram.

Proceeding to the next step, the focus shifts to transmitting trading signals using MQL5. This enhanced Expert Advisor opens and closes trades based on preset conditions while sending signals to a Telegram group chat. The trading signals have been refined for clarity and conciseness, ensuring nearly real-time updates.

We generate signals using the moving average crossover system. A simple method involving shorter-term and longer-term moving averages identifies potential buy or sell opportunities. Upon detecting a crossover, signals are formatted and sent to Telegram, including the asset name, crossover directio...

Read more...
πŸ‘22❀15πŸ‘¨β€πŸ’»6πŸ‘Œ4πŸ‘€3πŸ’”2⚑1
A new script has been introduced aimed at streamlining order management by closing all open orders simultaneously, excluding pending orders. This script is designed to enhance operational efficiency by allowing traders to execute a bulk closure of currently active trades.

By specifically excluding pending orders, it ensures that future strategies remain unaffected while addressing immediate risk management needs. This tool is especially useful for minimizing manual intervention during volatile market conditions.

Adopting this script can significantly reduce the time spent on individual order closures, thus providing a more efficient workflow. This method integrates seamlessly with existing trading infrastructure, making it a valuable addition to any trader's toolkit.

Read more...
πŸ‘64❀34πŸ”₯6πŸ‘¨β€πŸ’»6⚑5πŸ‘4πŸ‘€2
In previous discussions, we analyzed an S&P 500 trading strategy employing high-weight stocks in the index. An alternative strategy involves using Treasury Note yields. Historically, risk-averse investors shift funds from stocks to safer bonds and Treasury notes, creating a negative correlation between stock investments and Treasury yields. High bond yields suggest low demand, indicating investors are leaning towards stock investments.

To validate this strategy, we examined the statistical significance of using Treasury yield data. Multiple models, including the SGD Regressor, were trained using S&P 500 OHLC data and 5-year Treasury Note data. Results indicated the models performed better with just S&P 500 data, questioning the reliability of Treasury yield correlations.

Data was collected using Python scripts to export from MetaTrader 5. Analysis showe...
#MQL5 #MT5 #trading #finance

Read more...
πŸ‘30❀13πŸ‘5πŸ‘¨β€πŸ’»5πŸŽ‰3πŸ‘Œ3😁1
The Boids algorithm, conceived by Craig Reynolds in 1986, is renowned for simulating flocking behaviors observed in nature, primarily among birds, fish, and insect swarms. This algorithm employs three fundamental rules to replicate collective behavior: Separation minimizes collision chances, Alignment adjusts movement direction based on nearby entities, and Cohesion brings individuals closer to each other. This simple rule set can generate complex group dynamics.

Applications of Boids include realistic animation in computer graphics, behavior modeling in robotics, traffic management, and more. Additionally, the algorithm has given rise to other swarm intelligence methods like Particle Swarm Optimization (PSO).

Parameter tuning is crucial for Boids. Key parameters include cohesionWeight and cohesionDist for attraction, separationWeight and separ...
#MQL5 #MT5 #algorithms #optimization

Read more...
πŸ‘30❀14πŸ†8✍7⚑3πŸ‘¨β€πŸ’»2πŸ‘€1
The Trend Strength Index (TSI) indicator evaluates the current trend's strength. It operates similarly to a simplified auto-regression indicator by utilizing the correlation function. This function computes the Pearson correlation coefficient between two data sets: the closing prices and the bar indices over a specified period. The coefficient, which ranges from -1 to 1, measures the strength and direction of the linear relationship between the bar index and the closing price.

A value close to 1 indicates a strong uptrend with minimal deviation from the mean, while a value near -1 signifies a strong downtrend with small deviations. Values around 0 suggest a possible flat market trend.
#MQL4 #MT4 #trading #forex

Read more...
πŸ‘35❀22✍7πŸ‘¨β€πŸ’»5πŸ†4πŸ‘Œ1
Write articles for the Algo Trading Community and earn 200 USD for each publication

Do you have valuable knowledge to share or an interesting idea to discuss? Join our authors, share your expertise in trading and programming, and get paid for your publications.

In July, experienced algorithmic traders covered a wide range of topics: from the versatile capabilities of the MQL5 language and basic multi-currency strategies to advanced AI technologies and neural networks in trading.

Last month alone, 61 new publications were released in the Articles section, a record achievement. Here are some of the top articles:

β–ͺ️S&P 500 Trading Strategy in MQL5 For Beginners
β–ͺ️Build Self Optimizing Expert Advisors with MQL5 and Python
β–ͺ️Eigenvectors and Eigenvalues: Exploratory Data Analysis in MetaTrader 5

At MetaQuotes, we fully support knowledge sharing among our community members. We believe that the continuous exchange of ideas can help increase the professional expertise of our users and drive progress in the entire algorithmic trading industry.

Become one of our authors: contribute to the growth of the largest algorithmic trading community and monetize your expertise.

Write an article...
πŸ‘87❀61πŸ”₯10πŸ†8⚑7πŸ‘¨β€πŸ’»4πŸ‘€3
An advanced guide on integrating Python for MQL5 development is now available. This is essential for enhancing programming capabilities, particularly for financial market analysts and developers.

**Python Overview:**
Python, created by Guido van Rossum in 1991, is a high-level, readable, and simple programming language. It supports various paradigms like object-oriented, procedural, and functional programming, and runs on multiple operating systems such as Windows, MacOS, and Linux. Key features include readability, dynamic typing, and an extensive standard library. Popular libraries for data science, AI, automation, and web development are Pandas, NumPy, SciPy, TensorFlow, Selenium, and Flask.

**Integration Benefits:**
Combining Python with MQL5 offers several advantages:
1. Advanced data manipulation through libraries like Pandas and NumPy
2. Machi...
#MQL5 #MT5 #Python #FinTech

Read more...
πŸ‘22❀20πŸ‘¨β€πŸ’»5⚑3🀑2πŸ‘Ύ2πŸ‘1
MetaEditor includes a compiler that effectively manages errors detected during profiling. This tool helped uncover why the previous version failed to display risk-reward rectangles correctly. The issue was not with the code but with the look-back candle value set too high at 5,000 bars by default, slowing down the indicator chart window.

To address this, we reduced the look-back period from 5,000 bars to 1,000 bars, significantly decreasing the amount of data to be calculated. We created a standalone script to handle conditions checked by Buffer 6 and Buffer 7. The script draws necessary risk-reward rectangles and places lines with price labels for the entry price, Stop Loss, and Take Profit.

Now, the focus shifts to developing an Expert Advisor based on the refined Trend Constraint Indicator. Using MetaEditor, we write our EA, incorporating MQL5 fun...
#MQL5 #MT5 #MetaTrader #Trading

Read more...
πŸ‘36❀15πŸ‘¨β€πŸ’»7πŸ‘Œ2πŸ‘1
The Restoring Pull Indicator, developed by John Ehlers, is a momentum indicator that provides clear buy and sell signals. As noted in Stocks & Commodities V.11:10 (395-400), this indicator is one of Ehlers’ earliest contributions to technical analysis. The principle is straightforward: when the indicator line turns green, it signals a buying opportunity. Conversely, when the line turns red, it’s time to sell. This tool is particularly useful for traders looking to capitalize on shifts in market momentum. Understanding its application can enhance decision-making in trading strategies.
#MQL5 #MT5 #Trading #Indicators

Read more...
πŸ‘59❀42⚑11πŸ‘¨β€πŸ’»5πŸ‘4
Social insects like honey bees have evolved complex behaviors including communication, nest building, and division of labor, which allow them to thrive in social colonies. One extraordinary ability is their method to locate optimal nectar sources using a "dance" to relay information about the geographical position and nectar quantity. Discovered by Karl von Frisch in the mid-20th century, these insights inspired the development of optimization algorithms.

In 2005, Dervis Karaboga published research on the Artificial Bee Colony (ABC) algorithm. This algorithm simulates the foraging behavior of bees. The model includes scout bees that randomly search new areas and worker bees that exploit known nectar-rich areas.

The algorithm starts with scout bees exploring the space randomly. Upon returning, they share their findings, and worker bee...
#MQL5 #MT5 #ArtificialIntelligence #BeeAlgorithm

Read more...
πŸ‘34❀17πŸ”₯3πŸŽ‰2πŸ‘Œ2πŸ‘¨β€πŸ’»2
Time Segmented Volume (TSV) is a technical analysis indicator developed by Worden Brothers Inc. TSV segments a stock’s price and volume data according to specific time intervals, allowing for a detailed comparison to highlight periods of accumulation (buying) and distribution (selling). The methodology aims to identify leading market indicators by evaluating different time segments of price and volume metrics. This approach can offer valuable insights when analyzing market trends and investor behavior. Understanding TSV can enhance one's ability to forecast market movements based on detailed time-based segmentation of trading activities.

Source: Worden Brothers Inc.
#MQL4 #MT4 #Forex #Trading

Read more...
❀36πŸ‘23πŸ‘¨β€πŸ’»5πŸŽ‰2πŸ’―2⚑1
Are you interested in machine learning? Join our multilingual forum where AI enthusiasts discuss neural networks and exchange useful information:

βœ“ How to use machine learning for trading
βœ“ AI-powered trading strategies
βœ“ Best models and best practices for training them
βœ“ Books and websites related to neural networks
βœ“ Real trading results obtained using AI robots

Get new ideas and share your expertise in this dedicated thread:

Machine learning in trading: theory, models, practice and algo-trading
πŸ‘68❀27πŸ‘7πŸ’―7πŸ‘¨β€πŸ’»6πŸ”₯5
There are innumerable ways AI can enhance trading strategies, yet evaluating each one before adoption is impractical. Let's revisit the strategy of multiple symbol analysis to see how AI can improve it.

Trading strategies with multiple symbol analysis rely on correlations between symbols. Correlation measures linear dependency between variables but does not imply a relationship. For instance, the USDZAR currency pair correlates with oil and gold prices. Understanding these correlations helps gauge risk and guide decisions.

For this analysis, market data from MetaTrader 5 was exported and used to train models with OHLC quotes and a combination of oil and gold prices. Results showed oil having a stronger correlation with USDZAR than gold. Models like linear regression and KNeighborsRegressor performed best, with hyperparameter tuning improving accurac...
#MQL5 #MT5 #AITrading #FinanceAI

Read more...
πŸ‘25❀16πŸ‘¨β€πŸ’»4🀯3⚑2
Regularization is crucial in machine learning algorithms to enhance the performance of neural networks. It addresses the issue of biasing towards specific parameters, which can hinder network performance on out-of-sample data.

The primary methods of regularization include Lasso (L1), Ridge (L2), Elastic-Net, and Drop-Out. Each method introduces different benefits when correctly paired with activation and loss functions, thus preventing exploding or vanishing gradients.

For classifier networks, L1 regularization (Lasso) is useful as it promotes sparsity. For regressor networks, L2 regularization (Ridge) is favored for balanced weight distribution.

Drop-out regularization is beneficial for deeper networks as it improves generalization by forcing the network to learn redundant representations, making it robust and resilient to noisy data.

When testing o...
#MQL5 #MT5 #RegEx #ML

Read more...
πŸ‘23❀4πŸ‘3πŸ‘¨β€πŸ’»3
Dynamic Time Warping (DTW) offers powerful pattern recognition in financial time series, surpassing traditional methods like Euclidean distance. Originating from speech recognition, DTW aligns sequences with flexible timing, ideal for non-linear financial data.

DTW's strength lies in its ability to account for temporal distortions, enabling identification of unique patterns. The MQL5 implementation focuses on calculating distance scores with customizable step patterns, distance measures, and global constraints, improving alignment accuracy.

Key features include:
- Versatile alignment of sequences with different rhythms.
- Application-specific constraints for meaningful analysis.
- Essential class structures (CStepPattern, CConstraint, Cdtw) for DTW calculations.

This technique provides a robust tool for sophisticated financial market analysis.
#MQL5 #MT5 #trading #fintech

Read more...
❀16πŸ‘15πŸ‘¨β€πŸ’»4πŸ”₯3πŸŽ‰1