I copied the below code from the public library on tradingview.com. It appears to have been written on an older version of pine script. I am currently using version 4 and I feel the error is because I am calling the function smma from within itself as a recursive function but I am not sure how to fix the error.
study("My Strategy", overlay=true)
//SUITABLE FOR INTRADAY IN BANK NIFTY 5MIN 10MIN AND 15MIN APPLICAPABLE IN ANY TIME FRAME
//TEST YOUR STRATEGY
//borrowed this concept from someone else and modified it for our needs
//teach me pine i wanna learn from you =>[email protected]
smma(src, length) =>
smma = na(smma[1]) ? sma(src, length) : (smma[1] * (length - 1) + src) / length
smma
jawLength = input(13, "Jaw Length")
jawOffset = input(8, "Jaw Offset")
jaw = smma(hl2, jawLength)
plot(jaw, "Jaw", color=color.blue, offset=jawOffset)
smma
before you use it. – Baris Yakut