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
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
Since 2019, this personal library has been developed to facilitate position manipulation and retrieve various information. Key functions include:

- `SymbolOpenPipsMagic`: Returns open pips from all positions by magic number.
- `SymbolOpenPercentageMagic`: Returns percentage from open positions by magic number.
- `SymbolOpenPoints`: Returns open points/pipets trades.
- `SymbolOpenPositionsClose`: Closes all open positions.
- `SymbolOpenPositionsSpecific`: Returns the number of specific open trades by comment.
- `SymbolPositionResultMoney`: Returns the result from a position at a specified price target in money.

Other utilities handle pending orders, calculated margins, risk/reward ratios, and normalize volumes. Chart manipulation and candle data extraction are also streamlined. Additional functions support account status checks, managing historical data, a...
#MQL5 #MT5 #forex #trading

Read more...
❀26πŸ‘23πŸ‘¨β€πŸ’»2⚑1😁1πŸ€”1🀨1
Explore the potential of AI in trading with this comprehensive guide on algorithmic strategies for MetaTrader 5. Discover how to uncover key relationships between currency and precious metals markets, leveraging xauusd, xpdusd, and usdcad pair data. Learn how to fetch and preprocess this data using MQL5 and Python, ensuring clean datasets for accurate modeling.

Dive into various forecasting models, including Linear Regression and Linear Support Vector Regressor (LSVR), and understand their performance using 5-fold cross-validation. Finally, export your finely-tuned model to ONNX format and integrate it with your MetaTrader 5 Expert Advisor for smarter trading decisions.
#MQL5 #MT5 #trading #AI

Read more...
πŸ‘21❀12✍7πŸ‘Œ2πŸ‘¨β€πŸ’»2πŸ‘Ύ2πŸ‘€1
The U-shaped Transformer algorithm enhances the vanilla Transformer architecture for time series forecasting by retaining high frequency context. The innovative approach involves a two-stage training process: pre-training with diverse datasets to learn dependencies and reduce noise, followed by fine-tuning on specific problems. This method ensures efficiency, requiring less computational power for fine-tuning. Key features include patch-based embedding for extracting multi-scale features, convolutional layers, and skip-connections for fast data transfer, enhancing model robustness and generalization. Implementing these techniques in MQL5 involves advanced neural network layer handling and dynamic positional encoding, providing traders and developers a powerful tool for improved time series analysis.
#MQL5 #MT5 #Timeseries #AI

Read more...
πŸ‘25❀7⚑4πŸ‘2πŸ‘¨β€πŸ’»2πŸ’”1
Discover how to enhance your trading charts with custom objects in MQL5! This article discusses how to create and modify chart objects to provide visual clarity and actionable insights for traders and developers. Learn to use objects like rectangles, trend lines, and text labels to highlight key price levels, monitor trades, and display real-time performance data. This practical guide walks you through building an Expert Advisor that visualizes entry points, stop losses, and take profits directly on the chart, dynamically updates with market changes, and provides historical trade analysis. Perfect for those looking to deepen their algorithmic trading skills with MQL5.
#MQL5 #MT5 #MQL5 #Trading

Read more...
❀42πŸ‘28✍8πŸ‘4🀑3πŸ‘¨β€πŸ’»3
New feature added to allow direct specification of the starting point for the Parabolic SAR. Users can now set the initial value for more precise control over the Parabolic SAR calculation. Parameters include Trailing Mode options: None, Trailing Fixed, and Trailing Fixed Parabolic SAR. This enhancement enables tailored adjustments in your technical analysis, offering customizable options to fit diverse trading strategies. This update aims to provide advanced users with greater flexibility in setting and refining their indicators, contributing towards more accurate market predictions and better-informed decision-making.
#MQL5 #MT5 #Indicator #AlgoTrading

Read more...
πŸ‘37❀13πŸ‘3πŸ‘¨β€πŸ’»2πŸ†1