Here is an indicator somehow popular in forex trading, known as “THV Coral”. The code here is adapted from Pinescript version.
It is a PSAR-like indicator that plot green and red points to indicate trend direction and/or trend filter.
// parameters
// sm = 21
// cd = 0.4
if(barindex>sm) then
dii = (sm - 1.0) / 2.0 + 1.0
c1 = 2 / (dii + 1.0)
c2 = 1 - c1
c3 = 3.0 * (cd * cd + cd * cd * cd)
c4 = -3.0 * (2.0 * cd * cd + cd + cd * cd * cd)
c5 = 3.0 * cd + 1.0 + cd * cd * cd + 3.0 * cd * cd
src = Close
i1=0
i2=0
i3=0
i4=0
i5=0
i6=0
i1 = c1*src + c2*i1[1]
i2 = c1*i1 + c2*i2[1]
i3 = c1*i2 + c2*i3[1]
i4 = c1*i3 + c2*i4[1]
i5 = c1*i4 + c2*i5[1]
i6 = c1*i5 + c2*i6[1]
bfr = -cd*cd*cd*i6 + c3*(i5) + c4*(i4) + c5*(i3)
endif
if bfr>bfr[1] then
col = 1
else
col = -1
endif
RETURN bfr coloured by col as "Coral Trend Indicator"