MQL5 Algo Trading
579K subscribers
4.63K photos
7 videos
4.64K 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 new time utility library offers over 80 functions to efficiently handle time variables. Designed for high-performance applications, the library's performance mode is optional and can be activated at compile time using a #define directive. By enabling this mode, the library substitutes MQL's TimeToStruct and StructToTime functions with more efficient versions, enhancing performance in software requiring heavy time-related processing. Users can quantify speed improvements by compiling the "performance_mode.mq5" script with and without the performance mode.

Key additions include functions for calculating business days, finding the Nth weekday in a month, and optimized time calculations. Usage examples are available through "basic.mq5" and "advanced.mq5" scripts, showcasing both fundamental and advanced functionality. The latest update introduces the Ti...
#MQL5 #MT5 #Script #Performance

Read more...
❀28πŸ‘16πŸ‘Œ3⚑2✍2πŸ‘¨β€πŸ’»2
Programming optimization and clarity are priorities when defining variables and arrays in your EA. Begin by aligning initial variable names to those used in subsequent code lines. For instance, assign a specific variable, such as `g_rates`, to represent `MqlRates`, incorporating functionalities like open, close, high, and low of candles. Use a placeholder variable "i" for referencing specific candles, e.g., `CANDLECLOSE(3)` for candle 3's close price.

To fetch ASK and BID values, utilize `MqlTick` or `SymbolInfoDouble` for consistent results. Define arrays for moving averages, ATR, and other indicators while maintaining `AsSeries` for essential operations. Adjust #define statements according to your EA's requirements without affecting subsequent code.

Understanding candle features is crucial, particularly for price-action based EAs. Definitions include W...

πŸ‘‰ Read | AlgoBook | Share!

#MQL5 #MT5 #EA
πŸ‘25❀16πŸ€”1πŸ‘Œ1πŸ‘¨β€πŸ’»1
Master the art of using definitions in MQL5 to enhance algorithmic trading capabilities. The article delves into the effective use of compilation directives, exploring #define and #undef to control code execution and improve performance. Learn how to utilize these tools to modify code safely and swiftly, allowing for seamless integration of complex functionalitiesβ€”like importing external C/C++ code into MetaTrader 5. Ideal for developers looking to streamline coding processes without sacrificing speed. Discover how these techniques can facilitate version control and improve code granularity, offering practical insights for both beginner and seasoned programmers in the meta-trading ecosystem.

πŸ‘‰ Read | Signals | @mql5dev

#MQL5 #MT5 #Programming
❀28⚑2πŸ‘2πŸ‘¨β€πŸ’»2πŸ‘Œ1
Explore the intricate world of MQL5 programming with this engaging guide to utilizing the #define directive for inline macros. Discover how to transform repetitive code into efficient procedures, saving both time and space in your projects. Learn the art of passing arguments to macros, a powerful yet cautious approach to enhance your algorithmic trading scripts. Mastering these techniques ensures optimized code performance, crucial for high-frequency trading strategies. By understanding the subtle differences in compiler behavior, programmers can achieve faster execution while minimizing memory usage. This knowledge is pivotal for developers seeking to deepen their understanding of resource management in MetaTrader 5.

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #Macro
❀26πŸ‘3πŸ‘¨β€πŸ’»2
In the realm of MQL5 programming, transitioning from manually handling SQL to using ORM can optimize data operations remarkably. Initially, we explored setting up databases, focusing on SQL commands within MQL5 scripts to handle basic tasks like table creation, data manipulation, and transaction management. Such an approach laid the foundation, but posed challenges as systems scaled: code verbosity, repetition, and potential errors increased.

Moving towards an ORM (Object-Relational Mapping) system can streamline these operations, representing database tables as classes. Utilizing the MQL5 preprocessing feature #define significantly aids in this by automating class generation, reducing redundancy, and enhancing maintainability.

The macro capabilities in MQL5 provide powerful tools beyond text substitution, enabling the creation of structured entity classes t...

πŸ‘‰ Read | Freelance | @mql5dev

#MQL5 #MT5 #ORM
❀40✍3πŸ‘Œ3πŸ‘¨β€πŸ’»2⚑1πŸ”₯1
AccountGuard provides a single-header account lock for MT5 Expert Advisors, controlled via compile-time #define settings and embedded into the .ex5. Licensed accounts can be listed as login-only or server:login pairs, with flexible separators. Optional switches allow any demo account, a fixed expiry timestamp, and a Strategy Tester bypass for backtesting.

Integration uses AG_Init() in OnInit() and AG_Allowed() as a gate before any new orders, while existing exits and trailing logic continue to run. AG_Reason() supplies a concise lock message for panels or logs. Runtime inputs include a custom alert message and an internal self-test covering 32 scenarios.

Default behavior is fail-closed: empty lists, typos, expiry, or missing account data result in LOCKED, with automatic rechecks. Expiry uses server-derived time to reduce clock rollback abuse. No DLLs, WebReq...

πŸ‘‰ Read | Docs | @mql5dev
❀14πŸ‘12🀩8πŸ”₯3πŸ‘1