Trendilio Indicator on Tradingview
Forums › ProRealTime English forum › ProBuilder support › Trendilio Indicator on Tradingview
- This topic has 9 replies, 4 voices, and was last updated 1 year ago by phoentzs.
-
-
07/31/2023 at 10:07 PM #218408
Can someone please help me convert Trendilio Indicator to PRT? Here is the code
Trendilio Code from Tradingview1234567891011121314151617181920212223242526//@version=5indicator('Trendilo', 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 * 100avpch = ta.alma(pch, length, offset, sigma)blength = cblen ? blen : lengthrms = bmult * math.sqrt(math.sum(avpch * avpch, blength) / blength)cdir = avpch > rms ? 1 : avpch < -rms ? -1 : 0col = cdir == 1 ? color.lime : cdir == -1 ? color.red : color.grayfplot = 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)08/01/2023 at 9:36 AM #21841708/01/2023 at 12:10 PM #218434Text Trading View:
The provided code is a custom indicator called “Trendilo” in TradingView. It helps traders identify trends in price data. The indicator calculates the percentage change of the chosen price source and applies smoothing to it. Then, it calculates the Arnaud Legoux Moving Average (ALMA) of the smoothed percentage change. The ALMA is compared to a root mean square (RMS) band, which represents the expected range of the ALMA values. Based on this comparison, the indicator determines whether the trend is up, down, or sideways. The indicator line is plotted in a color corresponding to the trend direction. The indicator also provides the option to fill the area between the indicator line and the RMS band. Additionally, users can choose to color the bars of the chart based on the trend direction. Overall, the “Trendilo” indicator helps traders visually identify trends and potential reversals in the price data.
Trendilio Indicator12345678910111213141516171819202122232425262728293031323334353637383940414243444546REM Trendilio Code from Tradingview//@version=5src=close //Source is Closesmooth=1 //Smoothing (minimum value=1)length=50 //ALMA Lookbackperiod (minimum value=1)offset=0.85 //ALMA Offset (step=0.01)sigma=6 //ALMA Sigma (minimum value=0)bmult=1.0 //Band Multiplierblen=20 //Custom Band Lengthpch=(src-src[smooth])/(src * 100) //Price changem = (Offset * (length - 1))s = length/SigmaWtdSum = 0CumWt = 0for k = 0 to length - 1 doWtd = Exp(-((k-m)*(k-m))/(2*s*s))WtdSum = WtdSum + Wtd * pch[length - 1 - k]CumWt = CumWt + Wtdnextavpch = WtdSum / CumWt//avpch = ta.alma(pch, length, offset, sigma)blength = lengthrms = bmult * sqrt(summation[blength](avpch * avpch) / blength)If avpch > rms thencdir = 1ElsIf avpch < -rms thencdir = -1Elsecdir=0EndIfIf cdir= 1 thenR=0G=255B=0ElsIf cdir=-1 thenR=255G=0B=0ElseR=128G=128B=128EndIfDrawHLine(0)Return avpch as "avpch" Coloured(R,G,B), rms as "rms" Coloured("purple"), -rms as "-rms" Coloured("purple")08/01/2023 at 12:52 PM #21843908/01/2023 at 1:01 PM #21844108/01/2023 at 1:02 PM #21844208/01/2023 at 1:34 PM #21844308/01/2023 at 2:11 PM #21844408/01/2023 at 2:13 PM #21844508/01/2023 at 5:52 PM #218462@JS Me too. Otherwise we would all be rich by now. 😉 In my experience, standard indicators, used correctly, are no worse than complex programming.
1 user thanked author for this post.
-
AuthorPosts
Find exclusive trading pro-tools on