The UT Bot alerts indicator is a typical trend following indicator.
The UT Bot Alerts is based on the price position and its trail stop.
When the price is above its trail stop the indicator is in an uptrend, and therefore the candles are coloured green, signalling the beginning of a trend with a green arrow.
When the price is below its trail stop the indicator is in a downtrend and the candlesticks are coloured red, marking the beginning of the trend with a red arrow.
Accompanying the price is a trail stop line which is based on the difference between the price and x times its ATR. This makes it a suitable indicator for all types of volatility, as it adjusts according to the market.
Indicator configuration:
– Type of closure: heikin ashi or not.
– a: factor that multiplies the ATR. Provides more or less sensitivity to price movements.
– c: ATR periods.
You can also configure the indicator to show or not the arrows and the colour of the candles.
//PRC_UT Bot Alerts
//version = 1
//15.02.24
//Iván González @ www.prorealcode.com
//Sharing ProRealTime knowledge
///inputs
a = 1 //Key Vaule. 'This changes the sensitivity' - Decimal
c = 10 //ATR period - Integer
drawsignals = 1 //Show arrows - Boolean
colorcandles = 1 //Color candles - Boolean
heikin = 1 // boolean. True work as Heikin A
/////////////////
xatr = averagetruerange[c](close)
nLoss = a * xatr
if heikin then
src = (open+close+high+low)/4
else
src = close
endif
if barindex < c then
xatrTrailingStop = undefined
pos = 0
else
if src > xatrTrailingStop[1] and src[1] > xatrTrailingStop[1] then
xAtrTrailingStop = max(xatrTrailingStop[1],src-nLoss)
else
if src < xatrTrailingStop[1] and src[1] < xatrTrailingStop[1] then
xAtrTrailingStop = min(xatrTrailingStop[1],src+nLoss)
else
if src > xatrTrailingStop[1] then
xAtrTrailingStop = src-nLoss
else
xAtrTrailingStop = src+nLoss
endif
endif
endif
if src[1] < xatrTrailingStop[1] and src > xAtrTrailingStop[1] then
pos = 1
r=250
g=0
b=0
else
if src[1] > xatrTrailingStop[1] and src < xatrTrailingStop[1] then
pos = -1
r=0
g=0
b=250
else
pos = pos[1]
endif
endif
endif
///////Trading conditions
ema = average[1](src)
above = ema crosses over xatrTrailingStop
below = ema crosses under xatrTrailingStop
buy1 = src > xatrTrailingStop and above
sell1 = src < xatrTrailingStop and below
barbuy = src > xatrTrailingStop
barsell = src < xatrTrailingStop
//////Plot signals and candles
if drawsignals then
if buy1 then
drawarrowup(barindex,low-0.15*averagetruerange[10])coloured("green")
elsif sell1 then
drawarrowdown(barindex,high+0.15*averagetruerange[10])coloured("red")
endif
endif
if colorcandles then
if barbuy then
rbar=0
gbar=250
bbar=0
elsif barsell then
rbar=250
gbar=0
bbar=0
else
rbar=125
gbar=125
bbar=125
endif
DRAWCANDLE(open, high, low, close)coloured(rbar,gbar,bbar)
endif
return xatrTrailingStop as "Trailing Stop" coloured(r,g,b)style(line,2)