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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
// 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" |
Share this
No information on this site is investment advice or a solicitation to buy or sell any financial instrument. Past performance is not indicative of future results. Trading may expose you to risk of loss greater than your deposits and is only suitable for experienced investors who have sufficient financial means to bear such risk.
ProRealTime ITF files and other attachments :
Filename : download the ITF files
How to import ITF files into ProRealTime platform?
PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials