I tried several times to create the function for calculating the body length starting from the ta.ema function:
Code: Select all
pine_ema(src, length) =>
alpha = 2 / (length + 1)
sum = 0.0
sum := na(sum[1]) ? src : alpha * src + (1 - alpha) * nz(sum[1])
plot(pine_ema(close, 15))
I created some code that doesn't even work well. It's not a reproduction of the ema function because I'm not that good at programming and from what I see in the printouts, I don't really like how it works. Can you help me understand or post a link to an indicator so I can study it by looking at how it was made?
I thank you infinitely