Can someone suggest a self adaptable trend algorithm? What functions could be used to analyze the trend?