UT Bot Alerts for MT4 – faithful port with signal statistics panel and daily session filter

A line-by-line port of “UT Bot Alerts” by QuantNomad (Pine v4, 2020). The idea is by HPotter and the first version by Yo_adriiiiaan. The original is open source on TradingView at tradingview.com/script/n8ss8BID/. All credit goes to those authors.
The logic is exactly the original’s:
- ATR is atr(c) = Wilder RMA seeded with an SMA. The built-in iATR is not used.
- Trailing stop follows the original nested iff / nz recursion:
- It ratchets up while price stays above the stop.
- It ratchets down while price stays below the stop.
- It resets to price ∓ Key Value × ATR when price crosses the stop.
- Buy = source above the stop and crossing it upward. Sell = the opposite.
- Bar colors: green above the stop, red below it.
- Optional Heikin Ashi source (HA close = OHLC/4).
Inputs (original defaults): Key Value 1, ATR Period 10, Heikin Ashi off.
Added for MT4:
- The trailing-stop line (the original only colors bars).
- Signal statistics panel. It buys at the bar after a Buy, sells after a Sell, and closes and reverses at the opposite signal. It shows:
- trades, win rate, net points / pips / USD after spread + commission
- profit factor, longest losing streak, max drawdown
- the open trade and the cost per trade
- Daily session filter. Start / end time in your own time zone; overnight windows are allowed. It optionally closes at session end and shades the session on the chart. It is off by default (the panel counts the whole day); set Use_Session = true and your hours to use it.
- Trade marks. Every counted trade is drawn on the chart. Hover a mark for prices, exit reason and result.
- Alerts on new signals.
Buffers for EAs ( iCustom ): 3 = Buy, 4 = Sell, 13 = trailing stop.
The panel describes past signals so you can judge them yourself. Please check the costs line: on 1–5 minute charts the spread and commission per trade are large compared with the average move between two signals. The panel is not a backtest and not a promise of results.
