MQL5 Algo Trading
393K subscribers
2.59K photos
2.59K 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
Channel created
In the world of programming, methods to display values play a crucial role. A situation arises when there is a requirement for the formatted output of a value or property that is not very often in demand. In such cases, developers do not want to spend time searching for solutions, rather, they desire a ready-made collection of recipes for presenting all kinds of information. In this context, an exploration of the PrintFormat function provided by the MetaTrader 5 terminal could be beneficial.

The PrintFormat function allows developers to send their desired data to the log in a formatted easy-to-understand way. It can be customized to format and print sets of characters and values into the EA journal according to a specified format. A developer can set its own output format for each value, thereby creating versatile solutions for even the most obscure demands.

In reality, the applica...

Read More
πŸ‘38❀26πŸ€”4✍2πŸ‘€2πŸ‘Œ1
Understanding the Double Bollinger Band Strategy: This strategy utilises two Bollinger Bands to filter entries and exits within the forex market. The primary aim is to enter Buy (Sell) trades when the price fluctuates above (below) 3Οƒ (2 standard deviations). It also accommodates the 2Οƒ (2 standard deviations) in Bollinger Bands for making informed trade selections.

Incidentally, the default parameters are as follows:
- 2Οƒ Bollinger Bands (20,2) refers to the simple moving average (20) coupled with the number of standard deviations (2).
- 3Οƒ Bollinger Bands (20,3) collectively denotes the simple moving average (20) and the number of standard deviations (3).

For Long Entry, a Buy order opens if two conditions are satisfied: the Ask price overtakes the 3Οƒ upper Bollinger Band and the current price is within the 2Οƒ upper and lower Bollinger Bands. For Sell entry, a Sell order opens whe...

Read More
πŸ‘15❀3✍1
Introducing the Multi-Currency Expert Advisor, a dynamic trading robot capable of managing orders for 30 different currency pairs from a single chart symbol. It is powered by the robust MQL5 capabilities and relies on the use of the Parabolic SAR or iSAR Indicator across multiple timeframes from PERIOD_M15 to PERIOD_D1.

The Expert Advisor operates with common pairs typically used by brokers, making it highly compatible. An extensive spectrum is covered, spanning from Forex pairs such as EURUSD, GBPUSD, AUDUSD etc., all the way to metal pairs like XAUUSD (Gold) and XAGUSD (Silver).

Unlike conventional Expert Advisors, the Multi-Currency system doesn't confine calculations of indicator signals to a fixed timeframe. It remains effectively operational, whether it's calculating signals across timeframes ranging from PERIOD_M15, PERIOD_M30, PERIOD_H1, PERIOD_H4 to PERIOD_D1.

The Expert A...

Read More
πŸ‘10❀1πŸ€”1
An effective edit of the Mod_ATR_Trailing_Stop, a reliable algorithm initially crafted by Scriptor, has recently been completed. By tweaking the code, the number of buffers has been successfully reduced from two to one, resulting in a single line output. This modification aligns this iteration of code more closely with Bruce Hellstrom's original MT4-LevelStop-Reverse.v2, known for its efficiency and utilizing just one buffer.

With the ripple effects of this edit extending across platforms, a drumroll seems to be in order for MT5 users. Thanks to these revisions, this version of the indicator might be the closest MT5 users can get to incorporate an indicator akin to Bruce Hellstrom's MT4-LevelStop-Reverse.v2.

Those seeking to brush up their skills or just satisfy their curiosity should head towards https://www.mql5.com/en/code/20423 to grasp the intricacies of the original code. It ...

Read More
πŸ‘9πŸ€”2❀1
Developing a GUI library in the context of MetaTrader 5 is no minor feat, and it's certainly not the first task typically associated with this platform. However, it can be a rewarding challenge, paving the way for enhanced control over projects, customised capabilities, and valuable learning experiences.

GUI libraries enable tracking and modifying object properties, such as triggering events like movements or color changes. This is usually organised in a tree structure often manage through a 'program class', a placeholder coordinating operations that avoid unnecessary repetition and ensure children are created timely.

The fundamental building block of any GUI library is the 'element class', taking care of the crucial information about position, size, and relations with other elements. Handling the relations between objects involves defining functions for adding child elements and se...

Read More
πŸ‘7❀2πŸ‘¨β€πŸ’»1
In the realm of programming, the intricacy of setting the maximum rollback size is critical. To address this, simply locate the upper-left corner of the chart for the specific window. This action triggers the indicator to promptly display the proximate reversal levels as well as their corresponding probability. Such process bolsters the understanding between developers and their tools, hence, ultimately crafted for efficiency and functionality. The aforementioned method exemplifies the harmony between user control and technological sophistication, a key aspect in this field of work.

Read More
πŸ‘5❀1πŸ€”1
The application of category theory to finance, particularly its adaptation for valuation and portfolio allocation, is yet unexplored terrain; especially in the realm of stock valuation where key stock metrics are viewed as objects in a category. This theoretical approach could provide unique insights into financial trends and risk evaluation.

In time series forecasting, moving averages are key. While occasionally overlooked for being too simplistic, their foundational role in other indicators, such as Bollinger Bands and Moving Average convergence divergence (MACD), makes them indispensable. Less volatile view of price actions presented by moving averages can dim double-edged sword of market white noise.

Natural transformations in category theory bridge the gap between related data sets of varying dimensions. These enable the comparison of 'simple' series of raw prices with 'compoun...

Read More
πŸ‘5πŸ€”1
In today's technical discussion, a closer look is taken at the robust indicator tool based mainly on analyses of pricing channels and asset volatility. Functioning as a trend predictor, this tool excels in generating accurate signals embodied in arrow form.

These signals serve as pivotal markers for traders, hinting at trend reversals. In turn, practitioners can base their strategic trading decisions upon these timely cues. The confluence of price channel dynamics and asset volatility analysis gives this indicator its potency, making it an essential instrument in any trader's analytical toolbox.

An enhanced understanding of market trend shifts can be the determining factor between successful and unfruitful trading outcomes. Using reliable signal generators such as this, traders gain a valuable edge in forecasting and strategizing actions in the dynamic trading landscape.

Read More
πŸ‘7❀1πŸ†1
The Go-Explore algorithm introduces a leading-edge approach to reinforcement learning problem-solving. Distinctively focusing on finding relevant states and actions within the state space, rather than directly tackling the target problem, this method promotes efficient learning by allowing for the revisitation and remembering of promising state spaces. Building and testing separate Expert Advisors sequentially, each performing a unique algorithm task with a common objective of policy learning constitutes the structure of the process. Collected data results from the short-term strategy tester reveals promising outcomes, demonstrating exceptional balance sheet growth metrics, and trade profitability. However, extensive testing and training over a longer timeline are necessary before deployment into real-world account use.

Read More
πŸ‘7
Unveiling the "Martin Gale Breakout" strategy in Forex trading landscape. This Expert Advisor (EA) ingeniously couples a breakout trading approach with Martin Gale's money management elements, significantly optimizing trading performance.

Key input parameters include TakeProfPoints– setting a Take Profit level in points for each trade, BalancePercentageAvailable which defines the percentage of the account balance used for trading, and TP_Percentage_of_Balance and SL_Percentage_of_Balance for determining the account balance percentages allocated for Take Profit and Stop Loss respectively. The Start_The_Recovery feature regulates the activation of recovery measures. With TP_Points_Multiplier, creating flexible profit-taking strategies becomes seamless. The unique identifier MagicNumber allows the EA to manage its trades independently.

The strategy offers numerous advantages. Its mast...

Read More
πŸ‘4
In the preceding article, certain amendments were made but there's an error yet to be addressed. Today, let's focus on modifying the control indicator to apply only to a chart with a specific symbol.

Step one necessitates linking the control indicator to the symbol for market replay. The function executed during initialization is designed to call our indicator, allowing for seamless removal. Consider that once we remove it from the chart, MetaTrader 5 generates the DeInit event, enabling the OnDeInit function, thus leading to the removal of the indicator.

If any alterations were detected in the code compared to the previous article, be advised that the last article tackled a different objective. Mid-way, yet another issue was discovered necessitating adjustments to the code independently from the previous fixes.

Encountering such roadblocks, modifications and workarounds are par...

Read More
πŸ‘3
Presenting the "Martin Gale Breakout" strategy - an intelligent Expert Advisor (EA) for Forex market trading. It converges a breakout trading methodology with Martin Gale's principles of money management, thereby enhancing trading efficiency.

The EA offers a broad spectrum of customizable Input Parameters such as TakeProfPoints to set the Take Profit level for each trade and BalancePercentageAvailable to designate how much of your account balance to use for trading. Also, parameters like TP_Percentage_of_Balance, SL_Percentage_of_Balance allows you to determine the account balance percentages for Take Profits and Stop Losses. Moreover, TP_Points_Multiplier provides an option to multiply Take Profit points, customizing profit-making strategies.

Recovery is significant in trading. Start_The_Recovery, a crucial parameter manages the recovery process, controlling the timing and manner o...

Read More
πŸ‘5❀1
Latest advancement from the coder's desk: Rectifying minor faults and enhancing tests for the replay system, catering to steadfast stability. A configuration file has also been introduced into the system, aiding in more manageable operations. Peak system stability continues to remain an unfulfilled agenda, with solutions both simple and complex remaining to be implemented.

On one hand, present improvements feature the incorporation of a control indicator that remains on the chart even after loading the template. The new feature ensures the replay service stops immediately upon the removal of the indicator. On the other hand, the system ensures the control indicator stays intact, even in cases of partial deletion.

The code has also been tweaked to tackle situations where the system begins opening charts of the same symbol, creating a bottleneck scenario. The enhanced function ensure...

Read More
πŸ‘3
In a recent technical exploration, attention was focused on the MarketOpenHours.mqh file and its functionality. This particular file examines the discrepancy between Market Open Hours and the server time assigned by the broker. It's worth noting that the input required here is solely the Symbol name in string format.

Following the processing of this information, an output is produced: a boolean value indicating whether the market is open (true) or closed (false). The variance in open times on divergent weekdays is a point of keen interest and can be seen in the associated image, which demonstrates the open hours for the broker DarwinEx regarding the symbol EURUSD.

Technical specifications of the include file incorporate an initial examination of the weekday (Monday through Friday). Such provision permits the potential for trade opening and stop trailing during this timeframe. A chec...

Read More
πŸ‘3❀1
Unveiling a possible resolution to the exploration problem in reinforcement learning – introducing Self-Supervised Exploration via Disagreement. This algorithm, based on a self-learning approach, enables the agent to generate intrinsic rewards by interacting and getting information from its environment. Unlike other algorithms, it incorporates multiple models interacting with the environment, producing varying predictions.

If the models disagree, it's regarded as an 'interesting' event, making the agent more determined to uncover that space in the environment. As the agent explores novel environment areas, it's able to offer more accurate reward predictions. It increases efficiency and reduces reliance on potential limited or costly external rewards, making it particularly beneficial in real-world applications.

The discrepancy in forecasts is used as an intrinsic reward for policy...

Read More
πŸ‘5❀1
Access the treasure trove of coding examples housed in the official documentation, whether the goal is to learn, create a foundation for more complex programs, or simply improve personal codebases for more simplified, reusable solutions.

Find inspiration in the reworked codes available on Mql5 iFunctions, which are now optimized for recycling. Feedback is appreciated. Prospective users are encouraged to compare these codes with those from the original document and provide constructive comments.

For beginners in coding, a variety of basic codes have been provided, which include ADX, Alligator, AMA - Adaptive Moving Average, ATR - Average True Range, Bands Bollinger, and Ichimoku among others. These have been designed to fast track learning and provide a chase for quick evolution.

For those looking to understand calculations of indicators without applying Mql5 iFunctions, look no ...

Read More
πŸ‘2❀1
In this series, we have been focusing on the non-operational section of the MQTT protocol. Now, we are moving on to the operational part, which involves dealing with packets sent from the server. Our client needs to identify the server packet type and determine the appropriate behavior based on the client's state. To do this, we need to identify the server packet type in the first byte of the response. If it is a CONNACK packet, we must read its Connect Reason Code and react accordingly.

When our client requests a connection with the server, it must inform the server about desired capabilities, such as authentication and session preferences. This is done by setting bit flags in the Connect Flags field. These flags represent boolean values, with true or false indicating the desired capabilities. For example, the Clean Start flag indicates whether the server should discard any existing...

Read More
πŸ‘2
Detailing Symbol Input Classification: This function accepts the symbol of a financial instrument, its primary function is to ascertain the filling policy. The method employed here is SymbolInfoInteger to accrue the filling policy information for the given symbol. The information is stored numerically in a variable coined 'filling'.

Differentiation of Filling Methods: The numerical value encapsulated in 'filling' is subsequently compared with constants symbolizing the array of filling policies, such as "Fill or Kill" (SYMBOL_FILLING_FOK), "Immediate or Cancel" (SYMBOL_FILLING_IOC), and Return (SYMBOL_FILLING_RETURN).

Deciphering the Filling Policy Protocol: Post comparison, the function identifies the type of the filling policy. If it links with "Fill or Kill," it indicates ORDER_FILLING_FOK. In the case it links up with "Immediate or Cancel," it signals ORDER_FILLING_IOC. Failing...

Read More
πŸ‘8❀1