Discussing the article: "Custom Indicator Workshop (Part 3): Building the UT Bot Alerts Indicator in MQL5"
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Check out the new article: Custom Indicator Workshop (Part 3): Building the UT Bot Alerts Indicator in MQL5.
This article demonstrates how to build the UT Bot Alerts indicator in MQL5 using a clear, step-by-step approach. The tutorial explains how to implement an ATR-based trailing stop system, compute a custom EMA for signal detection, and generate buy and sell signals without repainting. The final indicator provides well-structured buffers that enable easy integration with Expert Advisors, automated trading systems, and other algorithmic tools within the MetaTrader 5 platform.
Before implementing the indicator in MQL5, it is important to understand the underlying concept behind UT Bot Alerts. Although the indicator appears visually simple, its internal logic is based on a dynamic volatility-adjusted trailing stop that continuously adapts to market conditions.
At the core of the UT Bot system is an ATR-based trailing stop. The Average True Range (ATR) measures market volatility and uses it to determine how far the trailing stop should remain from the current price. Instead of using a fixed stop distance, the system calculates a distance that expands during volatile market conditions and contracts during calmer periods. This distance is typically defined as:
The multiplier allows the user to control the indicator's sensitivity. A larger multiplier produces a wider trailing stop and therefore fewer signals, while a smaller multiplier keeps the stop closer to the price and results in more frequent signals.
Once the Loss Distance is determined, the indicator constructs a dynamic trailing stop that follows the price as the market trends. When the market is moving upward, the trailing stop is placed below the price and moves upward as the price advances. Importantly, the stop never moves downward during a bullish trend. Instead, it only tightens in the direction of the trend. This behavior allows the stop to gradually lock in the trend while remaining responsive to changes in volatility.
Similarly, during a bearish trend, the trailing stop is positioned above the price and moves downward as the price declines. Just like in the bullish case, the stop does not move against the direction of the trend. It only adjusts further in the direction of the current movement, ensuring that the stop always trails the price rather than leading it.
A trend reversal occurs when the price crosses the trailing stop. When this happens, the indicator interprets the event as a change in market direction. The trailing stop then flips to the opposite side of the price. For example, if the price was previously above the trailing stop and then crosses below it, the system switches from a bullish state to a bearish state and places the trailing stop above the price. This flip mechanism effectively converts the trailing stop into a dynamic support and resistance level that continuously adapts to price action.
Author: Chacha Ian Maroa