Comment on page
🧮

Code: AB TrendRider

The TrendRider indicator is a technical analysis tool used to identify the direction and strength of a trend in a financial instrument. It comprises two moving averages: a fast-moving average (wt1) and a slow-moving average (wt2). The fast-moving average is calculated using the triple exponential moving average (TEMA) of the instrument's high, low, and close (hlc3) prices over a specified period (n1).
The slow-moving average is calculated using the simple moving average (SMA) of the fast-moving average over a second specified period (n2). When the fast-moving average crosses above the slow-moving average, it indicates the presence of an uptrend. Conversely, when the fast-moving average crosses below the slow-moving average, it indicates the presence of a downtrend.
The indicator also utilises the commodity channel index (CCI) to measure the trend's strength. When the CCI is above zero, it indicates that the trend is strong; when it is below zero, it indicates that the trend is weak. In addition to identifying the direction and strength of a trend, the TrendRider indicator also provides visual signals in the form of coloured circles and bars. When the fast-moving average crosses above the slow-moving average, the circles and bars are coloured red, indicating an uptrend. When the fast-moving average crosses below the slow-moving average, the circles and bars are coloured yellow, indicating a downtrend. Overall, the TrendRider indicator is a useful tool for traders looking to identify trends in the market and make informed trading decisions. It is particularly useful for traders who prefer to use moving averages in their analysis since we recommend the usage in combination with the EMA 200, which reflects the white line within our EMA Ribbon.
//@version=5
indicator(title='AlphaBlock TrendRider', shorttitle='AB Rider')
n1 = input(9, 'Channel Length')
n2 = input(21, 'Average Length')
ap = hlc3
esa = ta.ema(ap, n1)
d = ta.ema(math.abs(ap - esa), n1)
ci = (ap - esa) / (0.015 * d)
tci = ta.ema(ci, n2)
wt1 = tci
wt2 = ta.sma(wt1, 4)
plot(0, color=color.new(#9945FF, 0))
plot(wt1, color=color.new(#9945FF, 0), style=plot.style_area)
plot(wt2, color=color.new(#35096b, 4), style=plot.style_area)
plot(ta.cross(wt1, wt2) ? wt2 : na, color=color.new(color.black, 0), style=plot.style_circles, linewidth=4)
plot(ta.cross(wt1, wt2) ? wt2 : na, color=wt2 - wt1 > 0 ? color.red : #57a0d1, style=plot.style_circles, linewidth=3)
barcolor(ta.cross(wt1, wt2) ? wt2 - wt1 > 0 ? #ea6262 : #57d186 : na)