I would like to know how this function is named to find how to calculate it. I have a trend like this one and want to find the upper and lower lines, the red ones (as you can see I do not have a great level at mathematics :) ):
EDIT: A better image using a real chart (in this case i need the name or the algorithm to find the black lines)
EDIT2: I would define the function like: from a top in a given (t) trace a line to the next top that does not create a line that cross the function. From a down in a given (t) trace a line to the next down that does not creates a line that cross the function.
This will create multiple lines, I'm ok with that, like in the following picture: I did the question 'cos I thought that this should be something common, please, if it's the first time you see something like this tell me and I will create everything from scratch!