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
The TL Short Close EA closes a short trade when the bar closes above the upper trendline for a loss or touches the lower trendline for a profit. The TL Long Close EA, on the other hand, closes a long trade when the bar closes below the lower trendline for a loss or touches the upper trendline for a profit.

Ensure trendlines are drawn manually or through an auto trendline indicator, though manual drawing is preferred. Note that this tool does not open trades but rather closes manually or EA-opened trades.

Both upper and lower trendlines must be drawn for proper functionality. Download required indicators from the comment section. The Expert Advisors operate based on once-per-bar logic, so maintain the chart on the desired timeframe for accurate bar closure.
#MQL5 #MT5 #EA #Strategy

Read more...
❀18πŸ‘15πŸ‘¨β€πŸ’»4
Copying and pasting graphical objects between open charts in MetaTrader can be challenging due to the absence of a native "Copy & Paste" feature. While templates can be used, they save the entire chart state, which may include irrelevant data. To address this, the ChartObjectsCopyPaste.mq5 indicator has been developed. This indicator allows for the copying of selected objects to the clipboard to be pasted onto other charts.

The indicator is based on ObjectGroupEdit.mq5 from the algotrading book and utilizes classes like ObjectMonitor and MapArray. It requires attachment to at least two charts: a source chart for copying objects and a target chart for pasting them. The process uses Ctrl+Q to copy and Ctrl+J to paste, due to MetaTrader's interception of standard hotkeys.

The indicator uses system DLLs to access the Windows clipboard, requiring DLL i...
#MQL5 #MT5 #Indicator #AlgoTrading

Read more...
πŸ‘15❀5πŸ‘¨β€πŸ’»4
Explore the implementation of a robust Trend Constraint Expert Advisor in MetaTrader 5. This article delves into integrating seven renowned trading strategies, focusing on the trend following method using moving averages. Transitioning from daily candles to minute (M1) timeframes, it optimizes entry levels with the Relative Strength Index (RSI). Learn how magic numbers streamline multi-strategy trading and ensure precise trade association. Finally, see how moving averages are mathematically employed to determine trends, enhancing trade accuracy. Ideal for both seasoned and aspiring algo traders, this piece offers actionable insights into elevating your trading algorithms.
#MQL5 #MT5 #Strategy #AlgoTrading

Read more...
❀21πŸ‘11πŸ‘€5🀯2πŸ‘1πŸ‘¨β€πŸ’»1
Part 6 covered integrating responsive inline buttons for bot interaction. In this part, the focus shifts to automating the addition of indicators on MetaTrader 5 charts using commands from Telegram.

The system involves capturing user-defined indicator parameters via Telegram, parsing the data, and applying the indicators to trading charts in real-time.

The first section covers how traders can use Telegram to control indicators on MetaTrader 5, followed by parsing and processing these commands, then executing the indicators in MQL5. Thorough testing ensures the system operates smoothly.

By the end, traders will have a fully functional system for real-time indicator automation via Telegram and MetaTrader 5.
#MQL5 #MT5 #Indicator #EA

Read more...
πŸ‘21❀12πŸ‘¨β€πŸ’»3πŸ‘2
Continuing the series on building the Connexus library, this article will cover HTTP protocol mechanisms, URL structure, and constructing two key initial classes: CQueryParam for managing query parameters and CURL for handling complete URL elements.

HTTP Overview:
- HTTP is a stateless protocol layered on TCP/IP.
- Comprises request line (method, URL, version), headers, and body.
- Common methods: GET, POST, PUT, DELETE, PATCH.
- Status codes: 1xx (info), 2xx (success), 3xx (redirect), 4xx (client error), 5xx (server error).

URL Structure:
- Components: Protocol, Domain, Port (optional), Path, Query Params, Fragment (not supported in Connexus).
- Example breakdown: https://www.example.com:8080/market/symbols?active=EURUSD&timeframe=h1.

Class Construction:
- CURL: Manages URL components pragmatically.
- CQueryParam: Converts query strings to structured J...
#MQL5 #MT5 #Algorithm #HTTP

Read more...
πŸ‘38❀16πŸ‘5πŸ‘¨β€πŸ’»5
A new script has been developed for MT5 that checks and deletes chart objects. It scans the current chart for any available objects, counts them, and deletes them as required. Additionally, it logs the names of the objects present on the chart. This script is particularly useful for maintaining a clean and organized workspace. The ability to efficiently manage chart objects without manual intervention can significantly enhance workflow and productivity. Utilizing such tools ensures that unnecessary chart clutter is minimized, allowing for more focused analysis and decision-making. Advanced users and developers are encouraged to integrate this script into their regular chart management routines.
#MQL5 #MT5 #script #algorithm

Read more...
❀20πŸ‘17πŸ‘¨β€πŸ’»4πŸ‘€4✍3
Discover the power of adaptive indicators in MetaTrader 5! Traditional indicators fall short by using constant ratios, but adaptive indicators revolutionize trading with dynamic feedback mechanisms adjusting to market conditions. Explore methods like least squares, error handling, Laplace smoothing, and parameter optimization for robust adaptive indicators. Practical insights include averaging errors, calculating stable SL values, and detailed examples of indicators with adaptive ratios. These innovations bolster self-adjustment capabilities, offering new avenues in technical analysis. Perfect for traders and developers aiming to elevate their algorithmic trading strategies. Dive in to refine your trading tools with cutting-edge adaptability.
#MQL5 #MT5 #Indicator #Algorithm

Read more...
πŸ‘25❀14πŸ‘Œ5πŸ‘¨β€πŸ’»5πŸ‘€4
The Doji Pattern Detector EA offers automated detection of Doji candlestick patterns on any chart. A Doji pattern signifies market indecision, occurring when a candle's open and close prices are nearly identical. This EA identifies such candles where the open and close prices fall within a small, predefined range near the midpoint of the candle's high and low.

Key Features:
- Doji Detection: Ensures the open-close price difference is less than 3 points and that these prices are near the midpoint of the high-low range with a 10% tolerance.
- Chart Marking: Highlights detected Doji candles by placing a red arrow 5 points below the candle's low, with a "Doji" label 3 points below the arrow for easy visual identification.
- Alerts and Notifications: Generates alerts and messages when a Doji pattern is found on the previously closed candle.

This tool is benefic...
#MQL4 #MT4 #EA #Indicator

Read more...
❀20πŸ‘15πŸ‘Œ2⚑1πŸ‘¨β€πŸ’»1
The PTB.mq5 indicator is tailored for the MetaTrader 5 trading platform and focuses on calculating and displaying both short-term and long-term price extremes. It also incorporates Fibonacci retracement levels to assist traders in identifying potential market reversals.

Key features of the PTB.mq5 indicator include:

Short-Term High and Low: Computes the highest and lowest prices over a user-defined short length, aiding traders in pinpointing immediate support and resistance levels.

Long-Term High and Low: Calculates the highest and lowest prices over a longer duration, offering insights into overarching market trends.

Fibonacci Levels: Plots critical Fibonacci retracement levels (23.6%, 38.2%, 50%, 61.8%, and 78.6%) based on long-term highs and lows.

Input Parameters:
- `shortLength`: Specifies the number of candles for short-term high and low ca...
#MQL5 #MT5 #Indicator #Fibonacci

Read more...
❀19πŸ‘16πŸ‘Œ5πŸ”₯1πŸ‘¨β€πŸ’»1
The CDebugLogger Class V2 is an advanced logging utility tailored for MQL4/5 environments, offering versatile monitoring, debugging, and application behavior tracking. This version introduces notable enhancements, including a debounce mechanism for event-driven systems like OnTick, OnTimer, and OnChartEvent, along with new filtering and silencing options to pinpoint relevant log entries.

Key Features:

1. Multiple Log Levels: Log messages at INFO, WARNING, ERROR, and DEBUG levels to filter by significance.
2. Timestamp Inclusion: Customizable timestamp formats to track event timings.
3. File Logging: Options for enabling/disabling file logging, specifying paths, and saving logs in CSV format.
4. Contextual Information: Include function signatures, file names, and line numbers for clarity.
5. Silent Keywords: Prevent logging of sensitive information by ...
#MQL5 #MT5 #logging #developer

Read more...
πŸ‘21❀9πŸ‘¨β€πŸ’»3⚑2πŸ‘€2
This tool is designed to calculate position risk based on inputted lot size and stop loss levels. Users can select a point on the chart to set a virtual stop loss, which then calculates both the risk percentage and monetary risk figure for the chosen stop loss and lot size.

In the input section, users can specify whether the calculation is from the ask price (buy positions) or the bid price (sell positions) by selecting buy or sell. The risk is affected by the stop loss distance and the timeframe, as a long stop loss distance on higher timeframes will result in greater risk due to a larger number of points.

This tool is versatile and should function on all types of securities, providing a comprehensive risk analysis for traders.
#MQL5 #MT5 #RiskCalc #TradingTools

Read more...
πŸ‘24❀12πŸ‘¨β€πŸ’»1
Linear Discriminant Analysis (LDA) is frequently used for dimensionality reduction in classification tasks. Similar to Kohonen maps, LDA helps in classifying high-dimensional data by transforming it to make classes more distinct. Specifically, LDA projects data onto a lower-dimensional subspace to optimize class separation, with the subspace dimension never exceeding the number of classes.

Comparison with PCA highlights that while PCA maximizes variance in data axes, LDA focuses on axes that distinctively separate data classes. QDA, a generalization of LDA, does not assume homogeneous class covariances, leading to more parameters for estimation. Unlike LDA, ANOVA uses categorical independent variables and continuous dependent variables for linear combination expressions.

LDA involves diagonalizing the within-class scatter matrix to get eigenvalues ...
#MQL5 #MT5 #Algorithm #LDATrading

Read more...
❀39πŸ‘24✍3πŸ‘¨β€πŸ’»3⚑2
One-Button Click EA facilitates trade execution with predefined Take Profit, Stop Loss, and Lot Size parameters, enabling efficient trading operations with a single click. It integrates automatic pipette conversions and offers real-time Buy and Sell profit displays on the chart for a transparent trading experience.

Key Parameters:
- TP_Pips: Set desired Take Profit levels in pips for automated profit-taking.
- SL_Pips: Define Stop Loss levels in pips to safeguard trades from potential losses.
- Lot Size: Select the lot size for each trade, allowing flexible risk management.

Advantages:
- Instant Trade Execution: Execute Buy or Sell trades instantly without delays.
- Accurate Pipette Conversion: Converts pipettes to pips for both 4 and 5-digit brokers, ensuring precise placements.
- Real-Time Profit Display: Displays real-time labels showing Buy and Sell profit...
#MQL4 #MT4 #EA #Forex

Read more...
πŸ‘22❀18✍1πŸ”₯1πŸ‘¨β€πŸ’»1
Creating dashboards and trading panels in Expert Advisors and indicators is a valuable skill. The provided code offers a comprehensive framework to develop custom dashboards for MetaTrader 5. This foundation allows for the display of essential trading data, enhancing the overall trading experience. For detailed guidance on constructing this panel, refer to the linked YouTube video. This resource will walk you through the process step-by-step, ensuring a thorough understanding. Enhance your trading interface by mastering the creation of informative and fully functional dashboards.
#MQL5 #MT5 #EA #Indicator

Read more...
πŸ‘21❀11⚑3πŸ‘¨β€πŸ’»2πŸ‘Œ1πŸ‘€1
Developing a risk manager class for algorithmic trading offers significant benefits for trader protection and strategy enhancement. This article will extend previous work by incorporating risk control mechanisms into a class for implementation in intraday trading systems.

Key concepts such as Stop Loss, Take Profit, and Slippage are crucial. Adding a subclass for algorithmic trading leverages the RiskManagerBase class and introduces new functionalities. The subclass will integrate core principles like encapsulation and inheritance to maintain and extend pre-existing functionalities without redundant code.

Key components will include interfaces for slippage and spread control, getter methods, and handling algorithmic trading specifics. The article will also discuss practical aspects, such as initialization, class destructors, and implementation ...
#MQL5 #MT5 #RiskManager #AlgoTrading

Read more...
πŸ‘17❀10⚑3✍2πŸ‘¨β€πŸ’»2😁1
The previous article laid the foundation for utilizing optimization results to build an Expert Advisor (EA) with multiple trading strategies. This process no longer requires manually entering parameters into the code or EA inputs. By saving the initialization string in a specific format to a file or source code, the EA can use these configurations directly.

Initial implementation involved manually generating the initialization string. The current task is to automate this process based on optimization results. Although a fully automated solution might not be achieved within this scope, significant progress is expected.

The objectives include creating an EA that performs optimization on multiple symbols and timeframes (EURGBP, EURUSD, GBPUSD, H1, M30, M15). The EA will select the best results, group them, and determine a group multiplier manually. This will ...
#MQL5 #MT5 #EA #Algorithm

Read more...
πŸ‘17❀11πŸ‘¨β€πŸ’»4πŸ‘2πŸ”₯1
Introducing the combination of Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs) for stock market predictions. Here are some insights:

CNNs excel at pattern and feature recognition in time series data, identifying trends, seasonal effects, and anomalies.

RNNs, particularly architectures like LSTM and GRU, specialize in understanding temporal dependencies and maintaining sequences over time.

To build a robust predictive model, integrate feature extraction (CNNs) and temporal modeling (RNNs).

Steps for implementation involve:
1. Feature extraction using CNNs
2. Temporal modeling with RNNs
3. Training and prediction

The combination of these models provides comprehensive insights into market behavior, applicable in trading strategies.

Stay tuned for further developments.
#MQL5 #MT5 #AI #ML

Read more...
πŸ‘16❀8πŸ‘3πŸ‘¨β€πŸ’»2
Navigating the landscape of alternative financial data is crucial for modern investors. With the increasing availability of data sets, the challenge lies in selecting the most resourceful ones for trading strategies. This series guides you in making informed decisions on which alternative datasets to incorporate and which to dismiss.

Highlighting correlation, a fundamental principle in finance, we examine the Federal Reserve’s Nominal Broad Dollar Daily Index (NBDD). Established in 2006, the index's trends, such as record lows in 2008 and all-time highs in 2022, are discussed.

The article explores using macroeconomic indicators from the Federal Reserve Economic Database (FRED) to algorithmically predict the EURUSD exchange rate. Tests involved daily EURUSD data, interest rates, expected inflation, and the Broad Dollar Index. Although initial results show...
#MQL5 #MT5 #AlgoTrading #AI

Read more...
πŸ‘31❀18πŸ‘2πŸ‘¨β€πŸ’»1
The Strategy Tester report for the Euro vs. Great Britain Pound (EURGBP) under the Trickerless RHMP InstaForex-Europe.com system has concluded. The testing period spanned from October 15, 2021, to September 7, 2022, utilizing the "Every tick" model for precision. The test involved 1235 bars and 5326472 ticks with a modelling quality of 58.38%.

Key parameter settings: Tools, Safe, Signal, Time, News, Profit, Growth, Stop, History, Trend, Back_System, Margin, Trade, ATR, ADX, and MA indicators.

Financial Results:
- Initial deposit: $10.00
- Total net profit: $216.31
- Gross profit: $216.40
- Gross loss: -$0.09
- Profit factor: 2361.41
- Expected payoff: $3.93
- Absolute drawdown: $4.88
- Maximum relative drawdown: 77.54%

Trade Performance:
- Total trades: 55
- Short positions (won %): 27 (96.30%)
- Long positions (won %): 28 (100.00%)
- Profit trades (% of ...
#MQL4 #MT4 #Strategy #EA

Read more...
πŸ‘30❀19πŸ‘¨β€πŸ’»19πŸŽ‰5πŸ‘€4⚑2πŸ†2
The article delves into the technical implementation and enhancement of library classes for MetaTrader 5, specifically focusing on the interaction of graphical elements with the mouse cursor. It introduces an event model for handling cursor actions within active and control areas of graphical objects, facilitating functionality like resizing and moving elements in a user interface. Changes to constants, methods for cursor position detection, and new event handlers are described to improve accuracy and prevent interaction issues. The article also discusses refining the handling of visibility scopes in graphical hierarchy and optimizing the separator behavior in the SplitContainer control for better user experience.
#MQL5 #MT5 #Algorithm #Indicator

Read more...
πŸ‘53❀20πŸ†6πŸ‘¨β€πŸ’»3⚑2πŸ”₯1🀯1
The LineNotify function sends messages to the LINE app via the Line Notify service using web requests. This method is applicable in EA or Script programs but not in Indicator programs. The function is useful for integrating notifications in automated trading systems. Users can extend the function to include additional features like sending messages with stickers or images through URLs. For further guidance on implementation and customization, consider watching tutorials that provide detailed demonstrations. These resources offer practical insights into how to enhance the functionality of this notification system within trading applications.
#MQL4 #MT4 #script #LineNotify

Read more...
❀21πŸ‘16πŸ‘¨β€πŸ’»3🀯1