MQL5 Algo Trading
388K 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
Dive deep into advanced logging for MetaTrader 5 with the development of a custom log library. Overcoming MetaTrader 5's native log limitations, this module introduces robust architecture using the Singleton pattern, enabling consistency across components. It integrates advanced persistence for storing logs, offering traceable history crucial for audits. With flexible outputs and log level classification, the library provides a customizable solution tailored to developers' needs. Core features include efficient log formatting, utilizing placeholders for detailed and organized log presentation. This framework not only optimizes Expert Advisors’ behavior analysis in real-time but enhances debugging efficiency for developers.
#MQL5 #MT5 #EA #Algorithm

Read more...
πŸ‘17❀7✍5πŸ‘Œ2πŸ‘¨β€πŸ’»2
The development of the Signal Pulse EA in MQL5 leverages Bollinger Bands and Stochastic Oscillator indicators across M15, M30, and H1 timeframes to detect buy and sell signals accurately. This system is designed to confirm signals from multiple timeframes, minimizing the occurrence of false signals. By ensuring that trades are entered only when strong confirmation exists, this approach enhances trading reliability and risk management. The combination of these elements empowers traders with informed decision-making, bolstering confidence in market entry points. Comprehensive backtesting with historical data ensures robustness, while future improvements might include trend direction filters and advanced risk strategies.
#MQL5 #MT5 #EA #Strategy

Read more...
πŸ‘29❀11πŸŽ‰3πŸ‘¨β€πŸ’»2✍1πŸ‘Œ1πŸ†1
Explore the innovative application of Hidden Markov Models (HMMs) in trading strategies using MetaTrader 5. HMMs, employed for market regime identification, enhance volatility prediction by modeling transitions between hidden market states. This comprehensive guide details the development of a trend-following strategy, leveraging HMMs within MQL5. It covers fetching data with Expert Advisors, training HMMs in Python, and integration for real-time adaptability. Tested from 2020 to 2025, the strategy showcases improved predictability and profitability compared to traditional methods. Despite the complexity of neural networks, HMMs offer a simpler, resource-efficient alternative, balancing model clarity with predictive power.
#MQL5 #MT5 #HMM #AlgoTrading

Read more...
❀19πŸ‘12πŸ‘¨β€πŸ’»4πŸ‘Œ2
Learn how to enhance MetaTrader 5 EAs for reliable performance on real accounts with comprehensive strategies. Key techniques include symbol substitution to match broker-specific naming conventions, implementing a trading completion mode, and robust recovery post-restart. Adding symbol substitution helps maintain trading consistency across different brokers by adapting to name variations. The trading completion mode enables EAs to close positions optimally without incurring unnecessary losses, even during drawdowns. Lastly, ensure the EA’s resilience by implementing save/load functionality, allowing recovery and continuity after terminal restarts. This structured approach improves EA reliability and adaptability in real trading environments.
#MQL5 #MT5 #EA #Trading

Read more...
πŸ‘22❀6πŸ†2πŸ‘¨β€πŸ’»2⚑1πŸ”₯1πŸ‘Œ1
Chaos theory's application in financial markets offers a distinct perspective beyond conventional models, focusing on non-linear and complex dynamics. Key concepts include attractors, fractals, and the butterfly effect. Attractors represent recurring patterns or levels toward which markets gravitate. Fractals show consistent patterns across different timeframes, relevant to technical analysis. The butterfly effect highlights sensitivity to initial conditions, complicating long-term forecasts.

Chaos theory aids in volatility analysis, with models like phase space reconstruction providing insights into market behavior. The Lyapunov exponent measures chaos, indicating a system's sensitivity to change. Positive values show unpredictability, while negative values suggest stability. Implementing the Lyapunov exponent in MQL5 can enhance trading strategies,...
#MQL5 #MT5 #ChaosTheory #Finance

Read more...
πŸ‘40❀11✍2πŸ†2πŸ‘¨β€πŸ’»2⚑1πŸ‘Œ1
The concept revolves around an Expert Advisor (EA) based on the MA on Momentum custom indicator. The signal is generated by the intersection of two indicator lines. For a 'BUY' order, the intersection should occur below level '100', while a 'SELL' order requires it to be above '100'. The EA employs a Take Profit parameter, measured in points, and a Stop Loss parameter determined by monetary value.

Optimization involves configuring certain parameters effectively. The working timeframe is a crucial setting, as indicators and new bar detection rely on this. The EA allows for either constant or dynamic position size management through money management settings. Trailing, while depicted in code, can be deactivated.

Additional settings include restricting to a single market position and managing opposite positions. The EA can also reverse signals as needed. Ena...
#MQL5 #MT5 #EA #Indicator

Read more...
πŸ‘26❀10πŸ‘¨β€πŸ’»4πŸ‘Œ2🀑2
The article introduces an innovative trend prediction model for stock price analysis, tackling the limitations of traditional methods by employing a dual-feature extraction approach. This model integrates short-term spatial features via convolutional neural networks and long-term temporal features using piecewise linear regression. The dual-attention mechanism within an Encoder-Decoder architecture enhances feature selection, improving forecast accuracy. Practical implementation details in MetaTrader 5 suggest leveraging LSTM blocks with attention enhancements for extracting and combining market data features effectively. This model provides traders and developers an advanced tool for capturing complex market dynamics, offering improved predictive insights into stock price movements.
#MQL5 #MT5 #AlgoTrading #ML

Read more...
πŸ‘26❀5πŸ’―3πŸ‘¨β€πŸ’»3⚑2πŸ‘Œ2
Understanding log handlers is essential for building a robust logging library in MQL5. Handlers dictate the destinations for log messages, such as consoles, files, and databases. This series of articles illustrates how to develop a log library tailored for Expert Advisors, improving upon MetaTrader 5’s native logging.

We established a foundational structure using the Singleton pattern for consistency, enabling advanced persistence by storing logs in databases for audits and analysis. The flexibility in output and log levels enhances customization, allowing developers to differentiate between types of log messages according to severity.

The next step explored is creating handlers, which act as conduits directing these logs to the desired locations. Implementing a base class, `CLogifyHandler`, allows modular development by handling various outputs like termi...
#MQL5 #MT5 #EA #Algorithm

Read more...
πŸ‘23❀2πŸ‘Œ2πŸ‘¨β€πŸ’»2
To streamline MetaTrader 5 trading via API integration, connect your Expert Advisors with broker accounts, automating fund management. This technique solves limited trading account balances by permitting automated top-ups when funds dip under a set threshold. Using MQL5, leverage external languages like Python to interface with APIs, focusing on Deriv.com as an example broker. Implement continuous operations hosted on virtual servers for seamless 24/7 management. However, ensure robust fund management to avoid fund depletion. Secure your API tokens meticulously to safeguard accounts. By combining Python’s WebSocket capabilities with MQL5 EAs, automate account operations efficiently and bolster your trading system's reliability.
#MQL5 #MT5 #API #AlgoTrading

Read more...
πŸ‘22✍4❀3πŸ‘Œ3πŸ‘¨β€πŸ’»3πŸ”₯2
Discover a specialized approach to calculate the pseudoinverse in MetaTrader 5 using matrix factorization without general-purpose algorithms. This article highlights the efficiency of transforming arrays into a simple 2x2 matrix, enabling faster execution than generic methods. While traditional computations rely on libraries using matrices, this guide details implementing pseudoinverse directly in arrays, providing practical insights for developers. By mimicking matrix operations, programmers can optimize neural network calculations, offering a path toward efficient execution. Intended for educational use, it also hints at potential hardware implementations for scaling computations, catering to both traders and developers engaged in algorithmic trading.
#MQL5 #MT5 #NeuralNetworks #AITrading

Read more...
❀22πŸ‘Œ17πŸ‘14πŸŽ‰5πŸ‘¨β€πŸ’»4✍2πŸ†1
Adapting MT5 code for MT4 in position copying programs requires overcoming functional discrepancies. Essential libraries in MT5 must be recoded to enable functionality on MT4. Key restrictions are evident: avoid utilizing exclusive MT5 classes and libraries, such as CHashMap, in MT4 coding. Trading operations should exclusively use the CTrade class, while market info tasks rely on CPositionInfo, COrderInfo, and CSymbolInfo classes. Certain class methods might require adjustments during testing to ensure seamless operation. For instance, the file TradeLibraryMT5Example.mq4 effectively demonstrates an expert advisor that compiles and executes on both platforms. Key functions include opening pending orders, calculating total profit from open positions, and closing all open positions and pending orders.
#MQL4 #MT4 #EA #AlgoTrading

Read more...
❀23πŸ‘18πŸ‘Œ6πŸ‘¨β€πŸ’»5
Claude Shannon's 1948 paper introduced information entropy, a measure of uncertainty or disorder in a system. Entropy helps quantify unpredictability, with higher entropy indicating more unknowns. This concept is useful in various fields, including finance. For instance, examining the entropy of price histories may reveal trade signals. Using Shannon's entropy in trading involves comparing the entropy of rising and falling price bars to identify potential buy or sell signals.

The Decision Forest class helps in implementing Shannon's entropy signal within the MQL5 trading platform. Decision trees, a fundamental part of machine learning, classify data based on attributes. In trading, attributes can include price direction or other key indicators. By employing random forests, a collection of decision trees, trading strategies can benefit from diversifie...
#MQL5 #MT5 #Entropy #AlgoTrading

Read more...
❀33πŸ‘18πŸ‘¨β€πŸ’»5πŸ‘Œ4⚑3🀯3
Understanding the nuances of indicator settings optimizes analysis accuracy. Begin with the Momentum Period, set at 14 candles; it's ideal for balancing smoothness and responsiveness. A higher value provides a smoother curve but introduces some lag. Similar parameters apply to Volatility Period, also recommended at 14, ensuring the indicator remains responsive to market changes.

Adjusting the Scaling Factor, with a default of 100000, is crucial for obtaining a readable curve. Thresholds for overbought and oversold conditions are set at 100.0 and -100.0, respectively, to flag potential price reversals.

The functions of the indicator include key signals like trend determinationβ€”positive for bullish, negative for bearishβ€”and dynamic volatility adjustment, enhancing signal accuracy. Monitoring overbought and oversold signals can preempt potential correc...
#MQL5 #MT5 #Indicator #Strategy

Read more...
πŸ‘33❀12πŸ”₯4πŸ‘Œ4✍3πŸ‘¨β€πŸ’»3πŸ†1
The addition of matrices and vectors as data types in MQL5 enhances capabilities to solve complex mathematical problems. These data types allow for concise and easily readable code that aligns closely with mathematical notation. The introduction of built-in methods for matrices and vectors enables streamlined operations such as transposition, matrix multiplication, and scalar integrations, reducing the complexity typically associated with nested loops in array operations.

Matrices and vectors in MQL5 also support various transformations, decompositions, and statistical methods, enhancing the language's utility in modern computing tasks, including machine learning. Functions available for these data types allow efficient execution of tasks, such as Singular Value Decomposition and Cholesky decomposition, crucial for solving systems of linear e...
#MQL5 #MT5 #MachineLearning #AlgoTrading

Read more...
πŸ‘48❀27πŸ‘¨β€πŸ’»5πŸ‘Œ4πŸ‘€4
Introducing a trading strategy that utilizes the Two Lines Momentum Indicator. This setup combines a basic Momentum indicator with a smoothed version using a Moving Average. The key trading signals are derived from when these two lines intersect. When the crossover occurs below the '100' level, it indicates a potential opportunity to open a BUY position. Conversely, if the recalculation happens above the '100' level, it suggests a signal to open a SELL position. This method aims to identify shifts in market momentum to make informed trading decisions. Thorough analysis and cautious application are advised for optimal results in leveraging this strategy.
#MQL5 #MT5 #Indicator #Strategy

Read more...
πŸ‘40❀23πŸ‘¨β€πŸ’»8πŸ‘Œ5
Time series forecasting in multivariate settings faces challenges due to the curse of dimensionality. Traditional models struggle with performance when data windows are insufficient, demanding innovative approaches for analysis. The Spatio-Temporal Information (STI) Transformation equation addresses these issues by translating multivariate spatial data into the temporal dynamics of the target variable, expanding sample size and countering short-term data limitations.

Utilizing Transformer-based models enhances this process through the Self-Attention mechanism. Transformers capture global relationships without considering variable distance, alleviating dimensionality issues. The Spatiotemporal Transformer Neural Network (STNN) demonstrated in research efficiently forecasts multivariate time series by integrating STI with Transformer architecture.
#MQL5 #MT5 #TimeSeries #AlgoTrading

Read more...
πŸ‘32❀10πŸ‘€4πŸ‘Œ2πŸ‘¨β€πŸ’»2
Explore the innovative Liquidity Grab trading strategy, central to Smart Money Concepts in algorithmic trading. This strategy leverages institutional market behavior, focusing on exploiting high liquidity zones like support and resistance levels. The article delves into developing an Expert Advisor (EA) using MQL5, detailing its step-by-step coding process and highlighting essential functions like order execution, rejection patterns, and moving average integration. Backtesting on GBPUSD revealed promising results, particularly during high-volatility periods. Practical insights are provided for optimizing intraday trades and restraining trading to volatile sessions. Empower your algorithmic trading with these strategic insights and comprehensive EA development guidelines.
#MQL5 #MT5 #Strategy #EA

Read more...
πŸ‘34❀13πŸ‘Œ3πŸ‘¨β€πŸ’»2
The document outlines the ASBO (Adaptive Social Behavior Optimization) algorithm, focusing on its two-phase evolution for optimization tasks. In the first phase, multiple populations evolve independently, enhancing solution diversity and localizing the global optimum. The resulting best solutions undergo a second phase for accelerated convergence to the optimal solution, leveraging adaptive parameters. The document details pseudocode, highlighting critical steps like initialization, independent handling of populations, and combined population handling through the C_AO_ASBO class. The algorithm's effectiveness leverages traditional approaches from existing optimization models while introducing novel elements tailored for ASBO's multi-population method.
#MQL5 #MT5 #AI #Algorithm

Read more...
❀28πŸ‘9πŸ†3⚑2πŸ‘¨β€πŸ’»2✍1πŸ‘Œ1
Advancements in MQL5 allow developers to implement cryptographic algorithms directly, improving security and system stability. Custom implementations provide greater control, tailoring to specific tasks, and reducing vulnerabilities. Cryptography is crucial for APIs and trading system security, requiring a thorough understanding of algorithms.

A significant issue arises with API signature generation, where MQL5's native hashing functions may not align with cryptocurrency exchange requirements, causing authentication failures. This often necessitates custom SHA-256 implementations to ensure compatibility with exchanges like Binance or Bybit.

Custom implementations not only resolve compatibility issues but also offer performance optimization, crucial for high-frequency trading. Optimizing SHA-256 for trading can involve recognizing and reusing consis...
#MQL5 #MT5 #Cryptography #SHA256

Read more...
πŸ‘34❀26πŸ‘Œ3πŸ‘¨β€πŸ’»3
The indicator setup uses the standard 'DeMarker' indicator in a subwindow, which is smoothed through a 'Moving Average'. 'Arrow' objects indicate intersections. This method visualizes potential signals for traders. Two approaches exist: Aggressive traders may act on signals from bar #0, accepting higher risk. Alternatively, more risk-averse traders might prefer signals from bar #1, which offers greater stability through conservatism. This dual-method strategy provides flexibility in trade execution depending on individual risk tolerance levels. The approach maintains a balance between early entry opportunities and reduced risk exposure.
#MQL5 #MT5 #Indicator #Strategy

Read more...
πŸ‘30❀15πŸ‘¨β€πŸ’»4⚑2✍2πŸ‘Œ2