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
Testing and optimizing a trading algorithm requires using MQL5's Strategy Tester to backtest the Expert Advisor (EA) against historical data. This article provides insights into interpreting various performance metrics such as profit factor, drawdown, win rate, etc., which indicate the algorithm's reliability and profitability.

A rapid-fire trading strategy profits from quick market movements by executing multiple trades in a short time frame. This approach contrasts with traditional strategies targeting longer-term trends. Automated systems like Expert Advisors are crucial for executing these trades efficiently.

Essential technical indicators for this strategy include the Parabolic SAR and Simple Moving Average (SMA). The Parabolic SAR identifies potential reversals, while the SMA smooths out price data and highlights trend directions.

Implementation in ...
#MQL5 #MT5 #trading #algo

Read more...
πŸ‘16❀11πŸ‘¨β€πŸ’»7⚑1πŸ”₯1πŸ‘Œ1
In the continuation of a MetaTrader 5 Chart Trade project, the article delves into refining user interaction and functionality. By incorporating incremental changes to the Chart Trade indicator, the article emphasizes a macro to standardize error messages, ensuring robust error handling and enhanced security measures. The highlight is the implementation of the C_ChartFloatingRAD class, which optimizes the editability of chart values without clutter. Through meticulous procedural explanations, it shows how to maintain data integrity during timeframe switches and leverage global terminal variables for seamless state management. This approach enhances usability and reliability for algorithmic traders and developers.
#MQL5 #MT5 #Charting #Trading

Read more...
❀12πŸ‘12πŸŽ‰1πŸ‘¨β€πŸ’»1
Discover how AI transforms trading strategies in MetaTrader 5! This article highlights creating new trading strategies using AI to predict the closing price of USDJPY. It explains how fixed income securities, particularly Government Bonds, impact currency valuation and trading strategies. When comparing models, Linear Regression performed best, yet Linear Support Vector Regressor (LSVR) was found most effective after hyperparameter tuning. Comprehensive data analysis and validation techniques ensured accuracy without overfitting. Exported to ONNX, these models enhance automated trading systems. Learn the steps from data fetching to model integrationβ€”perfect for developers and algorithmic traders aiming for precision.
#MQL5 #MT5 #AI #trading

Read more...
πŸ‘18❀14πŸ‘Œ3⚑1πŸ‘¨β€πŸ’»1πŸ‘€1
Causality Network Analysis (CNA) is an advanced tool for modeling causal relationships between variables. In financial markets, CNA helps identify how market events influence each other, leading to better predictions.

Causal discovery infers relationships from data. For financial markets, it means pinpointing which factors, like economic indicators or market prices, affect others. The Fast Causal Inference (FCI) algorithm is often used for this purpose.

Network analysis represents relationships between financial instruments. This involves setting up a network structure to analyze these connections. Event prediction uses models like Vector Autoregression (VAR) for forecasting. The combination of CNA and VAR offers a comprehensive approach to market analysis.
#MQL5 #MT5 #Causality #Trading

Read more...
πŸ‘19❀12πŸ€”2πŸ‘1😁1πŸ‘¨β€πŸ’»1
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
The High and Low Line Indicator plots the highest and lowest price levels of a selected symbol directly on the chart. This indicator aids traders in visual identification of key support and resistance levels, which is vital for informed trading decisions.

Use Cases:

Identifying Support and Resistance: The high and low lines serve as natural support and resistance levels, offering clear points for entry, exit, or stop-loss placement.

Breakout Trading: Monitor price movements above the high line or below the low line to identify potential breakout opportunities. This tool enhances the accuracy of trading strategies through simplified visual analysis.
#MQL5 #MT5 #trading #forex

Read more...
❀17πŸ‘15πŸ‘¨β€πŸ’»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
Review of "Conformer: Embedding Continuous Attention in Vision Transformer for Weather Forecasting"

Study on the potential of utilizing meteorological forecasting algorithms to predict financial market behavior, focusing on the Conformer algorithm. It combines Continuous Attention with Neural ODE, allowing the model to process weather variables over time. The architecture utilizes multi-head attention encoded as a differentiable function to model complex weather dynamics.

Technical implementation using MQL5 involves creating the CNeuronConformer class derived from CNeuronBaseOCL. The structure includes convolutional layers for Query, Key, and Value entities, differentiation over time, and initialization of feedforward and differential equation blocks.

Detailed implementation involves defining partial derivatives within the Continuous Attention mechanism, en...
#MQL5 #MT5 #Finance #AI

Read more...
❀8πŸ‘7πŸ‘4πŸ‘¨β€πŸ’»4⚑1
Discover the potential of Brain Storm Optimization (BSO) for algorithmic trading! This advanced method leverages group idea generation and clustering algorithms like K-Means to identify efficient paths in the data landscape. Our article breaks down the practical implementation of BSO, detailing how agent behavior is modeled, ideas are mutated, and new solutions are generated for optimization. Through rigorous testing on various functions, BSO demonstrates its prowess, particularly in multimodal problem-solving. While parameter tuning is crucial, initial results show promising efficiency. Dive into the intricacies of BSO and enhance your trading strategies with this innovative optimization technique.
#MQL5 #MT5 #optimization #algorithm

Read more...
πŸ‘27❀22πŸ‘5πŸ‘Œ3πŸ‘¨β€πŸ’»3🀣1
The 3 Line Strike pattern from TradingView has been converted to MQL4. This pattern consists of three consecutive candles moving in one direction followed by an engulfing candle moving in the opposite direction, indicating a potential reversal. Specifically, a bearish 3 Line Strike comprises three bullish candles followed by one bearish engulfing candle, whereas a bullish 3 Line Strike consists of three bearish candles followed by one bullish engulfing candle. Note: This version does not include alerts. For usage guidance, refer to instructional videos on YouTube.
#MQL4 #MT4 #forex #trading

Read more...
πŸ‘35❀16⚑5πŸ”₯5πŸ‘¨β€πŸ’»4
Learn how to design a trading system with MQL5 using popular technical indicators. This series covers the Gator Oscillator, its application, and how to create a trading system on MetaTrader 5.

Gator Oscillator Definition:
Created by Bill Williams, the Gator Oscillator helps identify market trends and trading opportunities by measuring the convergence and divergence of balance lines derived from the Alligator indicator.

Gator Oscillator Trading Strategies:
1. Gator Status Strategy: Identifies market phases based on bar colors.
2. Gator Signals: Provides signals for entry, holding, and exit positions.
3. Gator with MA: Combines Gator indicator with Moving Average signals for buy/sell positions.

Blueprints and MQL5 code implementation for these strategies can efficiently enhance trading systems. Before using any strategy, ensure thorough testing on demo ac...
#MQL5 #MT5 #Trading #Forex

Read more...
πŸ‘50❀23πŸ‘Œ3πŸ‘¨β€πŸ’»3πŸŽ‰1🀩1
The Predictive Moving Average, developed by John Ehlers and featured in "Rocket Science For Traders" (page 212), is an early leading indicator. It provides actionable insights for buy and sell decisions based on color-coded signals. When the indicator line turns green, it signals a buying opportunity. Conversely, a red line indicates a selling point. This method aims to offer precise market timing by anticipating future price movements. Integrating this indicator into trading strategies can enhance decision-making processes and optimize trade execution by leveraging its predictive capabilities.
#MQL5 #MT5 #Trading #Indicators

Read more...
πŸ‘30❀20✍9⚑5πŸ‘€4πŸ‘¨β€πŸ’»3
Q-learning was initially introduced in an article about Deep Q-Learning (DQN), which approximates the Q-functionβ€”a dependency of rewards on system states and actions. The real world, however, presents multifaceted challenges that affect the accuracy of these estimations due to outliers and incomplete parameter consideration. In 2017, new algorithms were proposed to study reward value distributions, improving Q-learning application in Atari games.

Distributed Q-learning offers a significant enhancement by approximating the reward value distribution instead of a single value. This method involves splitting possible rewards into quantiles, leveraging parameters like Vmin, Vmax, and the number of quantiles. Unlike classic Q-learning, it transforms the problem into a standard classification problem, using LogLoss instead of standard deviati...
#MQL5 #MT5 #DeepLearning #ReinforcementLearning

Read more...
πŸ‘46❀19πŸ‘7πŸ†7πŸ‘¨β€πŸ’»6😁1
Switching Templates Efficiently in MT4

To switch sequentially between multiple templates, modify the mq4 file in Metaeditor. Change the template names to your preference, separated by commas. Example: extern string Templates = "1.tpl, 2.tpl, 3.tpl";

Set ApplyAllCharts to true to apply the template to all charts, or false to apply it to the current chart only. Ensure template files are in your Data Folder/templates folder. At least two templates are required for switching.

Set a hotkey by right-clicking the script in your navigator and choosing desired keys. This enables quick switching.

The script uses Global Variables to track which template corresponds to each Chart ID. To reset, delete all variables starting with "AbiroidTemplate" from Global Variables.

Error Codes:
- Error Code 0: No error, but issue with MT4. Refresh Scripts in navigator or re...
#MQL4 #MT4 #templates #trading

Read more...
πŸ‘34❀24πŸ‘¨β€πŸ’»2πŸ”₯1πŸ‘Œ1
In our previous article, we covered the process of sending chart snapshots with captions from MetaTrader 5 to Telegram. The method we used, though effective, was straightforward and somewhat inflexible, leading to repetitive and unmanageable code. To enhance this, transitioning to a more modular codebase is advisable.

In this fourth part, the focus will be on improving reusability through code modularization. Detailed discussions will be held on the principles of code modularization and their application to our project. We'll reorganize our existing MQL5 script into separate, well-defined functions.

By the end, you'll have the option of using either the old monolithic program or a new modular Expert Advisor (EA) providing the same output. We'll break the code into discrete functions for tasks like sending messages, taking screenshots, and en...
#MQL5 #MT5 #Telegram #CodeModularization

Read more...
❀41πŸ‘32πŸ‘¨β€πŸ’»10πŸŽ‰6⚑2
For those utilizing the Ichimoku indicator and seeking Tenkan and Kijun cross signals, consider this Expert Advisor (EA). After download, compile it in Meta Editor. Then, on MT4, drag and drop it onto your chart. Adjust the timeframe to match your trading style and enable notifications. In the EA's dialog box, two parameters determine operational hours, set in a 24-hour format ranging from 0-24. Specify these according to your trading schedule. Ensure your Meta Quotes ID is updated in the notification settings of your MT4. Maintain effective trading practices.
#MQL4 #MT4 #Ichimoku #ForexEA

Read more...
❀33πŸ‘18πŸ‘4πŸ‘¨β€πŸ’»3✍1πŸ‘€1
In our latest article, we explore the Conformer method for weather forecasting, adapted for improving trading models using MetaTrader 5. Through timeseries data input, the Encoder model optimizes the Actor's policy. To enhance this process, we introduce Reversible Instance Normalization (RevIN), a simple yet effective normalization technique that addresses distribution shifts by normalizing input sequences and denormalizing output sequences. This technique enhances model accuracy by aligning mean and variance, thus improving timeseries forecasting. We also delve into practical implementation in MQL5, using neural layers for normalization and denormalization, enhancing the robustness and adaptability of trading algorithms.
#MQL5 #MT5 #forecasting #RevIN

Read more...
πŸ‘52❀35πŸ”₯8πŸ†8πŸ‘3πŸ‘¨β€πŸ’»3πŸŽ‰2
Reviewing the code example for generating a histogram of momentum offset reveals several key components. The primary function captures the momentum calculation and its corresponding histogram generation. The `hist()` function from a data visualization library is utilized to plot the momentum data.

Steps involved:
1. Momentum data is derived from a price series.
2. The offset value is computed to adjust the histogram.
3. The histogram plot is generated to visualize the momentum distribution.

To enhance clarity and maintainability, consider adding comments to the code. This will provide additional context for each step, improving the overall readability and usability for other developers.
#MQL4 #MT4 #trading #forex

Read more...
πŸ‘31❀19πŸ‘¨β€πŸ’»5πŸ‘3⚑2πŸ”₯2
Discover the transformative impact of deep learning on timeseries forecasting with the introduction of the Client method. By blending the trend-capturing prowess of linear models with the intricate pattern recognition of enhanced Transformer architectures, Client offers a robust solution to multivariate long-term forecasting challenges. Key to this innovation is the strategic use of Reversible Normalization and transposed data processing to harness inter-variable dependencies. Practical applications in MQL5 highlight the method’s efficiency, providing a comprehensive guide to implementing a custom neural layer. Elevate your trading strategies with this sophisticated approach to predictive modeling.
#MQL5 #MT5 #forecasting #deeplearning

Read more...
πŸ‘21❀10⚑7πŸ‘¨β€πŸ’»4
Examining the integration of Q-Learning and Markov Chains to refine the learning process of a multi-layer perceptron (MLP) network reveals potential improvements in models for Expert Advisors. Q-Learning, a reinforcement learning algorithm, quantifies actions as rewards during training rounds, referred to as episodes.

Reinforcement learning, often categorized alongside supervised and unsupervised learning, balances exploration and exploitation, updating a Q-Learning map to track suitable actions in different states. This map utilizes a learning rate, reward, and discount factor.

Markov Chains, supplementing Q-Learning, transition between states based on probabilities. Transition matrices calculate state importance, memorylessly transitioning from current states. This approach aids in training the Q-Learning map and updating actions efficiently....
#MQL5 #MT5 #machinelearning #trading

Read more...
❀44πŸ‘34πŸ‘¨β€πŸ’»4✍3πŸ‘3