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
In the initial article, an Expert Advisor (EA) was developed with two trading strategy instances. This increased to nine instances in the second article and 32 in the third. Testing times remained manageable. A shorter single test pass is preferred, but overall optimization should still be completed within hours, not days. A single pass should finish in seconds or minutes for combined instances. Multiple strategy instances increase optimization time.

For the experiment, a new EA based on the existing OptGroupExpert.mq5 was created with necessary code changes and saved as BenchmarkInstancesExpert.mq5. Runs were conducted in different tick simulation modes, doubling instances from 8 to 16,384. Memory usage and simulation times were analyzed. Results indicated reasonable memory consumption and simulation times, with the highest number of instances...
#MQL5 #MT5 #ExpertAdvisor #Backtesting

Read more...
❀26πŸ‘25πŸ‘3πŸ‘¨β€πŸ’»1
Introduction

In our previous article, we examined creating an expert advisor using Trend Constraint V1.09. Now, we aim to develop an independent expert advisor (EA) incorporating both trend analysis and risk-reward functionalities on MQL5.

Creating the Expert Advisor:

1. Launching the EA Template:
Open MetaEditor and select "Expert Advisor (Template)".

2. Customizing the Template:
Define necessary functions and variables, such as OnInit, OnDeinit, and OnTick, to create a structured EA.

3. Writing Trend Constraint Expert Logic:
Integrate logic for trend-based and RSI conditions for buying and selling, including trade management and trailing stops.

Tester Conclusion

Back-test your EA using historical data to ensure it adheres to developed trading strategies and improves profitability.
#MQL5 #MT5 #ExpertAdvisor #AlgoTrading

Read more...
πŸ‘25❀10⚑4🀯2πŸ‘Ύ2πŸŽ‰1πŸ‘¨β€πŸ’»1
A new function facilitates trade monitoring via notifications for important trade events. It alerts users about trade openings and closures and provides details such as trade type and lot size for new trades. Profit and loss information for closed trades is also displayed. This utility works seamlessly in both live trading and strategy testing environments, sending feedback to logs when tested.

For efficient use, integrate this function into your Expert Advisor (EA) or script, and enable push notifications on the MetaTrader platform. It’s crucial to configure the MetaTrader mobile application to receive alerts.

This function is tailored for netting accounts and does not support hedging scenarios where multiple positions per symbol might be open. Adjustments are needed for hedging functionality.

The recent trading history, covering the past ...
#MQL5 #MT5 #Notifications #ExpertAdvisor

Read more...
❀21πŸ‘16πŸ‘¨β€πŸ’»4πŸ”₯2⚑1🀯1πŸ‘Œ1
Discover a refined solution for managing Take Profit (TP) and Stop Loss (SL) levels directly on the MetaTrader 5 chart using an Expert Advisor (EA). This approach enhances order management efficiency by leveraging the platform's tickets system to swiftly correct TP and SL values without external dependencies. By integrating a new drag-and-drop feature for stop levels, you can intuitively visualize and modify them while circumventing common pitfalls like negative TP values. Simplify your trading workflows with improved accuracy and speed, thanks to well-defined macros and functions, making efficient order adjustments accessible for traders and developers alike.
#MQL5 #MT5 #ExpertAdvisor #StopLoss

Read more...
πŸ‘34❀28πŸ‘Œ5πŸ‘¨β€πŸ’»4πŸ†3
In the previous article, we explored modifications to enhance EA system reliability. We focused on separating functionalities to maintain efficiency and performance. This article extends that approach by emphasizing the importance of not embedding indicators in EAs. An EA should purely manage orders and observe prices, without reliance on indicators.

MetaTrader 5 separates indicators, services, scripts, and Expert Advisors to optimize performance. Indicators should operate on separate threads for parallel efficiency. Services can access data efficiently, which isn't ideal directly within an EA. Scripts perform specific tasks temporarily, while EAs should focus solely on trading system operations.

To improve EA reliability, remove non-trading system code, converting such elements into indicators. This reduces EA complexity and increases its agili...
#MQL5 #MT5 #ExpertAdvisor #Algorithm

Read more...
πŸ‘54❀17πŸ‘¨β€πŸ’»6⚑4πŸ‘Œ4
In Part 19 of our series, we implemented significant code changes to enable a new order system in MetaTrader 5. This initiative aims to provide traders with visual and easily understandable order placement, negating the need for detailed knowledge of tick values and such particulars.

Planning involved designing custom indicators with MetaTrader 5's resources, demanding a robust understanding of MQL5. Our goal is to create objects that communicate seamlessly and integrate effectively with each order system.

The implementation phase includes developing several classes such as C_Object_Base, C_Object_BackGround, and C_Object_TradeLine, each handling specific functions to maintain system integrity. Initial coding focuses on structuring these classes to meet the complex demands of the new order system.

Moving forward, modification of the C_ObjectsTr...

πŸ‘‰ Read | AppStore | Share!

#MQL5 #MT5 #ExpertAdvisor
πŸ‘57❀21πŸ‘Ύ9🀯3πŸ‘Œ3πŸ‘¨β€πŸ’»3
Explore innovative methods for integrating online data into MetaTrader 5 Expert Advisors. The article delves into overcoming challenges of server response delays by employing communication channels and threading systems. It provides insight into creating local communication channels using objects, then transitioning to more robust solutions like services, leveraging global terminal variables for data exchange. This ensures seamless client-server interaction within the platform, even through timeframe changes. Such implementation not only advances algorithmic trading capabilities but also enriches developers' understanding of MetaTrader 5 features. Engage with these strategies for improved data handling in trading systems.

πŸ‘‰ Read | Quotes | Share!

#MQL5 #MT5 #ExpertAdvisor
✍26πŸ‘26❀11πŸ‘¨β€πŸ’»5πŸ”₯4πŸ€”1
The Expert Advisor utilizes Bollinger Bands and the Donchian Channel for signal generation. A sell signal occurs when the Donchian Channel declines over a specific period, with an opening price above the upper Bollinger Band boundary and a closing price below it. Conversely, a buy signal triggers when the Donchian Channel rises over a period, the opening price is below the lower Bollinger Band boundary, and the closing price is above it. Trade closure is executed via stop and take profits or upon a Donchian Channel breach. Additionally, the code includes an R-square calculation to enhance analysis precision. Testing on the EURUSD pair spans from January 1, 2020, to April 1, 2025.

πŸ‘‰ Read | CodeBase | Share!

#MQL5 #MT5 #ExpertAdvisor
❀31πŸ‘10⚑1πŸ‘¨β€πŸ’»1
Creating a Chart Trade interface in MetaTrader 5 is achievable without coding through Expert Advisor functionalities. This involves setting up your IDE by cleaning chart properties and using specific MetaTrader 5 objects with X and Y coordinates to design the interface. Save the configuration as a TEMPLATE file in the FILES directory for later use.

A message protocol is crucial for communication between the IDE and the trading system. It supports operations like buying or selling market orders and adjusting trade parameters. The objects in the IDE must be named according to the message names for exchange to work.

The TPL file details the properties and positions of objects. Use binary reading with UTF-16 to extract these. Define constants and employ a message system to keep the EA and IDE synchronized. Object rendering should ensure plac...

πŸ‘‰ Read | Forum | @mql5dev

#MQL5 #MT5 #ExpertAdvisor
❀57πŸ‘13πŸ‘¨β€πŸ’»5πŸŽ‰4πŸ†4πŸ‘2⚑1
The article delves into developing a communication protocol to enhance MetaTrader 5’s Chart Trade indicator, enabling it to instruct an Expert Advisor (EA) for market actions. The challenge lies in the platform's restriction where indicators can't manage orders directly. The key focus is on designing a message protocol, crucial for seamless indicator-to-EA communication. It covers fundamental coding techniques, including memory management with manual class instantiation using 'new' and 'delete'. The expert explains message encoding and decoding using strings in the protocol, highlighting the importance of correctly structured assignments to prevent data misalignment. The article emphasizes developing modular applications over monolithic systems.

πŸ‘‰ Read | Quotes | @mql5dev

#MQL5 #MT5 #ExpertAdvisor
❀72πŸ‘8✍7πŸ‘€5πŸ”₯4⚑3πŸ†3
Optimize your trading strategy with a sophisticated approach to MetaTrader 5 by applying multiple custom criteria in a single optimization run, rather than separately. The article introduces innovative techniques for visualizing balance and equity graphs, using minimal MQL5 coding experience. By utilizing separate include files for key functionalities, you streamline data collection and custom criterion calculations. Discover methods to evaluate optimization results efficiently with advanced graphical representations for balance and equity, allowing you to make informed decisions swiftly. The approach boosts productivity by preserving only necessary trade data, thus ensuring effective data processing and insightful criteria evaluation for better trading outcomes.

πŸ‘‰ Read | Forum | @mql5dev

#MQL5 #MT5 #ExpertAdvisor
❀79πŸ‘15⚑6πŸ‘¨β€πŸ’»3πŸŽ‰2
MetaTrader 4/5 has consistently been a preferred platform due to its flexibility, supporting both manual and automated trading. There are specialized toolkits for different trading methods, such as an events-news-calendar for manual traders and a strategy-tester-console for those who favor automation. A standout feature in automated trading is the MQL5 Wizard, which allows users to prototype multi-signal systems integrating customizable trailing stops and money management functionalities.

The recent focus on a custom Signal Class combines the Stochastic Oscillator with the Fractal Adaptive Moving Average (FrAMA) to enhance trade decision systems. This approach seeks to create a hybrid system, acting as a digital noise filter for market patterns. With ten market catering indicator patterns, real-time testing across different market regimes like ...

πŸ‘‰ Read | NeuroBook | @mql5dev

#MQL5 #MT5 #ExpertAdvisor
❀37πŸ‘6⚑1πŸ‘Œ1πŸ‘¨β€πŸ’»1
In this latest installment of the MQL5 series, we explore a significant advancement in algorithmic trading by integrating manual chart analysis with automated trade execution. The article covers the development of an Expert Advisor (EA) that utilizes chart objects like rectangles and trend lines to make trades, bridging the gap between automated and discretionary trading. By drawing these elements on your chart, the EA dynamically adjusts to price movements, executing trades when the price engages with identified zones. The article details how to programmatically detect chart objects, allowing the EA to adapt instantly to any manual changes, enhancing both its flexibility and precision.

πŸ‘‰ Read | Docs | @mql5dev

#MQL5 #MT5 #ExpertAdvisor
❀23πŸ‘5πŸ”₯2πŸ‘Œ2πŸ‘¨β€πŸ’»2
Discover cutting-edge enhancements in the MetaTrader 5 library designed for algorithmic trading. The refined structure splits a monolithic codebase into reusable components, optimizing execution through modularity. Key improvements involve efficient input handling; only active charts now process keystrokes, reducing resource demands. The new Crosshair tool simplifies interfacing with charts, while the Trendline tool adds flexibility with customizable extrema. The upgrade ensures improved responsiveness in environments with numerous open tabs. Developers benefit from a revamped data management approach, storing global variables locally within classes, enabling independent usage and runtime modification. Embrace these advancements for robust trading systems enhancement.

πŸ‘‰ Read | AlgoBook | @mql5dev

#MQL5 #MT5 #ExpertAdvisor
❀51πŸ‘Œ4πŸ†3πŸ‘¨β€πŸ’»1