35% discount on VIP, GOLD and VIP w/CALL tiers. Use the code TTP35AUGUST during August, valid for up to 6 months. Only first 100 people.
Trendilo indicator has been feature in multiple YouTube videos and in fact it’s a great indicator. Can we use it in a bot? I spent some time trying different things and concluded that it can perform really great when used as a signal filter rather than directly as a entry or exit signal.
In this video I show how it can be achieved both using a FREE setup and one using our power tools from the TTP community.
In this video you learn a lot about using ADB, combining signals using logic AND/OR operators without coding, adding a few lines to an indicator to turn it into a signal filter, and much more.
Trendilo modified code
Below you can find the code of trendilo with the 4 added lines as explained in the video.
Please be aware I haven’t properly tested the code below and it’s not guaranteed to work 100%. Trendilo is a third party indicator, I only added a few lines for educational purposes.
Test using paper trading.
//@version=5
indicator('Trendilo filter', overlay=false)
src = input(close, title='Source')
smooth = input.int(1, title='Smoothing', minval=1)
length = input.int(50, title='Lookback', minval=1)
offset = input.float(0.85, title='ALMA Offset', step=0.01)
sigma = input.int(6, title='ALMA Sigma', minval=0)
bmult = input(1.0, 'Band Multiplier')
cblen = input(false, 'Custom Band Length ? (Else same as Lookback)')
blen = input(20, 'Custom Band Length')
highlight = input(true)
fill = input(true)
barcol = input(false, 'Bar Color')
pch = ta.change(src, smooth) / src * 100
avpch = ta.alma(pch, length, offset, sigma)
blength = cblen ? blen : length
rms = bmult * math.sqrt(math.sum(avpch * avpch, blength) / blength)
cdir = avpch > rms ? 1 : avpch < -rms ? -1 : 0
col = cdir == 1 ? color.lime : cdir == -1 ? color.red : color.gray
fplot = plot(avpch, color=highlight ? col : color.blue, linewidth=2)
posrms = plot(rms, color=color.new(color.purple, 0))
negrms = plot(-rms, color=color.new(color.purple, 0))
fill(fplot, posrms, color=fill and cdir > 0 ? col : na, transp=50)
fill(fplot, negrms, color=fill and cdir < 0 ? col : na, transp=50)
barcolor(color=barcol ? col : na)
hline(0)
plot(cdir ==-1 ? 1: na , "buy zone", color=na, display = display.data_window)
plot(cdir ==1 ? 1: na , "sell zone", color=na, display = display.data_window)
plot(cdir ==0 and cdir[1] == -1 ? 1: na , "end buy", color=na, display = display.data_window)
plot(cdir ==0 and cdir[1] == 1 ? 1: na , "end sell", color=na, display = display.data_window)
alertcondition(cdir ==-1 and cdir[1] == 0, "buy starts")
alertcondition(cdir == 0 and cdir[1] == -1, "buy ends")
alertcondition(cdir ==1 and cdir[1] == 0, "sell starts")
alertcondition(cdir == 0 and cdir[1] == 1, "buy ends")