UT Bot Strategy with Risk Management [TradeIQ]

This strategy turns the open-source UT Bot Alerts signal into a complete, automatable trading system. It adds entry filters, stop-loss logic, position sizing, account-level risk limits and webhook-ready order messages.
CREDITS The signal engine is the UT Bot Alerts logic published open-source by QuantNomad: an ATR-based trailing line where a close crossing above it is a buy and a close crossing below it is a sell. That part is reused with credit and is unchanged. Everything else in this script is new: the filters, exits, sizing, risk limits, alerts and the stats panel.
WHY THE PIECES ARE COMBINED UT Bot gives direction changes, but a signal alone is not a trade: it has no size, no stop and no protection against bad days. This script answers the questions a bot has to answer:
Should I take this signal? (filters)
How much? (sizing)
Where am I wrong? (stop)
When do I stop trading for the day? (risk limits)
HOW IT WORKS
Signal: a close crossing above or below the UT trailing line (Key Value × ATR). Optionally, the signal can use the Heikin Ashi close instead, which is the real candle's (open + high + low + close) / 4. That is a smoothed price source only: the chart stays a normal candlestick chart and every order fills at real prices.
Filters (each optional): signal-bar volume ≥ a multiple of its 20-bar average (on by default), an EMA trend filter, a higher-timeframe trend filter, minimum ADX, a session window, skipping weekends, and a cooldown after a trade.
The higher-timeframe filter reads the previous closed higher-timeframe bar, so it does not look ahead.
Signals rejected by a filter are marked with a small grey cross, so you can see what each filter removes.
Exits: the opposite UT signal closes or reverses the position. A protective stop (ATR multiple by default; the UT line, a percent or no stop are also available) is placed with the entry, so it is active from the fill bar. There are optional scale-out targets in R multiples, break-even after the first target, and an ATR trailing stop.
Position sizing: risk a fixed % of equity per trade. The quantity is the equity × risk % divided by the distance to the stop, rounded to your lot size and capped by a maximum notional. Fixed %, fixed cash and fixed quantity are also available.
Account risk limits: a maximum number of new trades per day, a daily loss limit (closes positions and blocks new entries for the rest of the day), a pause after N losses in a row, and a maximum-drawdown kill switch.
Alerts: every order sends its own message on fill (open, stop, target, signal exit, close) as JSON or plain text: bot id, ticker, action, side, quantity, price, stop, target. Create one alert on the strategy with the condition "Order fills only" and the message {{strategy.order.alert_message}}, then point the webhook to your own execution service.
DEFAULT PROPERTIES AND WHY
Initial capital 10,000 USD, which is a realistic retail account.
Commission 0.05% per side, a typical crypto taker fee.
Slippage 2 ticks.
Margin 100% (no leverage). Maximum notional is 1× equity.
Risk 1% of equity per trade. With a 2 × ATR stop, the position is usually well below 1× equity.
Orders are processed on bar close and fill on the next bar's open. The strategy does not recalculate on every tick or after order fills.
The default inputs (Key Value 3, ATR 10, volume filter 1.2×, 2 × ATR stop, reverse on the opposite signal) are a trend-following setup intended for 4H crypto charts.
HOW TO USE IT
Use standard candles. Do not run it on Heikin Ashi, Renko or other synthetic chart types, because fills would not be realistic.
Check the Strategy Tester on your own symbol and timeframe before using any alerts. Results differ by market, timeframe and date range.
Start with paper trading. When you connect alerts to an exchange or bot service, make sure its position size and symbol match the strategy.
LIMITATIONS
This is a trend-following system. It wins a minority of trades and relies on larger winners, so long losing streaks are normal, and it performs poorly in sideways markets.
The UT line uses only closed-bar data and does not repaint. Signals are evaluated on the bar close.
Backtests do not include funding fees, exchange outages or partial fills.
Past results do not guarantee future results. This script is for educational purposes and is not financial advice.
CREDITS The signal engine is the UT Bot Alerts logic published open-source by QuantNomad: an ATR-based trailing line where a close crossing above it is a buy and a close crossing below it is a sell. That part is reused with credit and is unchanged. Everything else in this script is new: the filters, exits, sizing, risk limits, alerts and the stats panel.
WHY THE PIECES ARE COMBINED UT Bot gives direction changes, but a signal alone is not a trade: it has no size, no stop and no protection against bad days. This script answers the questions a bot has to answer:
Should I take this signal? (filters)
How much? (sizing)
Where am I wrong? (stop)
When do I stop trading for the day? (risk limits)
HOW IT WORKS
Signal: a close crossing above or below the UT trailing line (Key Value × ATR). Optionally, the signal can use the Heikin Ashi close instead, which is the real candle's (open + high + low + close) / 4. That is a smoothed price source only: the chart stays a normal candlestick chart and every order fills at real prices.
Filters (each optional): signal-bar volume ≥ a multiple of its 20-bar average (on by default), an EMA trend filter, a higher-timeframe trend filter, minimum ADX, a session window, skipping weekends, and a cooldown after a trade.
The higher-timeframe filter reads the previous closed higher-timeframe bar, so it does not look ahead.
Signals rejected by a filter are marked with a small grey cross, so you can see what each filter removes.
Exits: the opposite UT signal closes or reverses the position. A protective stop (ATR multiple by default; the UT line, a percent or no stop are also available) is placed with the entry, so it is active from the fill bar. There are optional scale-out targets in R multiples, break-even after the first target, and an ATR trailing stop.
Position sizing: risk a fixed % of equity per trade. The quantity is the equity × risk % divided by the distance to the stop, rounded to your lot size and capped by a maximum notional. Fixed %, fixed cash and fixed quantity are also available.
Account risk limits: a maximum number of new trades per day, a daily loss limit (closes positions and blocks new entries for the rest of the day), a pause after N losses in a row, and a maximum-drawdown kill switch.
Alerts: every order sends its own message on fill (open, stop, target, signal exit, close) as JSON or plain text: bot id, ticker, action, side, quantity, price, stop, target. Create one alert on the strategy with the condition "Order fills only" and the message {{strategy.order.alert_message}}, then point the webhook to your own execution service.
DEFAULT PROPERTIES AND WHY
Initial capital 10,000 USD, which is a realistic retail account.
Commission 0.05% per side, a typical crypto taker fee.
Slippage 2 ticks.
Margin 100% (no leverage). Maximum notional is 1× equity.
Risk 1% of equity per trade. With a 2 × ATR stop, the position is usually well below 1× equity.
Orders are processed on bar close and fill on the next bar's open. The strategy does not recalculate on every tick or after order fills.
The default inputs (Key Value 3, ATR 10, volume filter 1.2×, 2 × ATR stop, reverse on the opposite signal) are a trend-following setup intended for 4H crypto charts.
HOW TO USE IT
Use standard candles. Do not run it on Heikin Ashi, Renko or other synthetic chart types, because fills would not be realistic.
Check the Strategy Tester on your own symbol and timeframe before using any alerts. Results differ by market, timeframe and date range.
Start with paper trading. When you connect alerts to an exchange or bot service, make sure its position size and symbol match the strategy.
LIMITATIONS
This is a trend-following system. It wins a minority of trades and relies on larger winners, so long losing streaks are normal, and it performs poorly in sideways markets.
The UT line uses only closed-bar data and does not repaint. Signals are evaluated on the bar close.
Backtests do not include funding fees, exchange outages or partial fills.
Past results do not guarantee future results. This script is for educational purposes and is not financial advice.
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。