The “Trendilo” 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.
(original author: dudeowns)
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 40 41 42 43 |
src=close //Source is Close smooth=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 Multiplier blen=20 //Custom Band Length pch=(src-src[smooth])/(src * 100) //Price change m = (Offset * (length - 1)) s = length/Sigma WtdSum = 0 CumWt = 0 for k = 0 to length - 1 do Wtd = Exp(-((k-m)*(k-m))/(2*s*s)) WtdSum = WtdSum + Wtd * pch[length - 1 - k] CumWt = CumWt + Wtd next avpch = WtdSum / CumWt //avpch = ta.alma(pch, length, offset, sigma) blength = length rms = bmult * sqrt(summation[blength](avpch * avpch) / blength) If avpch > rms then cdir = 1 ElsIf avpch < -rms then cdir = -1 Else cdir=0 EndIf If cdir= 1 then R=0 G=255 B=0 ElsIf cdir=-1 then R=255 G=0 B=0 Else R=128 G=128 B=128 EndIf DrawHLine(0) Return avpch as "avpch" Coloured(R,G,B), rms as "rms" Coloured("purple"), -rms as "-rms" Coloured("purple") |
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 :PRC is also on YouTube, subscribe to our channel for exclusive content and tutorials