UT Bot Strategy with Backtesting Range
Jan 22, 2020

The UT Bot Strategy with Backtesting Range tool provides an automated trading framework that identifies trend reversal points using a modified trailing stop mechanism to generate actionable buy and sell signals. This script includes a built-in backtesting engine, allowing users to evaluate performance over specific historical periods while offering the flexibility to derive signals from standard or Heikin Ashi price data.
Usage
The Usage section describes how the script can be used for trend following and strategy validation. The script identifies potential entry points by monitoring crossovers between price action and an ATR-based trailing stop line.
- Trend Identification: When the price crosses above the calculated trailing stop, a "Buy" label is generated, and the bars are colored green to indicate a bullish trend. Conversely, when the price crosses below the trailing stop, a "Sell" label appears, and bars are colored red to indicate a bearish trend.
- Heikin Ashi Integration: Users can enable Heikin Ashi signals via the settings. This allows the strategy to calculate logic based on smoothed price action while maintaining the visual execution on a standard candlestick chart. This is often used to filter out market noise and reduce false signals.
- Historical Backtesting: By adjusting the "From" and "To" date inputs, traders can isolate specific market regimes (such as high volatility years or specific bull markets) to see how the UT Bot logic would have performed.
Details
The UT Bot Strategy is built upon the concept of the Average True Range (ATR) to define market volatility. It utilizes a "Key Value" multiplier and an "ATR Period" to create a dynamic stop-loss boundary.
The logic follows these primary steps:
- Volatility Calculation: It calculates the ATR over a user-defined period.
- Trailing Stop Logic: A trailing stop line is calculated by subtracting (for longs) or adding (for shorts) the product of the ATR and the Key Value from the source price.
- Signal Generation: Buy signals are triggered when the source price crosses above the trailing stop; sell signals are triggered when the price crosses below it.
- Source Selection: The script can toggle between standard close prices or Heikin Ashi close prices via
request.security, ensuring the strategy execution remains accurate even if the chart display differs.
Settings
- Key Value: Adjusts the sensitivity of the signals. A higher value makes the indicator less sensitive to price fluctuations, while a lower value makes it more sensitive.
- ATR Period: Defines the lookback period used for the Average True Range calculation.
- Signals from Heikin Ashi Candles: When enabled, the strategy uses Heikin Ashi data for internal calculations instead of standard candle data.
- Backtesting Range (From Day/Month/Year to Day/Month/Year): These settings define the start and end timestamps for the strategy's execution on the chart.
FAQ
How do I adjust the frequency of the signals? You can adjust the "Key Value" and "ATR Period" settings. Increasing these values will result in fewer, more filtered signals, while decreasing them will produce more frequent signals.
Why should I use the Heikin Ashi option instead of just changing my chart type? Using the "Signals from Heikin Ashi" checkbox allows the strategy to calculate its logic based on smoothed data while you keep your chart on standard candlesticks. This ensures you see the actual price levels for execution while benefiting from the trend-filtering properties of Heikin Ashi.
How do I access the UT Bot Strategy with Backtesting Range? You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Free indicator
Get free access to this indicator on the platforms below.
Unlock the entire LuxAlgo Library
Every indicator, every strategy, full charts, and complete access to Quant — our AI agent.