
My client asked how to attach the Price Range indicator to his trading robot. Indeed, this allows the use of different Stop Loss and Take Profit values, as well as a variety of trading logic.
If you’re new to this powerful indicator, you can read more about it here: Price Range Indicator – Stay up to date with price movements.
You can also read all about using this indicator effectively here: Trading strategies for the “Price Range MT5” indicator.
Let’s get back to attaching this indicator to your trading robot.
1. Place the Price Range indicator in the same folder as your robot.
2. When receiving the indicator handle via the iCustom function, specify the exact name of the indicator file (without “.ex5”):
3. In the case of a buy signal, the buffer contains the current bar’s low price. Similarly, in the case of a sell signal, the buffer contains the current bar’s high price. Therefore, we need to check whether the number in the buffer is equal to these prices. Since these are double numbers, they cannot be compared exactly; we need to use epsilon.
4. Get prices from the chart. We need the Low and High prices of the same bar from which we took the signal (the first bar):
5. Set accuracy (epsilon). Let’s use _Point – the size of one point (e.g., 0.00001). We consider numbers equal if the difference between them is less than half a point.
B) The value in the buffer is almost equal to the Low price.
B) The value in the buffer is almost equal to the High price.
That’s it!
Don’t forget that the Price Range indicator has a very convenient, customizable notification system for new trends, support and resistance levels, and price ranges on any trading symbol and timeframe.

