UT Bot MTF MT4
- Indicators
-
Evgenii Sutulov
I build trading indicators, strategies, and dashboards that don't repaint.
Seven years doing this. MetaTrader 4, MetaTrader 5, TradingView.
Closed bars only. What you see is what happened.
The bar being formed never changes a published value. - Version: 1.3
A trailing stop that never gives ground, and the exact bar it turns. UT Bot MTF draws the ATR stop on your chart, marks every BUY and SELL flip, and then does the part almost no version of it does: it tells you how many signals its filters threw away and which filter threw them, and it warns you, in colour, while the arrow on the current bar can still disappear. Free, no trial, no locked features.
The engine is deliberately simple. The stop follows price at a chosen multiple of ATR, ratchets in the direction of the move and never gives ground back. When price closes through it, the stop flips to the other side and the indicator marks a BUY or a SELL. Optionally the whole calculation measures from the Heikin Ashi close instead of the real close, which makes the flips fewer and later.
What this product adds around that engine is the part that decides whether you can actually use it: three independent filters, an honest account of what each one threw away, and a panel that never pretends the signal on the current bar is finished.
The three filters
Every filter ships switched off. Each one is a separate hypothesis about the market and each can be turned on alone. The trend filter keeps only the signals that agree with the direction of a moving average on a higher timeframe, and the timeframe, the period and the method are all yours to choose. A signal that predates the filter's own data is left alone rather than judged, and the panel says how many those were.
The session filter keeps only the signals inside a time window given as HH:MM in GMT. The broker's GMT offset can be given by hand or detected from the server clock. The volatility filter drops signals taken while ATR is under a floor given in points; a floor of zero never rejects anything, and the panel says so rather than pretending the filter is working.
The panel prints, permanently, which filters are on and with what settings, and one line saying how many signals were kept of how many raw signals there were, broken down by which filter rejected the rest. A filter that is switched on but cannot do its job says so in its own line.
What is on the chart
The trailing stop line, coloured by the side it is currently on. Under it, optionally, a wider and dimmer copy of the same line, so it reads at a glance on a busy chart. Optionally a shaded fill between the stop and price, drawn as a fine dotted screen so the candles read straight through it. BUY and SELL arrows on the flips. And optionally the active stop level shown as a tag on the price scale, anchored to the bar the line ends on, so you can see where the stop is without measuring. Everything draws in the price window.
The panel
A canvas panel on the price chart, draggable, collapsible, closeable. It shows the timeframe in force, the key value and ATR period actually being used, and whether Heikin Ashi is on. It says what the last closed bar was: a BUY flip, a SELL flip, or no flip. It shows the current bar's status in the warning colour while that status applies: either that a BUY is forming on the current bar and can still disappear, or the same line for a SELL, or that closed bars only are in use and a signal will appear at the close. It says whether early alerts are on and how many seconds before the close they speak. It carries the filter block described above, silent when no filter is on. And it says whether the numbers came from the properties dialog or from the panel, and how many were changed.
Below that sit the settings the panel can move, with their current values. The gear opens a three-tab sheet. Values covers the timeframe, key value, ATR period, Heikin Ashi source, signals on the current bar, the trend filter with its timeframe, MA length and MA method, and the volatility filter with its ATR floor; every row has steppers, a range and a sentence of help. Alerts covers the master switch, the per-event switches, the four channels, the cooldown in minutes and a test alert. Styles covers the palette, the fill, the glow, the line, the arrows, line width, arrow size and the price-scale tag, and changes appearance only.
A value moved on the panel takes effect at once, on the closed market too: the history is recomputed there and then rather than waiting for the next tick. Three colour schemes: dark, light, and a colour-blind safe one that uses blue and orange and never puts red against green. Panel state and every sheet change persist per chart across a timeframe change and a terminal restart. The interface is English.
Signals on the forming bar
There is a switch, in the inputs and in the Values tab, deciding whether buffers and arrows may be written on the bar that is still forming. It ships on, and the panel says so in the warning colour whenever it is on. With it on, you see a flip the moment the market makes it, and sometimes that flip is undone before the bar closes and the arrow goes away. With it off, nothing at all is written on the forming bar: nothing repaints, and every signal arrives one bar late by construction. The product does not choose for you and does not hide which mode it is in.
Alerts
Off out of the box. The events are a BUY signal and a SELL signal. The channels are a popup window, a sound, a push to the mobile terminal and e-mail, with per-event and per-channel switches and a cooldown that defaults to two hours.
Alerts fire on the last closed bar. Two further alerts, off by default, speak on the forming bar and only within a chosen number of seconds of its close, and the panel states which mode you are in rather than leaving you to work it out.
Multi-timeframe
The Timeframe setting computes on a higher timeframe and draws the result here. Only closed senior bars are read, so a chart bar shows the newest senior bar that had already closed by its own time. This is separate from the trend filter's timeframe, which is a filter and not a display setting.
A foreign series is built in the background. The first read of it can come back empty; the indicator retries, and the panel says whether it is waiting for a download or short of history. It never fails initialisation over missing bars.
Reading it from an EA
Thirteen buffers, all readable through iCustom. MetaTrader 4 draws at most eight buffers and has neither colour-indexed lines nor a filling style, so this edition has its own map and it is not the MetaTrader 5 one. Buffers 0 and 1 are the two edges of the trend fill. Buffers 2 and 3 are the line glow, up and down. Buffers 4 and 5 are the trailing stop line, up and down. Buffer 6, Buy, carries the arrow price on a BUY flip bar and EMPTY_VALUE otherwise; buffer 7, Sell, is the same for a SELL flip. Buffer 8, Signal, is +1 on a BUY flip, -1 on a SELL flip and 0 when there is no flip. Buffer 9, Override, counts how many settings were changed from the panel. Buffer 10 is the ATR behind the stop, buffer 11 is the trailing stop level and buffer 12 is its colour index, 0 for the long side and 1 for the short side.
Buffers 6 and 7 are the contract and are filled on every pass with the filters already applied, so an EA reading buffer 6 sees the same signals a person sees on the chart. Hiding the arrows on the Styles tab hides them by colour and never by emptying the buffer, so a strategy cannot be starved of the signal by a display setting.
An instance created by iCustom is read-only and always uses the parameters you passed. Buffer 9 lets a strategy detect that a chart instance is running on hand-changed numbers.
Provenance
This is a port of "UT Bot Alerts" from TradingView, an idea by HPotter with the alert variant published by QuantNomad and Yo_adriiiiaan. The script is openly published, which makes a port by formula admissible, and this implementation was reconstructed from the formulas as a working specification rather than translated line by line.
The product carries the method's name because that is what it implements. The original work belongs to its authors and no authorship of it is claimed here.
Honest limits
With forming-bar signals on, which is the shipped default, the arrow on the current bar can disappear before that bar closes. The panel says so in the warning colour every time it applies. Turn the setting off and nothing is written on the forming bar at all. Closed bars never change either way.
A trailing stop flips late by construction. In a range it will flip again and again, and every one of those is a real flip of the stop and a bad trade. There is no test here for whether a trend exists at all; the filters narrow when it may speak, they do not tell you the market is trending.

